520be53901
- Add proper Alembic initial migration (0001_initial_schema.py) - Migrate refresh tokens from JSON file to SQLite (RefreshTokenTable) - Remove Neko-Sama provider entirely (redirects to Gupy, not a host) - Fix provider health check always showing UNKNOWN - Run check_all_health() on startup - Fix POST /providers/health/check background task bug - Add HTMX refresh after manual health check trigger - Fix anime search relevance scoring with MIN_RELEVANCE_THRESHOLD=0.5 - Replace bare 'except:' with 'except Exception:' across codebase - Add Playwright E2E test suite (12 tests, auth setup, helpers) - Fix toast container blocking clicks via pointer-events: none - Remove obsolete Jest/Vite test files and config - Clean up obsolete test_watchlist scripts - Update sonarr model comment for active providers
70 lines
1.8 KiB
Python
70 lines
1.8 KiB
Python
from .base import BaseDownloader
|
|
|
|
# Import from new organized structure
|
|
from .video_players import (
|
|
BaseVideoPlayer,
|
|
get_video_player,
|
|
DoodStreamDownloader,
|
|
SibnetDownloader,
|
|
VidMolyDownloader,
|
|
SendVidDownloader,
|
|
LpayerDownloader,
|
|
UnFichierDownloader,
|
|
UptoboxDownloader,
|
|
RapidFileDownloader
|
|
)
|
|
from .anime_sites import (
|
|
BaseAnimeSite,
|
|
get_anime_site,
|
|
AnimeSamaDownloader,
|
|
AnimeUltimeDownloader,
|
|
VostfreeDownloader
|
|
)
|
|
from .series_sites import (
|
|
BaseSeriesSite,
|
|
get_series_site,
|
|
FS7Downloader,
|
|
ZoneTelechargementDownloader
|
|
)
|
|
|
|
|
|
def get_downloader(url: str) -> BaseDownloader:
|
|
"""
|
|
Factory function to get the appropriate downloader for a URL.
|
|
|
|
This function now uses the organized structure:
|
|
- Checks anime sites first (for catalogs/search)
|
|
- Then checks series sites (for catalogs/search)
|
|
- Then checks video players (for direct download links)
|
|
- Falls back to generic downloader if no match
|
|
"""
|
|
# Try anime sites first
|
|
anime_site = get_anime_site(url)
|
|
if anime_site:
|
|
return anime_site
|
|
|
|
# Then try series sites
|
|
series_site = get_series_site(url)
|
|
if series_site:
|
|
return series_site
|
|
|
|
# Then try video players
|
|
video_player = get_video_player(url)
|
|
if video_player:
|
|
return video_player
|
|
|
|
# Return generic downloader if no match
|
|
return GenericDownloader()
|
|
|
|
|
|
class GenericDownloader(BaseDownloader):
|
|
"""Generic downloader for unhandled hosts"""
|
|
|
|
def can_handle(self, url: str) -> bool:
|
|
return True
|
|
|
|
async def get_download_link(self, url: str, target_filename: str = None) -> tuple[str, str]:
|
|
# Just return the URL as-is
|
|
filename = target_filename or url.split('/')[-1] or "download"
|
|
return url, filename
|