diff --git a/weboob/backends/youporn/pages/video.py b/weboob/backends/youporn/pages/video.py index 48a0fded..eeccc1d6 100644 --- a/weboob/backends/youporn/pages/video.py +++ b/weboob/backends/youporn/pages/video.py @@ -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: diff --git a/weboob/capabilities/video.py b/weboob/capabilities/video.py index 79062354..bbb88229 100644 --- a/weboob/capabilities/video.py +++ b/weboob/capabilities/video.py @@ -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): diff --git a/weboob/frontends/videoob/application.py b/weboob/frontends/videoob/application.py index ad456082..9f032157 100644 --- a/weboob/frontends/videoob/application.py +++ b/weboob/frontends/videoob/application.py @@ -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')