This commit is contained in:
cool.gitter.not.me.again.duh
2025-05-28 15:31:58 -06:00
parent e822284b88
commit ee261c28f4
13 changed files with 32 additions and 74 deletions

View File

@@ -18,4 +18,5 @@ output.log
queue_state.json
search_demo.py
celery_worker.log
static/js/*
static/js/*
logs/

1
.gitignore vendored
View File

@@ -36,3 +36,4 @@ logs/spotizerr.log
/.venv
static/js
data
logs/

4
app.py
View File

@@ -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

View File

@@ -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:

View File

@@ -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()

View File

@@ -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);
}
}

View File

@@ -7,6 +7,7 @@
<!-- Add the new base.css first -->
<link rel="stylesheet" href="{{ url_for('static', filename='css/main/base.css') }}" />
<link rel="stylesheet" href="{{ url_for('static', filename='css/config/config.css') }}" />
<link rel="stylesheet" href="{{ url_for('static', filename='css/main/icons.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/queue/queue.css') }}">
</head>
<body>

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB