mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-12 14:26:49 +01:00
[mplayer] Simplify
This commit is contained in:
parent
b860f5dfd4
commit
b874495b1f
@ -16,14 +16,10 @@ def real_download(self, filename, info_dict):
|
|||||||
self.report_destination(filename)
|
self.report_destination(filename)
|
||||||
tmpfilename = self.temp_name(filename)
|
tmpfilename = self.temp_name(filename)
|
||||||
|
|
||||||
args = []
|
|
||||||
# Check for mplayer first
|
|
||||||
if check_executable('mplayer', ['-h']):
|
if check_executable('mplayer', ['-h']):
|
||||||
args = [
|
args = [
|
||||||
'mplayer', '-really-quiet', '-vo', 'null', '-vc', 'dummy',
|
'mplayer', '-really-quiet', '-vo', 'null', '-vc', 'dummy',
|
||||||
'-dumpstream', '-dumpfile', tmpfilename, url]
|
'-dumpstream', '-dumpfile', tmpfilename, url]
|
||||||
|
|
||||||
# Check for mpv
|
|
||||||
elif check_executable('mpv', ['-h']):
|
elif check_executable('mpv', ['-h']):
|
||||||
args = [
|
args = [
|
||||||
'mpv', '-really-quiet', '--vo=null', '--stream-dump=' + tmpfilename, url]
|
'mpv', '-really-quiet', '--vo=null', '--stream-dump=' + tmpfilename, url]
|
||||||
@ -31,7 +27,6 @@ def real_download(self, filename, info_dict):
|
|||||||
self.report_error('MMS or RTSP download detected but neither "mplayer" nor "mpv" could be run. Please install any.')
|
self.report_error('MMS or RTSP download detected but neither "mplayer" nor "mpv" could be run. Please install any.')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Download using mplayer.
|
|
||||||
retval = subprocess.call(args)
|
retval = subprocess.call(args)
|
||||||
if retval == 0:
|
if retval == 0:
|
||||||
fsize = os.path.getsize(encodeFilename(tmpfilename))
|
fsize = os.path.getsize(encodeFilename(tmpfilename))
|
||||||
@ -46,5 +41,5 @@ def real_download(self, filename, info_dict):
|
|||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
self.to_stderr('\n')
|
self.to_stderr('\n')
|
||||||
self.report_error('mplayer exited with code %d' % retval)
|
self.report_error('%s exited with code %d' % (args[0], retval))
|
||||||
return False
|
return False
|
||||||
|
Loading…
Reference in New Issue
Block a user