diff --git a/bazarr/config.py b/bazarr/config.py index 08d4dc05e..6c45fb42d 100644 --- a/bazarr/config.py +++ b/bazarr/config.py @@ -210,7 +210,8 @@ defaults = { 'include_ass': 'True', 'include_srt': 'True', 'hi_fallback': 'False', - 'mergerfs_mode': 'False' + 'mergerfs_mode': 'False', + 'timeout': '600', }, 'subsync': { 'use_subsync': 'False', diff --git a/bazarr/get_providers.py b/bazarr/get_providers.py index 9314aa96f..e1d50798b 100644 --- a/bazarr/get_providers.py +++ b/bazarr/get_providers.py @@ -225,6 +225,7 @@ def get_providers_auth(): 'cache_dir': os.path.join(args.config_dir, "cache"), 'ffprobe_path': _FFPROBE_BINARY, 'ffmpeg_path': _FFMPEG_BINARY, + 'timeout': settings.embeddedsubtitles.timeout, } } diff --git a/frontend/src/pages/Settings/Providers/list.ts b/frontend/src/pages/Settings/Providers/list.ts index 83fc64630..158328cce 100644 --- a/frontend/src/pages/Settings/Providers/list.ts +++ b/frontend/src/pages/Settings/Providers/list.ts @@ -67,6 +67,7 @@ export const ProviderList: Readonly = [ include_ass: true, hi_fallback: false, mergerfs_mode: false, + timeout: 600, }, message: "Warning for cloud users: this provider needs to read the entire file in order to extract subtitles.", @@ -77,6 +78,7 @@ export const ProviderList: Readonly = [ "Use HI subtitles as a fallback (don't enable it if you have a HI language profile)", mergerfs_mode: "[EXPERIMENTAL] Ignore cloud video files from rclone/mergerfs", + timeout: "Extraction timeout in seconds", }, }, { diff --git a/libs/subliminal_patch/providers/embeddedsubtitles.py b/libs/subliminal_patch/providers/embeddedsubtitles.py index c3306db68..aca0bb31b 100644 --- a/libs/subliminal_patch/providers/embeddedsubtitles.py +++ b/libs/subliminal_patch/providers/embeddedsubtitles.py @@ -79,6 +79,7 @@ class EmbeddedSubtitlesProvider(Provider): ffmpeg_path=None, hi_fallback=False, mergerfs_mode=False, + timeout=600, ): self._include_ass = include_ass self._include_srt = include_srt @@ -88,6 +89,7 @@ class EmbeddedSubtitlesProvider(Provider): self._hi_fallback = hi_fallback self._cached_paths = {} self._mergerfs_mode = mergerfs_mode + self._timeout = float(timeout) fese.FFPROBE_PATH = ffprobe_path or fese.FFPROBE_PATH fese.FFMPEG_PATH = ffmpeg_path or fese.FFMPEG_PATH @@ -185,7 +187,9 @@ class EmbeddedSubtitlesProvider(Provider): # Extract all subittle streams to avoid reading the entire # container over and over streams = filter(_check_allowed_extensions, container.get_subtitles()) - extracted = container.extract_subtitles(list(streams), self._cache_dir) + extracted = container.extract_subtitles( + list(streams), self._cache_dir, timeout=self._timeout + ) # Add the extracted paths to the containter path key self._cached_paths[container.path] = extracted