You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Return the default language preference ordering for a catalogue site.
32
-
Falls back to AniWorld defaults when a site-specific mapping is not found.
31
+
Get the default language preference ordering for a catalogue site.
32
+
33
+
Parameters:
34
+
site (str): Catalogue site key to look up in CATALOG_SITE_CONFIGS.
35
+
36
+
Returns:
37
+
List[str]: Language names in preference order. If the site has no valid mapping, returns the configured aniworld.to defaults (fallbacking to ["German Dub", "German Sub", "English Sub"] if that configuration is absent).
Resolve a direct download URL for an episode, trying a preferred provider first and falling back to the configured provider order.
184
+
185
+
Parameters:
186
+
ep (Episode): Episode object to resolve the direct link for.
187
+
preferred (Optional[str]): Provider name to try first; ignored if empty or None.
188
+
language (str): Desired language label; will be normalized before use.
189
+
190
+
Returns:
191
+
tuple: (direct_url, provider_name) where `direct_url` is the resolved URL and `provider_name` is the provider that supplied it.
192
+
193
+
Raises:
194
+
LanguageUnavailableError: If the requested language is not offered by the episode or a provider indicates the language is unavailable.
195
+
DownloadError: If no provider yields a direct URL after all fallbacks.
196
+
"""
182
197
language=_normalize_language(language)
183
198
logger.info(
184
199
f"Getting direct URL with fallback. Preferred: {preferred}, Language: {language}"
@@ -251,6 +266,23 @@ def _ydl_download(
251
266
stop_event: Optional[threading.Event] =None,
252
267
force_no_proxy: bool=False,
253
268
) ->Tuple[Path, Dict[str, Any]]:
269
+
"""
270
+
Download a media resource via yt-dlp and return the downloaded file path and metadata.
271
+
272
+
Uses yt-dlp to download the resource at `direct_url` into `dest_dir`, applying an optional filename hint, cookiefile, proxy configuration, progress callbacks, and cancellation via `stop_event`.
273
+
274
+
Parameters:
275
+
direct_url (str): Direct media URL or playlist identifier to pass to yt-dlp.
276
+
dest_dir (Path): Directory where the download and temporary files will be stored; created if missing.
277
+
title_hint (Optional[str]): Hint for the output filename; sanitized and used in the output template if provided.
278
+
cookiefile (Optional[Path]): Path to a cookies file to supply to yt-dlp for authenticated requests.
279
+
progress_cb (Optional[callable]): Callback invoked with yt-dlp progress dictionaries as they arrive.
280
+
stop_event (Optional[threading.Event]): If set during download, the operation will be cancelled and raise DownloadError("Cancelled").
281
+
force_no_proxy (bool): When true, disable any configured proxy for this yt-dlp invocation.
282
+
283
+
Returns:
284
+
Tuple[Path, Dict[str, Any]]: A tuple containing the final downloaded file path and the yt-dlp info dictionary.
Ensure the application's SQLite database file and ORM tables exist, running any required schema migration first.
214
+
215
+
Performs any necessary episode availability migration and creates tables defined on the module's private metadata, creating the database file if it does not already exist.
216
+
"""
212
217
logger.debug("Creating DB and tables if not exist.")
Lädt KEINE Daten. Holt nur Info über Formate/Höhe/Codec.
21
+
Retrieve reported video height, video codec, and metadata from a direct media URL without downloading the media.
22
+
23
+
Parameters:
24
+
timeout (float): Socket timeout in seconds used when probing the URL.
25
+
26
+
Returns:
27
+
tuple: A three-item tuple (height, vcodec, info_dict) where `height` is the reported video height in pixels or `None` if unavailable, `vcodec` is the reported video codec string or `None` if unavailable, and `info_dict` is the extracted metadata dictionary from yt-dlp or `None` if extraction failed.
22
28
"""
23
29
logger.debug(
24
30
f"Probing episode quality for URL: {direct_url} with timeout={timeout}"
@@ -115,4 +121,4 @@ def probe_episode_quality(
115
121
logger.warning(f"Provider '{prov}' failed: {e}")
116
122
continue
117
123
logger.error("No provider succeeded for this episode/language.")
0 commit comments