diff options
author | enkore <public@enkore.de> | 2013-03-26 13:45:29 +0100 |
---|---|---|
committer | enkore <public@enkore.de> | 2013-03-26 13:45:29 +0100 |
commit | fafd901d97eaa80f3d67c92cd95074fa61ed3262 (patch) | |
tree | 446b84a3bd53d38dc975a1c92820f1dbe47675c2 /module/plugins | |
parent | Move which function to YoutubeCom plugin (diff) | |
download | pyload-fafd901d97eaa80f3d67c92cd95074fa61ed3262.tar.xz |
YoutubeCom: Show start time in package name
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/hoster/YoutubeCom.py | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py index 4bc608b05..f01094c7d 100644 --- a/module/plugins/hoster/YoutubeCom.py +++ b/module/plugins/hoster/YoutubeCom.py @@ -138,24 +138,26 @@ class YoutubeCom(Hoster): name = re.search(file_name_pattern, html).group(1).replace("/", "") + file_suffix pyfile.name = html_unescape(name) + time = re.search(r"t=((\d+)m)?(\d+)s", pyfile.url) + if time: + m, s = time.groups()[1:] + if not m: + m = "0" + + pyfile.name += " (starting at %s:%s)" % (m, s) + filename = self.download(url) ffmpeg = which("ffmpeg") if ffmpeg: - time = re.search(r"t=((\d+)m)?(\d+)s", pyfile.url) - if time: - m, s = time.groups()[1:] - if not m: - m = "0" - - inputfile = filename + "_" - os.rename(filename, inputfile) - - subprocess.call([ - which("ffmpeg"), - "-ss", "00:%s:%s" % (m, s), - "-i", inputfile, - "-vcodec", "copy", - "-acodec", "copy", - filename]) - os.remove(inputfile) + inputfile = filename + "_" + os.rename(filename, inputfile) + + subprocess.call([ + ffmpeg, + "-ss", "00:%s:%s" % (m, s), + "-i", inputfile, + "-vcodec", "copy", + "-acodec", "copy", + filename]) + os.remove(inputfile) |