Move the "empty search for latest" to collections

There is now a "latest" collection (or "latest_nsfw").
The feature didn't look much used, since it didn't work on many
backends.
Using collections will make it easy to support other things
like most viewed, featured, etc.
As a bonus, I added tests for every backend with the feature.
This commit is contained in:
Laurent Bachelier 2012-03-16 02:55:58 +01:00
commit e958c229e6
32 changed files with 366 additions and 112 deletions

View file

@ -47,15 +47,18 @@ class DailymotionBrowser(BaseBrowser):
self.location('/1')
def search_videos(self, pattern, sortby):
if not pattern:
self.home()
pattern = pattern.replace('/', '').encode('utf-8')
if sortby is None:
url = '/search/%s/1' % quote_plus(pattern)
else:
pattern = pattern.replace('/', '').encode('utf-8')
if sortby is None:
url = '/search/%s/1' % quote_plus(pattern)
else:
url = '/%s/search/%s/1' % (sortby, quote_plus(pattern))
self.location(url)
url = '/%s/search/%s/1' % (sortby, quote_plus(pattern))
self.location(url)
assert self.is_on_page(IndexPage)
return self.page.iter_videos()
def latest_videos(self):
self.home()
assert self.is_on_page(IndexPage)
return self.page.iter_videos()