diff --git a/README.md b/README.md index e486848..c5dff18 100644 --- a/README.md +++ b/README.md @@ -164,7 +164,7 @@ Instead of running the script by hand every time you add something, `--service` ``` python plex-library-tool.py --service # pick share(s) interactively, then start -python plex-library-tool.py --service "/Volumes/Movies" # add a share and start (default: every 60s) +python plex-library-tool.py --service "/Volumes/Movies" # add a share and start (default: every 5 minutes) python plex-library-tool.py --service 120 # set the interval to 120 seconds and start python plex-library-tool.py --service start # start using the current configuration python plex-library-tool.py --service stop # stop the service diff --git a/plex-library-tool.py b/plex-library-tool.py index 9c2a395..c63800c 100755 --- a/plex-library-tool.py +++ b/plex-library-tool.py @@ -33,7 +33,7 @@ NAMES_FILE = SCRIPT_DIR / "names.yaml" CLEANUP_TRASH_DIR = SCRIPT_DIR / ".trash" SERVICE_CONFIG_FILE = SCRIPT_DIR / "service.json" SERVICE_LOG_FILE = LOG_DIR / "service.log" -DEFAULT_SERVICE_INTERVAL = 60 +DEFAULT_SERVICE_INTERVAL = 300 VERBOSE = False @@ -4040,6 +4040,12 @@ def handle_service_command(value): config = load_service_config() config["interval"] = interval save_service_config(config) + + existing_pid = config.get("pid") + if existing_pid and is_process_running(existing_pid): + print(f"Interval updated to {interval}s. The running service (PID {existing_pid}) will pick it up on its next cycle.") + return + if not config.get("paths"): print(f"Interval set to {interval}s. No shares configured yet.") interactive_configure_service()