def search_history(self, search_array): result = list(map(self._parse_history_view, search_array)) result.insert(0, g.allocate_item("New Search", "search", True)) result.insert( len(result), g.allocate_item("Clear Search History...", "clear_history", False)) return result
def _parse_episode_view(self, res, anilist_id, poster, fanart, eps_watched, filter_lang): url = "%s/%s/" % (anilist_id, res['episode']) if filter_lang: url += filter_lang name = 'Ep. %d (%s)' % (res['episode'], res.get('title')) image = self.imagePath % res['img'] info = {} info['plot'] = res['description'] info['title'] = res['title'] info['season'] = 1 info['episode'] = res['episode'] try: if int(eps_watched) >= res['episode']: info['playcount'] = 1 except: pass try: info['aired'] = res['date'][:10] except: pass info['tvshowtitle'] = ast.literal_eval( database.get_show(anilist_id)['kodi_meta'])['title_userPreferred'] info['mediatype'] = 'episode' parsed = g.allocate_item(name, "play/" + str(url), False, image, info, fanart, poster, True) return parsed
def _parse_trakt_episode_view(self, res, show_id, show_meta, season, poster, fanart, eps_watched, update_time): url = "%s/%s/" % (show_id, res['number']) name = 'Ep. %d (%s)' % (res['number'], res.get('title', '')) try: image = TMDBAPI().episodeIDToListItem(season, str(res['number']), show_meta)['thumb'] except: image = 'DefaultVideo.png' info = {} info['plot'] = res['overview'] info['title'] = res.get('title', '') info['season'] = int(season) info['episode'] = res['number'] try: if int(eps_watched) >= res['number']: info['playcount'] = 1 except: pass try: info['aired'] = res['first_aired'][:10] except: pass info['tvshowtitle'] = ast.literal_eval( database.get_show(show_id)['kodi_meta'])['title_userPreferred'] info['mediatype'] = 'episode' parsed = g.allocate_item(name, "play/" + str(url), False, image, info, fanart, poster, True) database._update_episode(show_id, season, res['number'], res['number_abs'], update_time, parsed) return parsed
def LIST_MENU(payload, params): return g.draw_items( [ g.allocate_item(name, url, True, image) for name, url, image in MENU_ITEMS ], contentType=g.get_setting("contenttype.menu"), )
def _parse_trakt_view(self, res, show_id, show_meta): url = '%s/%d' % (show_id, res['number']) name = res['title'] image = TMDBAPI().showSeasonToListItem(res['number'], show_meta) if image: image = image['poster'] info = {} info['plot'] = res['overview'] info['mediatype'] = 'season' parsed = g.allocate_item(name, "animes_trakt/" + str(url), True, image, info) return parsed
def _parse_search_trakt(self, res, show_id): url = '%s/%s' % (show_id, res['show']['ids']) name = res['show']['title'] image = TMDBAPI().showPoster(res['show']['ids']) if image: image = image['poster'] info = {} info['plot'] = res['show']['overview'] info['mediatype'] = 'tvshow' parsed = g.allocate_item(name, "season_correction_database/" + str(url), True, image, info) return parsed
def _parse_latest_view(self, res): res = res.a info = {} slug, episode = (res['href'][1:]).rsplit('-episode-') url = '%s/%s' % (slug, episode) name = '%s - Ep. %s' % (res['title'], episode) image = res.img['src'] info['title'] = name info['mediatype'] = 'tvshow' return g.allocate_item(name, "play_gogo/" + str(url), False, image, info, is_playable=True)
def TOOLS_MENU(payload, params): TOOLS_ITEMS = [ (g.lang(30020), "settings", ''), (g.lang(30021), "clear_cache", ''), (g.lang(30022), "clear_torrent_cache", ''), (g.lang(30023), "clear_history", ''), (g.lang(30026), "rebuild_database", ''), (g.lang(30024), "wipe_addon_data", ''), ] return g.draw_items( [ g.allocate_item(name, url, False, image) for name, url, image in TOOLS_ITEMS ], contentType=g.get_setting("contenttype.menu"), )
def _parse_airing_dub_view(self, res): name = list(res.values())[0] mal_id = (list(res.keys())[0]).rsplit('/')[-2] url = 'watchlist_to_ep/{}//0'.format(mal_id) try: image = ast.literal_eval( database.get_show_mal(mal_id)['kodi_meta'])['poster'] except: image = 'DefaultVideo.png' info = {} info['title'] = name info[ 'plot'] = '** = Dub production suspended until further notice.\n++ = Dub is being produced from home studios with an irregular release schedule.' info['mediatype'] = 'tvshow' return g.allocate_item(name, url, True, image, info)
def _parse_view(self, base, is_dir=True, is_playable=False): return [ g.allocate_item("%s" % base["name"], base["url"], is_dir, base["image"], base["plot"], base.get("fanart"), base.get("poster"), is_playable) ]
def _parse_history_view(self, res): name = res return g.allocate_item(name, "search/" + name + "/1", True)