remove page_url attribue, better check types for numbers

This commit is contained in:
Christophe Benz 2010-04-26 19:22:45 +02:00
commit 7996c1e05a
3 changed files with 6 additions and 8 deletions

View file

@ -57,7 +57,6 @@ class IndexPage(BasePage):
yield Video(_id, yield Video(_id,
title=title, title=title,
page_url=self.browser.id2url(_id),
duration=duration, duration=duration,
preview_url=preview_url, preview_url=preview_url,
nsfw=True) nsfw=True)

View file

@ -67,7 +67,6 @@ class IndexPage(PornPage):
yield Video(int(_id), yield Video(int(_id),
title=title, title=title,
page_url=self.browser.id2url(_id),
rating=rating, rating=rating,
rating_max=rating_max, rating_max=rating_max,
duration=duration, duration=duration,

View file

@ -25,23 +25,23 @@ __all__ = ['ICapVideoProvider', 'Video']
class Video(object): class Video(object):
def __init__(self, _id, title=u'', url=u'', page_url=u'', author=u'', duration=0, date=None, def __init__(self, _id, title=None, url=None, author=None, duration=0, date=None,
rating=0, rating_max=0, preview_url=None, nsfw=False): rating=0.0, rating_max=0.0, preview_url=None, nsfw=False):
self.id = _id self.id = _id
self.title = title self.title = title
self.url = url self.url = url
self.page_url = page_url
self.author = author self.author = author
self.duration = duration self.duration = int(duration)
self.date = date self.date = date
self.rating = rating self.rating = float(rating)
self.rating_max = rating_max self.rating_max = float(rating_max)
self.preview_url = preview_url self.preview_url = preview_url
self.nsfw = nsfw self.nsfw = nsfw
@property @property
def formatted_duration(self): def formatted_duration(self):
return '%d:%02d:%02d' % (self.duration / 3600, (self.duration % 3600 / 60), self.duration % 60) return '%d:%02d:%02d' % (self.duration / 3600, (self.duration % 3600 / 60), self.duration % 60)
class ICapVideoProvider(ICap): class ICapVideoProvider(ICap):
def iter_page_urls(self, mozaic_url): def iter_page_urls(self, mozaic_url):
raise NotImplementedError() raise NotImplementedError()