diff --git a/README.md b/README.md index aafaea7..8c79ba6 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ Certain values can be set via environment variables, using the `-e` parameter on * __OUTPUT_TEMPLATE_CHANNEL__: The template for the filenames of the downloaded videos when downloaded as a channel. Defaults to `%(channel)s/%(title)s.%(ext)s`. When empty, then `OUTPUT_TEMPLATE` is used. * __YTDL_OPTIONS__: Additional options to pass to yt-dlp in JSON format. [See available options here](https://github.com/yt-dlp/yt-dlp/blob/master/yt_dlp/YoutubeDL.py#L222). They roughly correspond to command-line options, though some do not have exact equivalents here. For example, `--recode-video` has to be specified via `postprocessors`. Also note that dashes are replaced with underscores. You may find [this script](https://github.com/yt-dlp/yt-dlp/blob/master/devscripts/cli_to_api.py) helpful for converting from command-line options to `YTDL_OPTIONS`. * __YTDL_OPTIONS_FILE__: A path to a JSON file that will be loaded and used for populating `YTDL_OPTIONS` above. Please note that if both `YTDL_OPTIONS_FILE` and `YTDL_OPTIONS` are specified, the options in `YTDL_OPTIONS` take precedence. The file will be monitored for changes and reloaded automatically when changes are detected. -* UI format __Captions__: Downloads subtitles/captions only (no media). Subtitle format, language, and source preference are configurable from Advanced Options (defaults: `ass`, `en`, `prefer_manual`). +* UI format __Captions__: Downloads subtitles/captions only (no media). Subtitle format, language, and source preference are configurable from Advanced Options (defaults: `srt`, `en`, `prefer_manual`). ### 🌐 Web Server & URLs diff --git a/app/dl_formats.py b/app/dl_formats.py index 43384f0..867ceee 100644 --- a/app/dl_formats.py +++ b/app/dl_formats.py @@ -70,7 +70,7 @@ def get_opts( format: str, quality: str, ytdl_opts: dict, - subtitle_format: str = "ass", + subtitle_format: str = "srt", subtitle_language: str = "en", subtitle_mode: str = "prefer_manual", ) -> dict: @@ -124,7 +124,7 @@ def get_opts( mode = _normalize_caption_mode(subtitle_mode) language = _normalize_subtitle_language(subtitle_language) opts["skip_download"] = True - opts["subtitlesformat"] = subtitle_format or "ass" + opts["subtitlesformat"] = subtitle_format or "srt" if mode == "manual_only": opts["writesubtitles"] = True opts["writeautomaticsub"] = False diff --git a/app/main.py b/app/main.py index 16865c6..c28c32c 100644 --- a/app/main.py +++ b/app/main.py @@ -264,7 +264,7 @@ async def add(request): if chapter_template is None: chapter_template = config.OUTPUT_TEMPLATE_CHAPTER if subtitle_format is None: - subtitle_format = 'ass' + subtitle_format = 'srt' if subtitle_language is None: subtitle_language = 'en' if subtitle_mode is None: diff --git a/app/ytdl.py b/app/ytdl.py index 72ee0bc..f7924de 100644 --- a/app/ytdl.py +++ b/app/ytdl.py @@ -100,7 +100,7 @@ class DownloadInfo: playlist_item_limit, split_by_chapters, chapter_template, - subtitle_format="ass", + subtitle_format="srt", subtitle_language="en", subtitle_mode="prefer_manual", ): @@ -139,7 +139,7 @@ class Download: format, quality, ytdl_opts, - subtitle_format=getattr(info, 'subtitle_format', 'ass'), + subtitle_format=getattr(info, 'subtitle_format', 'srt'), subtitle_language=getattr(info, 'subtitle_language', 'en'), subtitle_mode=getattr(info, 'subtitle_mode', 'prefer_manual'), ) @@ -701,7 +701,7 @@ class DownloadQueue: auto_start=True, split_by_chapters=False, chapter_template=None, - subtitle_format="ass", + subtitle_format="srt", subtitle_language="en", subtitle_mode="prefer_manual", already=None, diff --git a/ui/src/app/app.ts b/ui/src/app/app.ts index 7fc4a23..d7651d9 100644 --- a/ui/src/app/app.ts +++ b/ui/src/app/app.ts @@ -101,10 +101,9 @@ export class App implements AfterViewInit, OnInit { faClock = faClock; faTachometerAlt = faTachometerAlt; subtitleFormats = [ - { id: 'ass', text: 'ASS' }, - { id: 'vtt', text: 'VTT' }, { id: 'srt', text: 'SRT' }, - { id: 'ttml', text: 'TTML' }, + { id: 'vtt', text: 'VTT' }, + { id: 'ttml', text: 'TTML' } ]; subtitleLanguages = [ { id: 'en', text: 'English' }, @@ -135,9 +134,13 @@ export class App implements AfterViewInit, OnInit { this.splitByChapters = this.cookieService.get('metube_split_chapters') === 'true'; // Will be set from backend configuration, use empty string as placeholder this.chapterTemplate = this.cookieService.get('metube_chapter_template') || ''; - this.subtitleFormat = this.cookieService.get('metube_subtitle_format') || 'ass'; + this.subtitleFormat = this.cookieService.get('metube_subtitle_format') || 'srt'; this.subtitleLanguage = this.cookieService.get('metube_subtitle_language') || 'en'; this.subtitleMode = this.cookieService.get('metube_subtitle_mode') || 'prefer_manual'; + const allowedSubtitleFormats = new Set(this.subtitleFormats.map(fmt => fmt.id)); + if (!allowedSubtitleFormats.has(this.subtitleFormat)) { + this.subtitleFormat = 'srt'; + } this.activeTheme = this.getPreferredTheme(this.cookieService); diff --git a/ui/src/app/services/downloads.service.ts b/ui/src/app/services/downloads.service.ts index ac21bc5..52690c8 100644 --- a/ui/src/app/services/downloads.service.ts +++ b/ui/src/app/services/downloads.service.ts @@ -180,7 +180,7 @@ export class DownloadsService { const defaultAutoStart = true; const defaultSplitByChapters = false; const defaultChapterTemplate = this.configuration['OUTPUT_TEMPLATE_CHAPTER']; - const defaultSubtitleFormat = 'ass'; + const defaultSubtitleFormat = 'srt'; const defaultSubtitleLanguage = 'en'; const defaultSubtitleMode = 'prefer_manual';