def add_last_visited(anime_id): try: c = cache.get(masterani.get_anime_details, 8, anime_id) lastEpisode = watched.Watched().watched(anime_id) plot = c['plot'] premiered = c['premiered'] genre = c['genre'] type = c['type'] sysaddon = sys.argv[0] addon_poster = addon_banner = control.addonInfo('icon') addon_fanart = control.addonInfo('fanart') if type is '0': item = control.item("Last Played: [I]%s[/I] - Episode %s" % (c['title'], lastEpisode)) else: item = control.item("Last Played: [I]%s[/I]" % (c['title'])) poster = "http://cdn.masterani.me/poster/%s" % c['poster'] fanart = "http://cdn.masterani.me/wallpaper/0/%s" % c['fanart'][0] item.setArt({'poster': poster}) item.setProperty("Fanart_Image", fanart) item.setInfo(type='Video', infoLabels={ 'Plot': plot, 'Year': premiered, 'premiered': premiered, 'genre': genre, 'mediatype': 'tvshow' }) url = '%s?action=get_episodes' % sysaddon try: url += '&anime_id=%s' % anime_id except: pass control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=True) except: pass
elif action == 'play': from resources.lib.modules.player import play play(anime_id, episode_id) elif action == 'search': from resources.lib.indexers import animeshows animeshows.Indexer().search(query) elif action == 'clearCache': from resources.lib.modules import cache cache.cache_clear() elif action == "watched": from resources.lib.modules import watched watched.Watched().mark(anime_id, episode_id, unmark) elif action == "add_favorite": from resources.lib.modules import favorites favorites.Favorites().add(anime_id) elif action == "remove_favorite": from resources.lib.modules import favorites favorites.Favorites().delete(anime_id) elif action == "favorites": from resources.lib.indexers import animeshows animeshows.Indexer().get_favorites() elif action == 'authTrakt': from resources.lib.modules import trakt