Add web dashboard with live refresh + fade transitions and CLI/GU integration
This commit is contained in:
1 parent
cb966beca2
commit
946e8cd92c
4 files changed
+327
-1
No files matched your search
@@ -1,14 +1,17 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Journey FM Playlist Creator CLI entrypoint."""
|
||||
|
||||
import argparse
|
||||
import logging
|
||||
import sys
|
||||
import time
|
||||
|
||||
from journeyfm.config_store import load_runtime_config
|
||||
from journeyfm.history_service import init_history_db
|
||||
from journeyfm.paths import data_path
|
||||
from journeyfm.plex_service import connect_to_plex_server
|
||||
from journeyfm.update_service import format_result_summary, run_update_job
|
||||
from journeyfm.web_service import get_dashboard_url, start_dashboard_server
|
||||
|
||||
|
||||
def configure_logging():
|
||||
@@ -55,5 +58,32 @@ def update_playlist():
|
||||
return main()
|
||||
|
||||
|
||||
def main_cli():
|
||||
parser = argparse.ArgumentParser(description='Journey FM Playlist CLI')
|
||||
parser.add_argument('--serve-web', action='store_true', help='Start local web dashboard server')
|
||||
parser.add_argument('--host', default='127.0.0.1', help='Dashboard host (default 127.0.0.1)')
|
||||
parser.add_argument('--port', type=int, default=8765, help='Dashboard port (default 8765)')
|
||||
parser.add_argument('--no-open', action='store_true', help='Do not automatically open browser when serving web dashboard')
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.serve_web:
|
||||
init_history_db()
|
||||
result = run_update_job(load_runtime_config())
|
||||
summary = format_result_summary(result)
|
||||
print(summary)
|
||||
httpd, thread = start_dashboard_server(host=args.host, port=args.port, open_browser_if_possible=not args.no_open)
|
||||
print('Web dashboard URL:', get_dashboard_url(args.host, args.port))
|
||||
print('Press Ctrl+C to stop the web server.')
|
||||
try:
|
||||
while thread.is_alive():
|
||||
time.sleep(0.5)
|
||||
except KeyboardInterrupt:
|
||||
print('Shutting down dashboard server...')
|
||||
httpd.shutdown()
|
||||
return result
|
||||
|
||||
return main()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
main_cli()
|
||||
Reference in new issue
Block a user