|
|
@ -3,6 +3,7 @@ import subprocess
|
|
|
|
|
|
|
|
|
|
|
|
from .common import FileDownloader
|
|
|
|
from .common import FileDownloader
|
|
|
|
from ..utils import (
|
|
|
|
from ..utils import (
|
|
|
|
|
|
|
|
check_executable,
|
|
|
|
encodeFilename,
|
|
|
|
encodeFilename,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
@ -19,13 +20,11 @@ class HlsFD(FileDownloader):
|
|
|
|
encodeFilename(tmpfilename, for_subprocess=True)]
|
|
|
|
encodeFilename(tmpfilename, for_subprocess=True)]
|
|
|
|
|
|
|
|
|
|
|
|
for program in ['avconv', 'ffmpeg']:
|
|
|
|
for program in ['avconv', 'ffmpeg']:
|
|
|
|
try:
|
|
|
|
if check_executable(program, ['-version']):
|
|
|
|
subprocess.call([program, '-version'], stdout=(open(os.path.devnull, 'w')), stderr=subprocess.STDOUT)
|
|
|
|
|
|
|
|
break
|
|
|
|
break
|
|
|
|
except (OSError, IOError):
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
self.report_error(u'm3u8 download detected but ffmpeg or avconv could not be found. Please install one.')
|
|
|
|
self.report_error(u'm3u8 download detected but ffmpeg or avconv could not be found. Please install one.')
|
|
|
|
|
|
|
|
return False
|
|
|
|
cmd = [program] + args
|
|
|
|
cmd = [program] + args
|
|
|
|
|
|
|
|
|
|
|
|
retval = subprocess.call(cmd)
|
|
|
|
retval = subprocess.call(cmd)
|
|
|
@ -42,5 +41,5 @@ class HlsFD(FileDownloader):
|
|
|
|
return True
|
|
|
|
return True
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
self.to_stderr(u"\n")
|
|
|
|
self.to_stderr(u"\n")
|
|
|
|
self.report_error(u'ffmpeg exited with code %d' % retval)
|
|
|
|
self.report_error(u'%s exited with code %d' % (program, retval))
|
|
|
|
return False
|
|
|
|
return False
|
|
|
|