jellyfin-monitor: only print active streams on change
This commit is contained in:
parent
9d8b8ad33f
commit
1aec911e72
@ -29,6 +29,7 @@ class JellyfinQBittorrentMonitor:
|
|||||||
self.throttle_active = False
|
self.throttle_active = False
|
||||||
self.running = True
|
self.running = True
|
||||||
self.session = requests.Session() # Use session for cookies
|
self.session = requests.Session() # Use session for cookies
|
||||||
|
self.last_active_streams = []
|
||||||
|
|
||||||
# Hysteresis settings to prevent rapid switching
|
# Hysteresis settings to prevent rapid switching
|
||||||
self.streaming_start_delay = 10
|
self.streaming_start_delay = 10
|
||||||
@ -205,6 +206,7 @@ class JellyfinQBittorrentMonitor:
|
|||||||
active_streams = self.check_jellyfin_sessions()
|
active_streams = self.check_jellyfin_sessions()
|
||||||
streaming_active = len(active_streams) > 0
|
streaming_active = len(active_streams) > 0
|
||||||
|
|
||||||
|
if active_streams != self.last_active_streams:
|
||||||
# Log current status
|
# Log current status
|
||||||
if streaming_active:
|
if streaming_active:
|
||||||
logger.info(
|
logger.info(
|
||||||
@ -218,6 +220,7 @@ class JellyfinQBittorrentMonitor:
|
|||||||
self.last_streaming_state = streaming_active
|
self.last_streaming_state = streaming_active
|
||||||
self.toggle_qbittorrent_limits(streaming_active)
|
self.toggle_qbittorrent_limits(streaming_active)
|
||||||
|
|
||||||
|
self.last_active_streams = active_streams
|
||||||
time.sleep(self.check_interval)
|
time.sleep(self.check_interval)
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user