diff --git a/routes/content/bulk_add.py b/routes/content/bulk_add.py index daa0cd0..61ea837 100644 --- a/routes/content/bulk_add.py +++ b/routes/content/bulk_add.py @@ -1,5 +1,5 @@ import re -from typing import List, Dict, Any, Dict, Any +from typing import List from fastapi import APIRouter, Request, Depends, Request, Depends from pydantic import BaseModel import logging @@ -33,7 +33,6 @@ 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 = [] @@ -45,7 +44,7 @@ async def bulk_add_spotify_links(request: BulkAddLinksRequest, req: Request, cur # but still handle potential errors during info retrieval or unsupported types # Extract type and ID from the link directly using regex match = re.match( - r"https://open\.spotify\.com(?:/intl-[a-z]{2})?/(track|album|playlist|artist)/([a-zA-Z0-9]+)(?:\?.*)?", + r"https://open\.spotify\.com(?:/[a-z]{2})?/(track|album|playlist|artist)/([a-zA-Z0-9]+)(?:\?.*)?", link, ) if not match: @@ -108,24 +107,6 @@ async def bulk_add_spotify_links(request: BulkAddLinksRequest, req: Request, cur # Add to download queue using the queue manager task_id = download_queue_manager.add_task(task_data) - 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}.") - # Prepare task data for the queue manager - task_data = { - "download_type": spotify_type, - "url": spotify_url, - "name": item_name, - "artist": artist_name, - "spotify_id": spotify_id, - "type": spotify_type, - "username": current_user.username, - "orig_request": dict(req.query_params), - } - - # Add to download queue using the queue manager - task_id = download_queue_manager.add_task(task_data) - 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}.") @@ -134,11 +115,6 @@ async def bulk_add_spotify_links(request: BulkAddLinksRequest, req: Request, cur failed_links.append(link) continue - added_count += 1 - logger.debug( - f"Added {added_count + 1}/{total_links} {spotify_type} '{item_name}' ({spotify_id}) to queue." - ) - except Exception as e: logger.error(f"Error processing Spotify link {link}: {e}", exc_info=True) failed_links.append(link)