change delaut captions type to .srt

This commit is contained in:
vitaliibudnyi
2026-02-21 20:12:30 +02:00
committed by Alex Shnitman
parent ce9703cd04
commit dd4e05325a
6 changed files with 15 additions and 12 deletions

View File

@@ -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. * __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__: 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. * __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 ### 🌐 Web Server & URLs

View File

@@ -70,7 +70,7 @@ def get_opts(
format: str, format: str,
quality: str, quality: str,
ytdl_opts: dict, ytdl_opts: dict,
subtitle_format: str = "ass", subtitle_format: str = "srt",
subtitle_language: str = "en", subtitle_language: str = "en",
subtitle_mode: str = "prefer_manual", subtitle_mode: str = "prefer_manual",
) -> dict: ) -> dict:
@@ -124,7 +124,7 @@ def get_opts(
mode = _normalize_caption_mode(subtitle_mode) mode = _normalize_caption_mode(subtitle_mode)
language = _normalize_subtitle_language(subtitle_language) language = _normalize_subtitle_language(subtitle_language)
opts["skip_download"] = True opts["skip_download"] = True
opts["subtitlesformat"] = subtitle_format or "ass" opts["subtitlesformat"] = subtitle_format or "srt"
if mode == "manual_only": if mode == "manual_only":
opts["writesubtitles"] = True opts["writesubtitles"] = True
opts["writeautomaticsub"] = False opts["writeautomaticsub"] = False

View File

@@ -264,7 +264,7 @@ async def add(request):
if chapter_template is None: if chapter_template is None:
chapter_template = config.OUTPUT_TEMPLATE_CHAPTER chapter_template = config.OUTPUT_TEMPLATE_CHAPTER
if subtitle_format is None: if subtitle_format is None:
subtitle_format = 'ass' subtitle_format = 'srt'
if subtitle_language is None: if subtitle_language is None:
subtitle_language = 'en' subtitle_language = 'en'
if subtitle_mode is None: if subtitle_mode is None:

View File

@@ -100,7 +100,7 @@ class DownloadInfo:
playlist_item_limit, playlist_item_limit,
split_by_chapters, split_by_chapters,
chapter_template, chapter_template,
subtitle_format="ass", subtitle_format="srt",
subtitle_language="en", subtitle_language="en",
subtitle_mode="prefer_manual", subtitle_mode="prefer_manual",
): ):
@@ -139,7 +139,7 @@ class Download:
format, format,
quality, quality,
ytdl_opts, ytdl_opts,
subtitle_format=getattr(info, 'subtitle_format', 'ass'), subtitle_format=getattr(info, 'subtitle_format', 'srt'),
subtitle_language=getattr(info, 'subtitle_language', 'en'), subtitle_language=getattr(info, 'subtitle_language', 'en'),
subtitle_mode=getattr(info, 'subtitle_mode', 'prefer_manual'), subtitle_mode=getattr(info, 'subtitle_mode', 'prefer_manual'),
) )
@@ -701,7 +701,7 @@ class DownloadQueue:
auto_start=True, auto_start=True,
split_by_chapters=False, split_by_chapters=False,
chapter_template=None, chapter_template=None,
subtitle_format="ass", subtitle_format="srt",
subtitle_language="en", subtitle_language="en",
subtitle_mode="prefer_manual", subtitle_mode="prefer_manual",
already=None, already=None,

View File

@@ -101,10 +101,9 @@ export class App implements AfterViewInit, OnInit {
faClock = faClock; faClock = faClock;
faTachometerAlt = faTachometerAlt; faTachometerAlt = faTachometerAlt;
subtitleFormats = [ subtitleFormats = [
{ id: 'ass', text: 'ASS' },
{ id: 'vtt', text: 'VTT' },
{ id: 'srt', text: 'SRT' }, { id: 'srt', text: 'SRT' },
{ id: 'ttml', text: 'TTML' }, { id: 'vtt', text: 'VTT' },
{ id: 'ttml', text: 'TTML' }
]; ];
subtitleLanguages = [ subtitleLanguages = [
{ id: 'en', text: 'English' }, { id: 'en', text: 'English' },
@@ -135,9 +134,13 @@ export class App implements AfterViewInit, OnInit {
this.splitByChapters = this.cookieService.get('metube_split_chapters') === 'true'; this.splitByChapters = this.cookieService.get('metube_split_chapters') === 'true';
// Will be set from backend configuration, use empty string as placeholder // Will be set from backend configuration, use empty string as placeholder
this.chapterTemplate = this.cookieService.get('metube_chapter_template') || ''; 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.subtitleLanguage = this.cookieService.get('metube_subtitle_language') || 'en';
this.subtitleMode = this.cookieService.get('metube_subtitle_mode') || 'prefer_manual'; 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); this.activeTheme = this.getPreferredTheme(this.cookieService);

View File

@@ -180,7 +180,7 @@ export class DownloadsService {
const defaultAutoStart = true; const defaultAutoStart = true;
const defaultSplitByChapters = false; const defaultSplitByChapters = false;
const defaultChapterTemplate = this.configuration['OUTPUT_TEMPLATE_CHAPTER']; const defaultChapterTemplate = this.configuration['OUTPUT_TEMPLATE_CHAPTER'];
const defaultSubtitleFormat = 'ass'; const defaultSubtitleFormat = 'srt';
const defaultSubtitleLanguage = 'en'; const defaultSubtitleLanguage = 'en';
const defaultSubtitleMode = 'prefer_manual'; const defaultSubtitleMode = 'prefer_manual';