jellyfin-monitor: only print active streams on change

This commit is contained in:
2025-09-12 14:57:53 -04:00
parent 9d8b8ad33f
commit 1aec911e72

View File

@@ -29,6 +29,7 @@ class JellyfinQBittorrentMonitor:
self.throttle_active = False
self.running = True
self.session = requests.Session() # Use session for cookies
self.last_active_streams = []
# Hysteresis settings to prevent rapid switching
self.streaming_start_delay = 10
@@ -205,6 +206,7 @@ class JellyfinQBittorrentMonitor:
active_streams = self.check_jellyfin_sessions()
streaming_active = len(active_streams) > 0
if active_streams != self.last_active_streams:
# Log current status
if streaming_active:
logger.info(
@@ -218,6 +220,7 @@ class JellyfinQBittorrentMonitor:
self.last_streaming_state = streaming_active
self.toggle_qbittorrent_limits(streaming_active)
self.last_active_streams = active_streams
time.sleep(self.check_interval)
except KeyboardInterrupt: