History

select.lua: allow ffmpeg to print errors if it fails

Also don't print subprocess result to OSD, as it is not comprehensible.

Kacper Michajłow committed 2 years ago

Commit c3bf2c71 parent 691a25d1 file · +6 −8Browse files

Showing the changes to player/lua/select.lua (1 of 1 file). Show all

Unified · Split

player/lua/select.lua+6−8
@@ -193,20 +193,18 @@ mp.add_forced_key_binding(nil, "select-subtitle-line", function () · 192 unmodified lines
193 name = "subprocess",193 name = "subprocess",
194 capture_stdout = true,194 capture_stdout = true,
195 args = sub.external195 args = sub.external
196 and {"ffmpeg", "-loglevel", "quiet", "-i", sub["external-filename"],196 and {"ffmpeg", "-loglevel", "error", "-i", sub["external-filename"],
197 "-f", "lrc", "-map_metadata", "-1", "-fflags", "+bitexact", "-"}197 "-f", "lrc", "-map_metadata", "-1", "-fflags", "+bitexact", "-"}
198 or {"ffmpeg", "-loglevel", "quiet", "-i", mp.get_property("path"),198 or {"ffmpeg", "-loglevel", "error", "-i", mp.get_property("path"),
199 "-map", "s:" .. sub["id"] - 1, "-f", "lrc", "-map_metadata",199 "-map", "s:" .. sub["id"] - 1, "-f", "lrc", "-map_metadata",
200 "-1", "-fflags", "+bitexact", "-"}200 "-1", "-fflags", "+bitexact", "-"}
201 })201 })
202 202
203 if r.status < 0 then203 if r.error_string == "init" then
204 show_error("subprocess error: " .. r.error_string)204 show_error("Failed to extract subtitles: ffmpeg not found.")
205 return205 return
206 end206 elseif r.status ~= 0 then
207 207 show_error("Failed to extract subtitles.")
208 if r.status > 0 then
209 show_error("ffmpeg failed with code " .. r.status)
210 return208 return
211 end209 end
212 210

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t