ytdl_hook.lua: always specify --write-srt

Currently by default mpv sets --all-subs when calling yt-dlp for JSON
info. --all-subs is an option that simply expands to --sub-langs all
--write-subs. --write-subs is special that without it yt-dlp will no
longer extract any subtitle info.

mpv's yt-dlp hook has a logic that if user specify any sub-langs in
--ytdl-raw-options, it no longer uses --all-subs. Unfortunately, this
means unaware users will not get any subtitle any more until they study
the mpv internal code and add their own --write-subs.

This PR always specifies --write-srt, an alias of --write-subs, in the
hook, so users don't have to. The alias is used to maintain
compatibility with youtube-dl.

Fixes issue #14818
This commit is contained in:
Crend King 2024-10-09 23:50:45 -07:00 committed by Kacper Michajłow
parent 3df68c5807
commit c8860fd816
1 changed files with 4 additions and 1 deletions

View File

@ -966,8 +966,11 @@ local function run_ytdl_hook(url)
end
if allsubs == true then
table.insert(command, "--all-subs")
table.insert(command, "--sub-langs")
table.insert(command, "all")
end
table.insert(command, "--write-srt")
if not use_playlist then
table.insert(command, "--no-playlist")
end