mirror of
https://github.com/NohamR/prometheus-qbittorrent-exporter.git
synced 2025-05-23 16:49:29 +00:00
Merge pull request #1 from Gabisonfire/master
Added the ability to include uncategorized torrents.
This commit is contained in:
commit
53dc38f796
@ -3,6 +3,7 @@ import os
|
||||
import sys
|
||||
import signal
|
||||
import faulthandler
|
||||
from attrdict import AttrDict
|
||||
from qbittorrentapi import Client, TorrentStates
|
||||
from prometheus_client import start_http_server
|
||||
from prometheus_client.core import GaugeMetricFamily, CounterMetricFamily, REGISTRY
|
||||
@ -122,8 +123,9 @@ class QbittorrentMetricsCollector():
|
||||
return []
|
||||
|
||||
metrics = []
|
||||
categories.Uncategorized = AttrDict({'name': 'Uncategorized', 'savePath': ''})
|
||||
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:
|
||||
status_prop = f"is_{status}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user