Merge pull request #1294 from cnbeining/fix-os-system-windows

[Processor] Fix rtmpdump not portable under Windows
This commit is contained in:
David Zhuang 2016-07-21 00:52:41 -04:00 committed by GitHub
commit 92911cef0b

View File

@ -41,16 +41,32 @@ def download_rtmpdump_stream(url, title, ext,params={},output_dir='.'):
subprocess.call(cmdline)
return
#
#To be refactor
#To the future myself: Remember to refactor the same function in ffmpeg.py
#
def play_rtmpdump_stream(player, url, params={}):
cmdline="rtmpdump -r '%s' "%url
#construct left side of pipe
cmdline = [RTMPDUMP, '-r']
cmdline.append(url)
#append other params if exist
for key in params.keys():
cmdline+=key+" "+params[key] if params[key]!=None else ""+" "
cmdline+=" -o - | %s -"%player
print(cmdline)
os.system(cmdline)
cmdline.append(key)
if params[key]!=None:
cmdline.append(params[key])
cmdline.append('-o')
cmdline.append('-')
#pipe start
cmdline.append('|')
cmdline.append(player)
cmdline.append('-')
#logging
print("Call rtmpdump:\n"+" ".join(cmdline)+"\n")
#call RTMPDump!
subprocess.call(cmdline)
# os.system("rtmpdump -r '%s' -y '%s' -o - | %s -" % (url, playpath, player))
return