Removed uncategorized from config

This commit is contained in:
Gab 2020-10-20 11:45:48 -04:00
parent 2497249b8c
commit 003297ecfd

View file

@ -25,7 +25,6 @@ class QbittorrentMetricsCollector():
"errored", "errored",
"paused", "paused",
] ]
INCLUDE_UNCATEGORIZED = False
def __init__(self, config): def __init__(self, config):
self.config = config self.config = config
@ -36,7 +35,6 @@ class QbittorrentMetricsCollector():
username=config["username"], username=config["username"],
password=config["password"], password=config["password"],
) )
self.INCLUDE_UNCATEGORIZED = config["include_uncategorized"] == 'true'
def collect(self): def collect(self):
try: try:
@ -125,10 +123,9 @@ class QbittorrentMetricsCollector():
return [] return []
metrics = [] metrics = []
if self.INCLUDE_UNCATEGORIZED:
categories.Uncategorized = AttrDict({'name': 'Uncategorized', 'savePath': ''}) 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 or (self.INCLUDE_UNCATEGORIZED and category == "Uncategorized" and t['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}"