2.0.0
This commit is contained in:
@@ -71,6 +71,7 @@ def get_watch_config():
|
||||
CONFIG_PATH_WATCH.parent.mkdir(parents=True, exist_ok=True)
|
||||
# Default watch config
|
||||
defaults = {
|
||||
'enabled': False,
|
||||
'watchedArtistAlbumGroup': ["album", "single"],
|
||||
'watchPollIntervalSeconds': 3600
|
||||
}
|
||||
@@ -82,6 +83,7 @@ def get_watch_config():
|
||||
logging.error(f"Error reading watch config: {str(e)}")
|
||||
# Return defaults on error to prevent crashes
|
||||
return {
|
||||
'enabled': False,
|
||||
'watchedArtistAlbumGroup': ["album", "single"],
|
||||
'watchPollIntervalSeconds': 3600
|
||||
}
|
||||
@@ -189,6 +191,7 @@ def handle_watch_config():
|
||||
watch_config = get_watch_config()
|
||||
# Ensure defaults are applied if file was corrupted or missing fields
|
||||
defaults = {
|
||||
'enabled': False,
|
||||
'watchedArtistAlbumGroup': ["album", "single"],
|
||||
'watchPollIntervalSeconds': 3600
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ CONFIG_PATH = Path('./data/config/watch.json')
|
||||
STOP_EVENT = threading.Event()
|
||||
|
||||
DEFAULT_WATCH_CONFIG = {
|
||||
"enabled": False,
|
||||
"watchPollIntervalSeconds": 3600,
|
||||
"max_tracks_per_run": 50, # For playlists
|
||||
"watchedArtistAlbumGroup": ["album", "single"], # Default for artists
|
||||
@@ -356,6 +357,12 @@ def playlist_watch_scheduler():
|
||||
while not STOP_EVENT.is_set():
|
||||
current_config = get_watch_config() # Get latest config for this run
|
||||
interval = current_config.get("watchPollIntervalSeconds", 3600)
|
||||
watch_enabled = current_config.get("enabled", False) # Get enabled status
|
||||
|
||||
if not watch_enabled:
|
||||
logger.info("Watch Scheduler: Watch feature is disabled in config. Skipping checks.")
|
||||
STOP_EVENT.wait(interval) # Still respect poll interval for checking config again
|
||||
continue # Skip to next iteration
|
||||
|
||||
try:
|
||||
logger.info("Watch Scheduler: Starting playlist check run.")
|
||||
|
||||
Reference in New Issue
Block a user