From d2a1985e877e2ca170cb6997f2942ae786517628 Mon Sep 17 00:00:00 2001 From: Florent Date: Thu, 5 Dec 2013 13:18:35 +0100 Subject: [PATCH] Allow to download in a folder with generated filename --- weboob/applications/videoob/videoob.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/weboob/applications/videoob/videoob.py b/weboob/applications/videoob/videoob.py index c236ec86..f7d80598 100644 --- a/weboob/applications/videoob/videoob.py +++ b/weboob/applications/videoob/videoob.py @@ -106,11 +106,17 @@ class Videoob(ReplApplication): return False return True - if dest is None: - ext = video.ext + def video_to_file(_video): + ext = _video.ext if not ext: ext = 'avi' - dest = '%s.%s' % (re.sub('[?:/]', '-', video.id), ext) + return '%s.%s' % (re.sub('[?:/]', '-', _video.id), ext) + + if dest is not None and os.path.isdir(dest): + dest += '/%s' % video_to_file(video) + + if dest is None: + dest = video_to_file(video) if video.url.startswith('rtmp'): if not check_exec('rtmpdump'):