mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-26 05:05:54 +01:00
[sponskrub] Print ffmpeg output and errors to terminal
The ffmpeg run can be long when using `--sponskrub-cut`. So progress needs to be printed :ci skip dl
This commit is contained in:
parent
fc2119f210
commit
584bab3766
@ -12,6 +12,7 @@
|
|||||||
str_or_none,
|
str_or_none,
|
||||||
PostProcessingError,
|
PostProcessingError,
|
||||||
prepend_extension,
|
prepend_extension,
|
||||||
|
process_communicate_or_kill,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -75,8 +76,9 @@ def run(self, information):
|
|||||||
cmd = [encodeArgument(i) for i in cmd]
|
cmd = [encodeArgument(i) for i in cmd]
|
||||||
|
|
||||||
self.write_debug('sponskrub command line: %s' % shell_quote(cmd))
|
self.write_debug('sponskrub command line: %s' % shell_quote(cmd))
|
||||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
|
pipe = None if self.get_param('verbose') else subprocess.PIPE
|
||||||
stdout, stderr = p.communicate()
|
p = subprocess.Popen(cmd, stdout=pipe)
|
||||||
|
stdout = process_communicate_or_kill(p)[0]
|
||||||
|
|
||||||
if p.returncode == 0:
|
if p.returncode == 0:
|
||||||
os.remove(encodeFilename(filename))
|
os.remove(encodeFilename(filename))
|
||||||
@ -85,9 +87,7 @@ def run(self, information):
|
|||||||
elif p.returncode == 3:
|
elif p.returncode == 3:
|
||||||
self.to_screen('No segments in the SponsorBlock database')
|
self.to_screen('No segments in the SponsorBlock database')
|
||||||
else:
|
else:
|
||||||
msg = stderr.decode('utf-8', 'replace').strip() or stdout.decode('utf-8', 'replace').strip()
|
msg = stdout.decode('utf-8', 'replace').strip() if stdout else ''
|
||||||
self.write_debug(msg, prefix=False)
|
msg = msg.split('\n')[0 if msg.lower().startswith('unrecognised') else -1]
|
||||||
line = 0 if msg[:12].lower() == 'unrecognised' else -1
|
|
||||||
msg = msg.split('\n')[line]
|
|
||||||
raise PostProcessingError(msg if msg else 'sponskrub failed with error code %s' % p.returncode)
|
raise PostProcessingError(msg if msg else 'sponskrub failed with error code %s' % p.returncode)
|
||||||
return [], information
|
return [], information
|
||||||
|
Loading…
Reference in New Issue
Block a user