nsfw is handled in video subclasses

nsfw
This commit is contained in:
Christophe Benz 2010-07-12 03:13:30 +02:00
commit d427f0a899
5 changed files with 10 additions and 6 deletions

View file

@ -37,7 +37,6 @@ class YoujizzBackend(BaseBackend, ICapVideo):
def get_video(self, _id):
video = self.browser.get_video(_id)
video.nsfw = True
return video
def iter_page_urls(self, mozaic_url):
@ -47,5 +46,4 @@ class YoujizzBackend(BaseBackend, ICapVideo):
if not nsfw:
yield iter(set())
for video in self.browser.iter_search_results(pattern, required_fields=required_fields):
video.nsfw = True
yield video

View file

@ -23,6 +23,10 @@ __all__ = ['YoujizzVideo']
class YoujizzVideo(BaseVideo):
def __init__(self, *args, **kwargs):
BaseVideo.__init__(self, *args, **kwargs)
self.nsfw = True
@classmethod
def id2url(cls, _id):
return 'http://www.youjizz.com/videos/%s.html' % _id

View file

@ -68,4 +68,4 @@ class IndexPage(PornPage):
rating_max=rating_max,
duration=duration,
thumbnail_url=thumbnail_url,
nsfw=True)
)

View file

@ -29,12 +29,10 @@ class VideoPage(PornPage):
def on_loaded(self):
if not PornPage.on_loaded(self):
return
self.video = YoupornVideo(self.get_id(),
self.get_title(),
self.get_url(),
nsfw=True)
)
self.set_details(self.video)
def get_id(self):

View file

@ -23,6 +23,10 @@ __all__ = ['YoupornVideo']
class YoupornVideo(BaseVideo):
def __init__(self, *args, **kwargs):
BaseVideo.__init__(self, *args, **kwargs)
self.nsfw = True
@classmethod
def id2url(cls, _id):
if _id.isdigit():