simplify search command code
This commit is contained in:
parent
9d7d8692ba
commit
9fe8053052
2 changed files with 5 additions and 9 deletions
|
|
@ -39,6 +39,9 @@ class Video(object):
|
|||
self.preview_url = preview_url
|
||||
self.nsfw = nsfw
|
||||
|
||||
@property
|
||||
def formatted_duration(self):
|
||||
return '%d:%02d:%02d' % (self.duration / 3600, (self.duration % 3600 / 60), self.duration % 60)
|
||||
class ICapVideoProvider(ICap):
|
||||
def iter_page_urls(self, mozaic_url):
|
||||
raise NotImplementedError()
|
||||
|
|
|
|||
|
|
@ -67,15 +67,8 @@ class Videoob(ConsoleApplication):
|
|||
results['BEFORE'] = u'Last videos'
|
||||
results['HEADER'] = ('ID', 'Title', 'Duration')
|
||||
for backend in self.weboob.iter_backends():
|
||||
try:
|
||||
iterator = backend.iter_search_results(pattern)
|
||||
except NotImplementedError:
|
||||
continue
|
||||
else:
|
||||
rows = []
|
||||
for video in iterator:
|
||||
rows.append((video.id, video.title, '%d:%02d:%02d' % (video.duration/3600, (video.duration%3600/60), video.duration%60)))
|
||||
results[backend.name] = rows
|
||||
results[backend.name] = [(video.id, video.title, video.formatted_duration) for video in
|
||||
backend.iter_search_results(pattern=pattern)]
|
||||
return results
|
||||
|
||||
@ConsoleApplication.command('Get video file URL from page URL')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue