feat: Reimplement download artist discography per groups in artist page

This commit is contained in:
Xoconoch
2025-08-28 07:51:10 -06:00
parent 4476d39d39
commit 0b7c9d0da8
8 changed files with 184 additions and 125 deletions

View File

@@ -1,6 +1,6 @@
import re
from typing import List
from fastapi import APIRouter, Request, Depends, Request, Depends
from fastapi import APIRouter, Request, Depends
from pydantic import BaseModel
import logging
@@ -8,11 +8,9 @@ import logging
from routes.auth.middleware import require_auth_from_state, User
# Import queue management and Spotify info
from routes.utils.get_info import get_spotify_info
from routes.utils.celery_queue_manager import download_queue_manager
# Import authentication dependencies
from routes.auth.middleware import require_auth_from_state, User
# Import queue management and Spotify info
from routes.utils.get_info import (
@@ -22,7 +20,6 @@ from routes.utils.get_info import (
get_playlist,
get_artist,
)
from routes.utils.celery_queue_manager import download_queue_manager
router = APIRouter()
logger = logging.getLogger(__name__)
@@ -33,7 +30,11 @@ class BulkAddLinksRequest(BaseModel):
@router.post("/bulk-add-spotify-links")
async def bulk_add_spotify_links(request: BulkAddLinksRequest, req: Request, current_user: User = Depends(require_auth_from_state)):
async def bulk_add_spotify_links(
request: BulkAddLinksRequest,
req: Request,
current_user: User = Depends(require_auth_from_state),
):
added_count = 0
failed_links = []
total_links = len(request.links)
@@ -56,8 +57,12 @@ async def bulk_add_spotify_links(request: BulkAddLinksRequest, req: Request, cur
spotify_type = match.group(1)
spotify_id = match.group(2)
logger.debug(f"Extracted from link: spotify_type={spotify_type}, spotify_id={spotify_id}")
logger.debug(f"Extracted from link: spotify_type={spotify_type}, spotify_id={spotify_id}")
logger.debug(
f"Extracted from link: spotify_type={spotify_type}, spotify_id={spotify_id}"
)
logger.debug(
f"Extracted from link: spotify_type={spotify_type}, spotify_id={spotify_id}"
)
try:
# Get basic info to confirm existence and get name/artist
@@ -109,9 +114,13 @@ async def bulk_add_spotify_links(request: BulkAddLinksRequest, req: Request, cur
if task_id:
added_count += 1
logger.debug(f"Added {added_count}/{total_links} {spotify_type} '{item_name}' ({spotify_id}) to queue with task_id: {task_id}.")
logger.debug(
f"Added {added_count}/{total_links} {spotify_type} '{item_name}' ({spotify_id}) to queue with task_id: {task_id}."
)
else:
logger.warning(f"Failed to add {spotify_type} '{item_name}' ({spotify_id}) to queue.")
logger.warning(
f"Failed to add {spotify_type} '{item_name}' ({spotify_id}) to queue."
)
failed_links.append(link)
continue