Video contains 'rating_max' information

This commit is contained in:
Romain Bignon 2010-04-16 16:50:12 +02:00
commit ba2f1cf99a
3 changed files with 9 additions and 3 deletions

View file

@ -79,7 +79,9 @@ class VideoPage(PornPage):
elif name == 'Submitted:':
v.author = li.find('i').text
elif name == 'Rating:':
v.rating = float(value[:value.find(' ')])
r = value.split()
v.rating = float(r[0])
v.rating_max = float(r[2])
elif name == 'Date:':
m = self.DATE_REGEXP.match(value)
if m:

View file

@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
from .cap import ICap
class Video(object):
def __init__(self, _id, title=u'', url=u'', author=u'', duration=0, date=None, rating=0):
def __init__(self, _id, title=u'', url=u'', author=u'', duration=0, date=None, rating=0, rating_max=0):
self.id = _id
self.title = title
self.url = url
@ -29,6 +29,7 @@ class Video(object):
self.duration = duration
self.date = date
self.rating = rating
self.rating_max = rating_max
class ICapVideoProvider(ICap):
def iter_page_urls(self, mozaic_url):

View file

@ -43,7 +43,10 @@ class Videoob(ConsoleApplication):
print u"| URL | %s" % video.url
print u"| Author | %s" % video.author
print u"| Date | %s" % video.date
print u"| Rating | %s" % video.rating
if video.rating_max:
print u"| Rating | %s / %s" % (video.rating, video.rating_max)
elif video.rating:
print u"| Rating | %s" % video.rating
print u"'-----------------' "
@ConsoleApplication.command('Get video file URL from page URL')