From d8b80139d41b477a09c280df4d34b39757b302a9 Mon Sep 17 00:00:00 2001 From: Nicolas Duhamel Date: Sun, 10 Apr 2011 22:31:02 +0200 Subject: [PATCH] Fix download rtmp video source (closes #631) --- weboob/applications/videoob/videoob.py | 30 +++++++++++++++++++------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/weboob/applications/videoob/videoob.py b/weboob/applications/videoob/videoob.py index fcd6fe87..2ca94da9 100644 --- a/weboob/applications/videoob/videoob.py +++ b/weboob/applications/videoob/videoob.py @@ -115,20 +115,34 @@ class Videoob(ReplApplication): if not video: print 'Video not found: %s' % _id return 1 - - with open('/dev/null', 'w') as devnull: - process = subprocess.Popen(['which', 'wget'], stdout=devnull) - if process.wait() != 0: - print >>sys.stderr, 'Please install "wget"' - return 1 + + def check_exec(executable): + with open('/dev/null', 'w') as devnull: + process = subprocess.Popen(['which', executable], stdout=devnull) + if process.wait() != 0: + print >>sys.stderr, 'Please install "%s"' % executable + return False + return True + if dest is None: ext = video.ext if not ext: ext = 'avi' dest = '%s.%s' % (video.id, ext) - - os.system('wget "%s" -O "%s"' % (video.url, dest)) + + if video.url.find('rtmp') == 0: + if check_exec('rtmpdump'): + cmd = "rtmpdump -r " + video.url + " -o " + dest + else: + return 1 + else: + if check_exec('wget'): + cmd = 'wget "%s" -O "%s"' % (video.url, dest) + else: + return 1 + + os.system(cmd) def complete_play(self, text, line, *ignored): args = line.split(' ')