various/stale

This commit is contained in:
2026-01-25 13:14:00 -05:00
parent 10ccf8c8eb
commit 97fd7dd67d
14 changed files with 501 additions and 64 deletions

View File

@@ -5,6 +5,7 @@ from fastapi.responses import JSONResponse
from utils.sr_wrapper import SRUtil
from auth.deps import get_current_user
from redis import Redis
from pathlib import Path
from rq import Queue
from rq.job import Job
from rq.job import JobStatus
@@ -20,8 +21,7 @@ from lyric_search.sources import private
from typing import Literal
from pydantic import BaseModel
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
logger = logging.getLogger(__name__)
class ValidBulkFetchRequest(BaseModel):
@@ -126,6 +126,22 @@ class RIP(FastAPI):
]
)
# Build detailed per-track list for the job detail response
raw_tracks = job.meta.get("tracks") or []
track_list = []
for t in raw_tracks:
# Normalize fields and pick the requested set
track_list.append(
{
"title": t.get("title"),
"artist": t.get("artist"),
"status": t.get("status"),
"error": t.get("error"),
"filename": t.get("filename")
or (Path(t.get("file_path")).name if t.get("file_path") else None),
}
)
return {
"id": job.id,
"status": job_status.title(),
@@ -140,6 +156,7 @@ class RIP(FastAPI):
if isinstance(tracks_in, int)
else tracks_out
),
"track_list": track_list,
"target": job.meta.get("target"),
"quality": job.meta.get("quality", "Unknown"),
}