Merge pull request #1 from Gabisonfire/master
Added the ability to include uncategorized torrents.
This commit is contained in:
commit
53dc38f796
1 changed files with 3 additions and 1 deletions
|
@ -3,6 +3,7 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import signal
|
import signal
|
||||||
import faulthandler
|
import faulthandler
|
||||||
|
from attrdict import AttrDict
|
||||||
from qbittorrentapi import Client, TorrentStates
|
from qbittorrentapi import Client, TorrentStates
|
||||||
from prometheus_client import start_http_server
|
from prometheus_client import start_http_server
|
||||||
from prometheus_client.core import GaugeMetricFamily, CounterMetricFamily, REGISTRY
|
from prometheus_client.core import GaugeMetricFamily, CounterMetricFamily, REGISTRY
|
||||||
|
@ -122,8 +123,9 @@ class QbittorrentMetricsCollector():
|
||||||
return []
|
return []
|
||||||
|
|
||||||
metrics = []
|
metrics = []
|
||||||
|
categories.Uncategorized = AttrDict({'name': 'Uncategorized', 'savePath': ''})
|
||||||
for category in categories:
|
for category in categories:
|
||||||
category_torrents = [t for t in self.torrents if t['category'] == category]
|
category_torrents = [t for t in self.torrents if t['category'] == category or (category == "Uncategorized" and t['category'] == "")]
|
||||||
|
|
||||||
for status in self.TORRENT_STATUSES:
|
for status in self.TORRENT_STATUSES:
|
||||||
status_prop = f"is_{status}"
|
status_prop = f"is_{status}"
|
||||||
|
|
Loading…
Reference in a new issue