本文整理汇总了Python中weboob.capabilities.video.BaseVideo.rating_max方法的典型用法代码示例。如果您正苦于以下问题:Python BaseVideo.rating_max方法的具体用法?Python BaseVideo.rating_max怎么用?Python BaseVideo.rating_max使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类weboob.capabilities.video.BaseVideo
的用法示例。
在下文中一共展示了BaseVideo.rating_max方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parse_movie
# 需要导入模块: from weboob.capabilities.video import BaseVideo [as 别名]
# 或者: from weboob.capabilities.video.BaseVideo import rating_max [as 别名]
def parse_movie(self, movie):
video = BaseVideo(u'%s#%s' % (movie['code'], 'movie'))
video.title = unicode(movie['trailer']['name'])
video._video_code = unicode(movie['trailer']['code'])
video.ext = u'mp4'
if 'poster' in movie:
video.thumbnail = Thumbnail(movie['poster']['href'])
video.thumbnail.url = unicode(movie['poster']['href'])
tdate = movie['release']['releaseDate'].split('-')
day = 1
month = 1
year = 1901
if len(tdate) > 2:
year = int(tdate[0])
month = int(tdate[1])
day = int(tdate[2])
video.date = date(year, month, day)
if 'userRating' in movie['statistics']:
video.rating = movie['statistics']['userRating']
elif 'pressRating' in movie['statistics']:
video.rating = movie['statistics']['pressRating'] * 2
video.rating_max = 5
if 'synopsis' in movie:
video.description = unicode(movie['synopsis'].replace('<p>', '').replace('</p>', ''))
elif 'synopsisShort' in movie:
video.description = unicode(movie['synopsisShort'].replace('<p>', '').replace('</p>', ''))
if 'castingShort' in movie:
if 'directors' in movie['castingShort']:
video.author = unicode(movie['castingShort']['directors'])
if 'runtime' in movie:
video.duration = timedelta(seconds=int(movie['runtime']))
return video
示例2: parse_movie
# 需要导入模块: from weboob.capabilities.video import BaseVideo [as 别名]
# 或者: from weboob.capabilities.video.BaseVideo import rating_max [as 别名]
def parse_movie(self, movie):
video = BaseVideo(u"%s#%s" % (movie["code"], "movie"))
video.title = unicode(movie["trailer"]["name"])
video._video_code = unicode(movie["trailer"]["code"])
video.ext = u"mp4"
if "poster" in movie:
video.thumbnail = BaseImage(movie["poster"]["href"])
video.thumbnail.url = unicode(movie["poster"]["href"])
tdate = movie["release"]["releaseDate"].split("-")
day = 1
month = 1
year = 1901
if len(tdate) > 2:
year = int(tdate[0])
month = int(tdate[1])
day = int(tdate[2])
video.date = date(year, month, day)
if "userRating" in movie["statistics"]:
video.rating = movie["statistics"]["userRating"]
elif "pressRating" in movie["statistics"]:
video.rating = movie["statistics"]["pressRating"] * 2
video.rating_max = 5
if "synopsis" in movie:
video.description = unicode(movie["synopsis"].replace("<p>", "").replace("</p>", ""))
elif "synopsisShort" in movie:
video.description = unicode(movie["synopsisShort"].replace("<p>", "").replace("</p>", ""))
if "castingShort" in movie:
if "directors" in movie["castingShort"]:
video.author = unicode(movie["castingShort"]["directors"])
if "runtime" in movie:
video.duration = timedelta(seconds=int(movie["runtime"]))
return video