From ee261c28f498a45b642d621dc1d9bd69ba07fc31 Mon Sep 17 00:00:00 2001 From: "cool.gitter.not.me.again.duh" Date: Wed, 28 May 2025 15:31:58 -0600 Subject: [PATCH] huh? --- .dockerignore | 3 +- .gitignore | 1 + app.py | 4 +- docker-compose.yaml | 3 +- routes/utils/celery_tasks.py | 23 ++++++++ static/css/config/config.css | 71 +---------------------- {templates => static/html}/album.html | 0 {templates => static/html}/artist.html | 0 {templates => static/html}/config.html | 1 + {templates => static/html}/favicon.ico | Bin {templates => static/html}/main.html | 0 {templates => static/html}/playlist.html | 0 {templates => static/html}/track.html | 0 13 files changed, 32 insertions(+), 74 deletions(-) rename {templates => static/html}/album.html (100%) rename {templates => static/html}/artist.html (100%) rename {templates => static/html}/config.html (99%) rename {templates => static/html}/favicon.ico (100%) rename {templates => static/html}/main.html (100%) rename {templates => static/html}/playlist.html (100%) rename {templates => static/html}/track.html (100%) diff --git a/.dockerignore b/.dockerignore index 6c1fe0a..6ed6843 100755 --- a/.dockerignore +++ b/.dockerignore @@ -18,4 +18,5 @@ output.log queue_state.json search_demo.py celery_worker.log -static/js/* \ No newline at end of file +static/js/* +logs/ \ No newline at end of file diff --git a/.gitignore b/.gitignore index 5ac9910..7f9e133 100755 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,4 @@ logs/spotizerr.log /.venv static/js data +logs/ \ No newline at end of file diff --git a/app.py b/app.py index 2b87998..27b0b41 100755 --- a/app.py +++ b/app.py @@ -131,7 +131,7 @@ def check_redis_connection(): return False def create_app(): - app = Flask(__name__) + app = Flask(__name__, template_folder='static/html') # Set up CORS CORS(app) @@ -184,7 +184,7 @@ def create_app(): # Serve favicon.ico from the same directory as index.html (templates) @app.route('/favicon.ico') def serve_favicon(): - return send_from_directory('templates', 'favicon.ico') + return send_from_directory('static/html', 'favicon.ico') # Add request logging middleware @app.before_request diff --git a/docker-compose.yaml b/docker-compose.yaml index a6d4ddb..44d56d9 100755 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -3,8 +3,7 @@ name: spotizerr services: spotizerr: volumes: - - ./creds:/app/creds - - ./config:/app/config + - ./data:/app/data - ./downloads:/app/downloads # <-- Change this for your music library dir - ./logs:/app/logs # <-- Volume for persistent logs ports: diff --git a/routes/utils/celery_tasks.py b/routes/utils/celery_tasks.py index 5565752..8259b9a 100644 --- a/routes/utils/celery_tasks.py +++ b/routes/utils/celery_tasks.py @@ -7,6 +7,8 @@ from datetime import datetime from celery import Celery, Task, states from celery.signals import task_prerun, task_postrun, task_failure, worker_ready, worker_init, setup_logging from celery.exceptions import Retry +import os # Added for path operations +from pathlib import Path # Added for path operations # Configure logging logger = logging.getLogger(__name__) @@ -358,6 +360,27 @@ class ProgressTrackingTask(Task): """ task_id = self.request.id + # Ensure ./logs/tasks directory exists + logs_tasks_dir = Path('./logs/tasks') # Using relative path as per your update + try: + logs_tasks_dir.mkdir(parents=True, exist_ok=True) + except Exception as e: + logger.error(f"Task {task_id}: Could not create log directory {logs_tasks_dir}: {e}") + + # Define log file path + log_file_path = logs_tasks_dir / f"{task_id}.log" + + # Log progress_data to the task-specific file + try: + with open(log_file_path, 'a') as log_file: + # Add a timestamp to the log entry if not present, for consistency in the file + log_entry = progress_data.copy() + if 'timestamp' not in log_entry: + log_entry['timestamp'] = time.time() + print(json.dumps(log_entry), file=log_file) # Use print to file + except Exception as e: + logger.error(f"Task {task_id}: Could not write to task log file {log_file_path}: {e}") + # Add timestamp if not present if 'timestamp' not in progress_data: progress_data['timestamp'] = time.time() diff --git a/static/css/config/config.css b/static/css/config/config.css index 36ab501..81b1599 100644 --- a/static/css/config/config.css +++ b/static/css/config/config.css @@ -95,55 +95,6 @@ body { margin: 0; } -/* Queue button as floating icon */ -.queue-icon.floating-icon { - position: fixed; - width: 56px; - height: 56px; - bottom: 20px; - right: 20px; - background-color: var(--color-primary); - border-radius: 50%; - box-shadow: var(--shadow-lg); - z-index: 9999; - display: flex; - align-items: center; - justify-content: center; - transition: transform 0.2s ease, background-color 0.2s ease; - text-decoration: none !important; -} - -.queue-icon.floating-icon:hover { - background-color: var(--color-primary-hover); - transform: scale(1.05); -} - -.queue-icon.floating-icon img { - width: 24px; - height: 24px; - filter: brightness(0) invert(1); - margin: 0; -} - -/* Queue Icon Active State */ -.queue-icon.queue-icon-active { - background-color: #d13838 !important; - transition: background-color 0.3s ease; -} - -.queue-icon.queue-icon-active:hover { - background-color: #e04c4c !important; -} - -.queue-icon .queue-x { - font-size: 28px; - font-weight: bold; - color: white; - line-height: 24px; - display: inline-block; - transform: translateY(-2px); -} - /* Queue Sidebar for Config Page */ #downloadQueue { position: fixed; @@ -849,25 +800,7 @@ input:checked + .slider:before { width: 28px; height: 28px; } - - /* Queue icon mobile styles */ - .queue-icon.floating-icon { - width: 50px; - height: 50px; - right: 16px; - bottom: 16px; - } - - .queue-icon.floating-icon img { - width: 22px; - height: 22px; - } - - .queue-icon .queue-x { - font-size: 24px; - line-height: 20px; - } -} + /* Format help styles */ .format-help { @@ -985,7 +918,6 @@ input:checked + .slider:before { width: auto; /* Allow button to size to icon */ min-width: 40px; /* Ensure a minimum touch target size */ height: 40px; /* Ensure a minimum touch target size */ - display: flex; align-items: center; justify-content: center; border-radius: 50% !important; /* Make it circular */ @@ -1003,3 +935,4 @@ input:checked + .slider:before { background-color: #e74c3c !important; /* Lighter red on hover */ transform: translateY(-2px) scale(1.05); } +} \ No newline at end of file diff --git a/templates/album.html b/static/html/album.html similarity index 100% rename from templates/album.html rename to static/html/album.html diff --git a/templates/artist.html b/static/html/artist.html similarity index 100% rename from templates/artist.html rename to static/html/artist.html diff --git a/templates/config.html b/static/html/config.html similarity index 99% rename from templates/config.html rename to static/html/config.html index 2f6c857..42d65db 100644 --- a/templates/config.html +++ b/static/html/config.html @@ -7,6 +7,7 @@ + diff --git a/templates/favicon.ico b/static/html/favicon.ico similarity index 100% rename from templates/favicon.ico rename to static/html/favicon.ico diff --git a/templates/main.html b/static/html/main.html similarity index 100% rename from templates/main.html rename to static/html/main.html diff --git a/templates/playlist.html b/static/html/playlist.html similarity index 100% rename from templates/playlist.html rename to static/html/playlist.html diff --git a/templates/track.html b/static/html/track.html similarity index 100% rename from templates/track.html rename to static/html/track.html