Skip to content

Commit

Permalink
tumblr_backup: make --save-video-tumblr do what the help says
Browse files Browse the repository at this point in the history
See #142
  • Loading branch information
bbolli committed Dec 11, 2018
1 parent a4b888b commit 2be4cc1
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions tumblr_backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -717,15 +717,15 @@ def append_try(elt, fmt=u'%s'):

elif self.typ == 'video':
src = ''
if options.save_video:
if post['video_type'] == 'tumblr':
src = self.get_media_url(post['video_url'], '.mp4')
elif youtube_dl:
src = self.get_youtube_url(self.url)
if not src:
sys.stdout.write(u'Unable to download video in post #%s%-50s\n' %
(self.ident, ' ')
)
if (options.save_video or options.save_video_tumblr) \
and post['video_type'] == 'tumblr':
src = self.get_media_url(post['video_url'], '.mp4')
elif options.save_video:
src = self.get_youtube_url(self.url)
if not src:
sys.stdout.write(u'Unable to download video in post #%s%-50s\n' %
(self.ident, ' ')
)
if src:
append(u'<p><video controls><source src="%s" type=video/mp4>%s<br>\n<a href="%s">%s</a></video></p>' % (
src, "Your browser does not support the video element.", src, "Video file"
Expand Down Expand Up @@ -1176,7 +1176,6 @@ def request_callback(option, opt, value, parser):
parser.error("--exif: module 'pyexif2' is not installed")
if options.save_video and not youtube_dl:
parser.error("--save-video: module 'youtube_dl' is not installed")
options.save_video = options.save_video or options.save_video_tumblr

tb = TumblrBackup()
try:
Expand Down

0 comments on commit 2be4cc1

Please sign in to comment.