summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/YoutubeCom.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hoster/YoutubeCom.py')
-rw-r--r--module/plugins/hoster/YoutubeCom.py36
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)