def list_videos(plugin, item_id, program_category, page, **kwargs): resp = urlquick.get(URL_SHOW % (item_id, get_token(item_id), program_category, page)) json_parser = json.loads(resp.text) for video_datas in json_parser['videos']: video_id = video_datas['video'] video_id_ext = video_datas['id_ext'] category = video_datas['category'] title = video_datas['title'] description = video_datas['description'] # begin_date = video['begin_date'] # 1486725600, image = video_datas['image'] duration = old_div(video_datas['video_duration_ms'], 1000) value_date = time.strftime('%d %m %Y', time.localtime(video_datas["begin_date"])) date = str(value_date).split(' ') day = date[0] mounth = date[1] year = date[2] date = '.'.join((day, mounth, year)) aired = '-'.join((year, mounth, day)) item = Listitem() item.label = title item.art['thumb'] = item.art['landscape'] = image item.info['duration'] = duration item.info['plot'] = description item.info['genre'] = category item.info['aired'] = aired item.info['year'] = year item.info['date'] = date item.set_callback(get_video_url, item_id=item_id, video_id=video_id, video_id_ext=video_id_ext) item_post_treatment(item, is_playable=True, is_downloadable=True) yield item yield Listitem.next_page(item_id=item_id, program_category=program_category, page=str(int(page) + 1))
def list_videos(plugin, item_id, program_id, program_season_number, **kwargs): resp = urlquick.get(URL_VIDEOS % program_id) json_parser = json.loads(resp.text) at_least_one_item = False if 'episode' in json_parser["videos"]: if str(program_season_number) in json_parser["videos"]["episode"]: for video_datas in json_parser["videos"]["episode"][str( program_season_number)]: at_least_one_item = True video_title = video_datas["title"] video_duration = old_div(int(video_datas["videoDuration"]), 1000) video_plot = video_datas["description"] video_image = video_datas["image"]["src"] video_id = video_datas["path"] item = Listitem() item.label = video_title item.art["thumb"] = video_image item.art["fanart"] = video_image item.info["plot"] = video_plot item.info["duration"] = video_duration item.set_callback(get_video_url, item_id=item_id, video_id=video_id) item_post_treatment(item, is_playable=True, is_downloadable=True) yield item if not at_least_one_item: plugin.notify(plugin.localize(LABELS['No videos found']), '') yield False