downloadboob: fix new file detection

Since the filename generation is based on the video.ext
field, we have to fill it before to check if the file
is downloaded.

Also do a little code factorisation
This commit is contained in:
Florent 2015-09-20 16:47:18 +02:00
commit 8e1a6dd74c

View file

@ -102,14 +102,13 @@ class Downloadboob(object):
if i == max_results: if i == max_results:
break break
self.backend.fill_video(video, ('url', 'title', 'url', 'duration', 'ext'))
if not self.is_downloaded(video): if not self.is_downloaded(video):
self.backend.fill_video(video, ('url','title', 'url', 'duration'))
if not(self.is_excluded(video.title, title_exclude)) and self.id_regexp_matched(video.id, id_regexp): if not(self.is_excluded(video.title, title_exclude)) and self.id_regexp_matched(video.id, id_regexp):
print(" %s\n Id:%s\n Duration:%s" % (video.title, video.id, video.duration)) print(" %s\n Id:%s\n Duration:%s" % (video.title, video.id, video.duration))
videos.append(video) videos.append(video)
else: else:
print("Already downloaded, check %s" % video.id) print("Already downloaded, check %s" % video.id)
self.backend.fill_video(video, ('url','title', 'url', 'duration'))
linkname = self.get_linkname(video) linkname = self.get_linkname(video)
if not os.path.exists(linkname): if not os.path.exists(linkname):
self.remove_download(video) self.remove_download(video)