mirror of
https://github.com/soimort/you-get.git
synced 2025-02-03 00:33:58 +03:00
add rtmpdump wrapper
This commit is contained in:
parent
0d19e034dd
commit
b3d10e32a9
@ -3,3 +3,4 @@
|
||||
from .join_flv import concat_flv
|
||||
from .join_mp4 import concat_mp4
|
||||
from .ffmpeg import *
|
||||
from .rtmpdump import *
|
||||
|
31
src/you_get/processor/rtmpdump.py
Normal file
31
src/you_get/processor/rtmpdump.py
Normal file
@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import os.path
|
||||
import subprocess
|
||||
|
||||
def get_usable_rtmpdump(cmd):
|
||||
try:
|
||||
p = subprocess.Popen([cmd], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
out, err = p.communicate()
|
||||
return cmd
|
||||
except:
|
||||
return None
|
||||
|
||||
RTMPDUMP = get_usable_rtmpdump('rtmpdump')
|
||||
|
||||
def has_rtmpdump_installed():
|
||||
return RTMPDUMP is not None
|
||||
|
||||
def download_rtmpdump_stream(url, playpath, title, ext, output_dir='.'):
|
||||
filename = '%s.%s' % (title, ext)
|
||||
filepath = os.path.join(output_dir, filename)
|
||||
|
||||
params = [RTMPDUMP, '-r']
|
||||
params.append(url)
|
||||
params.append('-y')
|
||||
params.append(playpath)
|
||||
params.append('-o')
|
||||
params.append(filepath)
|
||||
|
||||
subprocess.call(params)
|
||||
return
|
Loading…
Reference in New Issue
Block a user