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
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
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
def parse_video(self, _video, category): video = BaseVideo(u'%s#%s' % (_video['code'], category)) video.title = unicode(_video['title']) video._video_code = unicode(_video['code']) video.ext = u'mp4' if 'runtime' in _video: video.duration = timedelta(seconds=int(_video['runtime'])) if 'description' in _video: video.description = unicode(_video['description']) renditions = sorted(_video['rendition'], key=lambda x: 'bandwidth' in x and x['bandwidth']['code'], reverse=True) video.url = unicode(max(renditions, key=lambda x: 'bandwidth' in x)['href']) return video
def parse_video(self, _video, category): video = BaseVideo(u"%s#%s" % (_video["code"], category)) video.title = unicode(_video["title"]) video._video_code = unicode(_video["code"]) video.ext = u"mp4" if "runtime" in _video: video.duration = timedelta(seconds=int(_video["runtime"])) if "description" in _video: video.description = unicode(_video["description"]) renditions = sorted( _video["rendition"], key=lambda x: "bandwidth" in x and x["bandwidth"]["code"], reverse=True ) video.url = unicode(max(renditions, key=lambda x: "bandwidth" in x)["href"]) return video
def parse_video(self, _video, category): video = BaseVideo(u'%s#%s' % (_video['code'], category)) video.title = unicode(_video['title']) video._video_code = unicode(_video['code']) video.ext = u'mp4' if 'runtime' in _video: video.duration = timedelta(seconds=int(_video['runtime'])) if 'description' in _video: video.description = unicode(_video['description']) renditions = sorted( _video['rendition'], key=lambda x: 'bandwidth' in x and x['bandwidth']['code'], reverse=True) video.url = unicode( max(renditions, key=lambda x: 'bandwidth' in x)['href']) return video