def backup(self): self.dbcur.execute("CREATE TABLE IF NOT EXISTS favorites_backup (""anime_id INTEGER, UNIQUE(anime_id) "");") self.dbcur.execute("DELETE FROM favorites_backup;") self.dbcon.commit() self.dbcur.execute("INSERT INTO favorites_backup SELECT * FROM favorites;") self.dbcon.commit() control.refresh()
def add(self, anime_id): try: self.dbcur.execute("INSERT OR IGNORE INTO favorites VALUES (%s)" % anime_id) self.dbcon.commit() control.refresh() except: pass
def addFavourite(meta, content): try: item = dict() meta = json.loads(meta) # print "META DUMP FAVOURITES %s" % meta try: id = meta['imdb'] except: id = meta['tvdb'] if 'title' in meta: title = item['title'] = meta['title'] if 'tvshowtitle' in meta: title = item['title'] = meta['tvshowtitle'] if 'year' in meta: item['year'] = meta['year'] if 'poster' in meta: item['poster'] = meta['poster'] if 'fanart' in meta: item['fanart'] = meta['fanart'] if 'imdb' in meta: item['imdb'] = meta['imdb'] if 'tmdb' in meta: item['tmdb'] = meta['tmdb'] if 'tvdb' in meta: item['tvdb'] = meta['tvdb'] if 'tvrage' in meta: item['tvrage'] = meta['tvrage'] control.makeFile(dataPath) dbcon = database.connect(favouritesFile) dbcur = dbcon.cursor() dbcur.execute("CREATE TABLE IF NOT EXISTS %s (""id TEXT, ""items TEXT, ""UNIQUE(id)"");" % content) dbcur.execute("DELETE FROM %s WHERE id = '%s'" % (content, id)) dbcur.execute("INSERT INTO %s Values (?, ?)" % content, (id, repr(item))) dbcon.commit() control.refresh() control.infoDialog('Added to Watchlist', heading=title) except: return
def delete(self, anime_id): try: self.dbcur.execute("DELETE FROM favorites WHERE (anime_id = '%s')" % anime_id) self.dbcon.commit() control.refresh() except: pass
def kitsu_logout(self): control.setSetting("kitsu.token", '') control.setSetting("kitsu.userid", '') control.setSetting("kitsu.login_auth", '') control.refresh() dialog = xbmcgui.Dialog() dialog.ok('Kitsu', 'Logout successful')
def addFavourite(meta, content, query): try: item = dict() meta = json.loads(meta) try: id = meta['imdb'] except: id = meta['tvdb'] if 'title' in meta: title = item['title'] = meta['title'] if 'tvshowtitle' in meta: title = item['title'] = meta['tvshowtitle'] if 'year' in meta: item['year'] = meta['year'] if 'poster' in meta: item['poster'] = meta['poster'] if 'fanart' in meta: item['fanart'] = meta['fanart'] if 'imdb' in meta: item['imdb'] = meta['imdb'] if 'tmdb' in meta: item['tmdb'] = meta['tmdb'] if 'tvdb' in meta: item['tvdb'] = meta['tvdb'] if 'tvrage' in meta: item['tvrage'] = meta['tvrage'] control.makeFile(control.dataPath) dbcon = database.connect(control.favouritesFile) dbcur = dbcon.cursor() dbcur.execute("CREATE TABLE IF NOT EXISTS %s (""id TEXT, ""items TEXT, ""UNIQUE(id)"");" % content) dbcur.execute("DELETE FROM %s WHERE id = '%s'" % (content, id)) dbcur.execute("INSERT INTO %s Values (?, ?)" % content, (id, repr(item))) dbcon.commit() if query == None: control.refresh() control.infoDialog(control.lang(30411).encode('utf-8'), heading=title) except: return
def tvshows(tvshowtitle, imdb, tvdb, season, watched): control.busy() try: import sys,xbmc if not trakt.getTraktIndicatorsInfo() == False: raise Exception() from metahandler import metahandlers from resources.lib.indexers import episodes metaget = metahandlers.MetaData(preparezip=False) name = control.addonInfo('name') dialog = control.progressDialogBG dialog.create(str(name), str(tvshowtitle)) dialog.update(0, str(name), str(tvshowtitle)) metaget.get_meta('tvshow', name='', imdb_id=imdb) items = episodes.episodes().get(tvshowtitle, '0', imdb, tvdb, '0', idx=False) try: items = [i for i in items if int('%01d' % int(season)) == int('%01d' % int(i['season']))] except: pass items = [{'label': '%s S%02dE%02d' % (tvshowtitle, int(i['season']), int(i['episode'])), 'season': int('%01d' % int(i['season'])), 'episode': int('%01d' % int(i['episode']))} for i in items] for i in range(len(items)): if xbmc.abortRequested == True: return sys.exit() dialog.update(int((100 / float(len(items))) * i), str(name), str(items[i]['label'])) season, episode = items[i]['season'], items[i]['episode'] metaget.get_episode_meta('', imdb_id=imdb, season=season, episode=episode) metaget.change_watched('episode', '', imdb_id=imdb, season=season, episode=episode, watched=int(watched)) try: dialog.close() except: pass except: try: dialog.close() except: pass try: if trakt.getTraktIndicatorsInfo() == False: raise Exception() if season: from resources.lib.indexers import episodes items = episodes.episodes().get(tvshowtitle, '0', imdb, tvdb, season, idx=False) items = [(int(i['season']), int(i['episode'])) for i in items] items = [i[1] for i in items if int('%01d' % int(season)) == int('%01d' % i[0])] for i in items: if int(watched) == 7: trakt.markEpisodeAsWatched(tvdb, season, i) else: trakt.markEpisodeAsNotWatched(tvdb, season, i) else: if int(watched) == 7: trakt.markTVShowAsWatched(tvdb) else: trakt.markTVShowAsNotWatched(tvdb) trakt.cachesyncTVShows() except: pass control.refresh()
def clear(self): control.window.clearProperty(property + '.status') control.window.clearProperty(property + '.name') control.window.clearProperty(property + '.image') control.window.clearProperty(property + '.percent') control.window.clearProperty(property + '.speed') control.window.clearProperty(property + '.size') control.refresh()
def onPlayBackStopped(self): from resources.lib.modules import utils; try: pname = '%s.player.overlay' % control.addonInfo('id'); rname = '%s.player.resumetime' % control.addonInfo('id'); rtime = str(int(self.currentTime)); watcher = ((self.currentTime / self.totalTime) >= .9); property = control.window.getProperty(pname); '''self.item.setProperty("resumetime", str(1000)) control.window.setProperty(rname, str(1000)); self.item.setInfo(type='Video', infoLabels = {'resumetime':str(1000)}); control.refresh();''' if watcher == True and not property == '7': try: control.window.setProperty(pname, '7'); except Exception as inst: logger.error(inst); pass; utils.syncdbprogress(self.show_id, self.asset_id, self.content, self.currentTime, self.totalTime, True, '7'); elif watcher == False and not property == '6': try: control.window.setProperty(pname, '6'); except Exception as inst: logger.error(inst); pass; utils.syncdbprogress(self.show_id, self.asset_id, self.content, self.currentTime, self.totalTime, True, '6'); else: utils.syncdbprogress(self.show_id, self.asset_id, self.content, self.currentTime, self.totalTime, True, property); '''else: #We want to show the inprogress tag but it is not working control.window.setProperty(rname, rtime); control.refresh();''' control.refresh(); except Exception as inst: logger.error(inst); pass;
def libForPlayback(self): try: if self.DBID == None: raise Exception() if self.content == 'movie': rpc = '{"jsonrpc": "2.0", "method": "VideoLibrary.SetMovieDetails", "params": {"movieid" : %s, "playcount" : 1 }, "id": 1 }' % str(self.DBID) elif self.content == 'episode': rpc = '{"jsonrpc": "2.0", "method": "VideoLibrary.SetEpisodeDetails", "params": {"episodeid" : %s, "playcount" : 1 }, "id": 1 }' % str(self.DBID) control.jsonrpc(rpc) ; control.refresh() except: pass
def removeDownload(url): try: def download(): return [] result = cache.get(download, 600000000, table='rel_dl') if result == '': result = [] result = [i for i in result if not i['url'] == url] if result == []: result = '' def download(): return result result = cache.get(download, 0, table='rel_dl') control.refresh() except: control.infoDialog('Morate ručno ukloniti datoteku', 'Nije moguće ukloniti datoteku')
def removeDownload(url): try: def download(): return [] result = cache.neptune_download_get(download, 600000000, table='rel_dl') if result == '': result = [] result = [i for i in result if not i['url'] == url] if result == []: result = '' def download(): return result result = cache.neptune_download_get(download, 0, table='rel_dl') control.refresh() except: control.infoDialog('You need to remove file manually', 'Can not remove from Queue')
def unwatch(imdb = None, tvdb = None, season = None, episode = None, refresh = True): if tvdb == None: markMovieAsNotWatched(imdb) cachesyncMovies() elif not episode == None: markEpisodeAsNotWatched(tvdb, season, episode) cachesyncTVShows() elif not season == None: markSeasonAsNotWatched(tvdb, season) cachesyncTVShows() elif not tvdb == None: markTVShowAsNotWatched(tvdb) cachesyncTVShows() else: markMovieAsNotWatched(imdb) cachesyncMovies() if refresh: control.refresh()
def movies(imdb, watched): try: if trakt.getTraktIndicatorsInfo() == False: raise Exception() if int(watched) == 7: trakt.markMovieAsWatched(imdb) else: trakt.markMovieAsNotWatched(imdb) trakt.cachesyncMovies() control.refresh() except: pass try: from metahandler import metahandlers metaget = metahandlers.MetaData(preparezip=False) metaget.get_meta('movie', name='', imdb_id=imdb) metaget.change_watched('movie', name='', imdb_id=imdb, watched=int(watched)) if trakt.getTraktIndicatorsInfo() == False: control.refresh() except: pass
def episodes(imdb, tvdb, season, episode, watched): try: if trakt.getTraktIndicatorsInfo() == False: raise Exception() if int(watched) == 7: trakt.markEpisodeAsWatched(tvdb, season, episode) else: trakt.markEpisodeAsNotWatched(tvdb, season, episode) trakt.cachesyncTVShows() control.refresh() except: pass try: from metahandler import metahandlers metaget = metahandlers.MetaData(preparezip=False) metaget.get_meta('tvshow', name='', imdb_id=imdb) metaget.get_episode_meta('', imdb_id=imdb, season=season, episode=episode) metaget.change_watched('episode', '', imdb_id=imdb, season=season, episode=episode, watched=int(watched)) if trakt.getTraktIndicatorsInfo() == False: control.refresh() except: pass
def deleteProgress(meta, content): try: meta = json.loads(meta) try: dbcon = database.connect(progressFile) dbcur = dbcon.cursor() try: dbcur.execute("DELETE FROM %s WHERE id = '%s'" % (content, meta['imdb'])) except: pass try: dbcur.execute("DELETE FROM %s WHERE id = '%s'" % (content, meta['tvdb'])) except: pass try: dbcur.execute("DELETE FROM %s WHERE id = '%s'" % (content, meta['tmdb'])) except: pass dbcon.commit() except: pass control.refresh() except: return
def mark(self, anime_id, episode_id, unmark=None): try: if int(episode_id) == -999: if unmark is None: result = cache.get(masterani.get_anime_details, 1, anime_id) episodes = result['episodes'] if 'episodes' in result else '' for e in episodes: self.dbcur.execute("INSERT OR IGNORE INTO watched VALUES (?, ?)", (anime_id, e)) else: self.dbcur.execute("DELETE FROM watched WHERE (anime_id = '%s')" % anime_id) else: if unmark is None: self.dbcur.execute("INSERT OR IGNORE INTO watched VALUES (?, ?)", (anime_id, episode_id)) else: self.dbcur.execute( "DELETE FROM watched WHERE (anime_id = '%s' and episode_id = '%s')" % (anime_id, episode_id)) self.dbcon.commit() control.refresh() except: pass
def deleteFavourite(meta, content): try: meta = json.loads(meta) if 'title' in meta: title = meta['title'] if 'tvshowtitle' in meta: title = meta['tvshowtitle'] try: dbcon = database.connect(control.favouritesFile) dbcur = dbcon.cursor() try: dbcur.execute("DELETE FROM %s WHERE id = '%s'" % (content, meta['imdb'])) except: pass try: dbcur.execute("DELETE FROM %s WHERE id = '%s'" % (content, meta['tvdb'])) except: pass dbcon.commit() except: pass control.refresh() control.infoDialog(control.lang(30412).encode('utf-8'), heading=title) except: return
def tvshows(tvshowtitle, imdb, tvdb, season, watched): try: import sys,xbmc if not trakt.getTraktIndicatorsInfo() == False: raise Exception() watched=int(watched) from metahandler import metahandlers from resources.lib.indexers import episodes imdb = imdb.encode('utf-8') metaget = metahandlers.MetaData(preparezip=False) name = control.addonInfo('name') dialog = control.progressDialogBG dialog.create(str(name), str(tvshowtitle)) dialog.update(0, str(name), str(tvshowtitle)) items = episodes.episodes().get(tvshowtitle, '0', imdb, tvdb, '0', idx=False) try: items = [i for i in items if int('%01d' % int(season)) == int('%01d' % int(i['season']))] except: pass items = [{'label': '%s S%02dE%02d' % (tvshowtitle, int(i['season']), int(i['episode'])), 'season': int('%01d' % int(i['season'])), 'episode': int('%01d' % int(i['episode']))} for i in items] for i in range(len(items)): if xbmc.abortRequested == True: return sys.exit() dialog.update(int((100 / float(len(items))) * i), str(name), str(items[i]['label'])) season, episode = items[i]['season'], items[i]['episode'] metaget.get_episode_meta('', imdb, season, episode) metaget.change_watched('episode', '', imdb, season=season, episode=episode, year='', watched=watched) try: dialog.close() except: pass except: try: dialog.close() except: pass control.refresh()
def openSettings(self): control.openSettings('globoplay_username') control.refresh()
def delSearch(self): try: cache.clear('rel_srch') control.refresh() except: pass
def updatefavorites(params): import json; from resources.lib.modules import control; url = None; title = None; thumbnail = None; isFolder = None; try: if 'action' in params: params.pop('action'); if 'url' in params: url = re.sub('/action', '/?action', params['url']); params.pop('url'); if 'name' in params: title = params['name']; params.pop('name'); if 'posterart' in params: thumbnail = params['posterart']; params.pop('posterart'); if 'isFolder' in params: isFolder = params['isFolder']; params.pop('isFolder'); if url: import json; import xbmcgui; from resources.lib.modules import control; params = urllib.urlencode(params); url += ('&' + params); if isFolder == 'True': wid = xbmcgui.getCurrentWindowId(); favs = control.jsonrpc('{"jsonrpc": "2.0", "method": "Favourites.AddFavourite", "params": {"title": "%s", "type": "window", "windowparameter": "%s", "thumbnail": "%s", "window": "%s"}, "id": 1}' % (title, url, thumbnail, 10025)); else: favs = control.jsonrpc('{"jsonrpc": "2.0", "method": "Favourites.AddFavourite", "params": {"title": "%s", "type": "media", "path": "%s", "thumbnail": "%s"}, "id": 1}' % (title, url, thumbnail)); favs = json.loads(favs); if 'result' in favs and favs['result'] != 'OK': sendNotification(32506, 5000); else: control.refresh(); except Exception as inst: logger.error(inst); sendNotification(32506, 5000); pass;
def recover(self): self.dbcur.execute("DELETE FROM favorites;") self.dbcon.commit() self.dbcur.execute("INSERT INTO favorites SELECT * FROM favorites_backup;") self.dbcon.commit() control.refresh()
def tvshows(tvshowtitle, imdb, tvdb, season, watched): control.busy() try: import sys, xbmc if not trakt.getTraktIndicatorsInfo() == False: raise Exception() from metahandler import metahandlers from resources.lib.indexers import episodes metaget = metahandlers.MetaData(preparezip=False) name = control.addonInfo('name') dialog = control.progressDialogBG dialog.create(str(name), str(tvshowtitle)) dialog.update(0, str(name), str(tvshowtitle)) metaget.get_meta('tvshow', name='', imdb_id=imdb) items = episodes.episodes().get(tvshowtitle, '0', imdb, tvdb, '0', idx=False) try: items = [ i for i in items if int('%01d' % int(season)) == int('%01d' % int(i['season'])) ] except: pass items = [{ 'label': '%s S%02dE%02d' % (tvshowtitle, int(i['season']), int(i['episode'])), 'season': int('%01d' % int(i['season'])), 'episode': int('%01d' % int(i['episode'])) } for i in items] for i in range(len(items)): if xbmc.abortRequested == True: return sys.exit() dialog.update(int((100 / float(len(items))) * i), str(name), str(items[i]['label'])) season, episode = items[i]['season'], items[i]['episode'] metaget.get_episode_meta('', imdb_id=imdb, season=season, episode=episode) metaget.change_watched('episode', '', imdb_id=imdb, season=season, episode=episode, watched=int(watched)) try: dialog.close() except: pass except: try: dialog.close() except: pass try: if trakt.getTraktIndicatorsInfo() == False: raise Exception() if season: from resources.lib.indexers import episodes items = episodes.episodes().get(tvshowtitle, '0', imdb, tvdb, season, idx=False) items = [(int(i['season']), int(i['episode'])) for i in items] items = [ i[1] for i in items if int('%01d' % int(season)) == int('%01d' % i[0]) ] for i in items: if int(watched) == 7: trakt.markEpisodeAsWatched(tvdb, season, i) else: trakt.markEpisodeAsNotWatched(tvdb, season, i) else: if int(watched) == 7: trakt.markTVShowAsWatched(tvdb) else: trakt.markTVShowAsNotWatched(tvdb) trakt.cachesyncTVShows() except: pass control.refresh()
def clearSearch(): cache.clear('rel_srch') control.refresh()
elif action == 'tvWidget': from resources.lib.indexers import episodes episodes.episodes().widget() elif action == 'calendars': from resources.lib.indexers import episodes episodes.episodes().calendars() elif action == 'episodeUserlists': from resources.lib.indexers import episodes episodes.episodes().userlists() elif action == 'refresh': from resources.lib.modules import control control.refresh() elif action == 'queueItem': from resources.lib.modules import control control.queueItem() elif action == 'openPlaylist': from resources.lib.modules import control control.openPlaylist() elif action == 'openSettings': from resources.lib.modules import control control.openSettings(query) elif action == 'artwork': from resources.lib.modules import control
def tvshows(tvshowtitle, year, imdb, tvdb, season, watched): try: import sys, xbmc if not trakt.getTraktIndicatorsInfo() == False: raise Exception() from metahandler import metahandlers from resources.lib.indexers import episodes metaget = metahandlers.MetaData(preparezip=False) dialog = control.progressDialog dialog.create(control.addonInfo('name'), str(tvshowtitle)) dialog.update(0, str(tvshowtitle), control.lang(30451).encode('utf-8') + '...') metaget.get_meta('tvshow', '', imdb_id=imdb) items = episodes.episodes().get(tvshowtitle, year, imdb, '0', tvdb, '0', idx=False) try: items = [ i for i in items if int('%01d' % int(season)) == int('%01d' % int(i['season'])) ] except: pass items = [{ 'name': i['name'], 'season': int('%01d' % int(i['season'])), 'episode': int('%01d' % int(i['episode'])) } for i in items] for i in range(len(items)): if xbmc.abortRequested == True: return sys.exit() if dialog.iscanceled(): return dialog.close() dialog.update(int((100 / float(len(items))) * i), str(tvshowtitle), str(items[i]['name'])) season, episode = items[i]['season'], items[i]['episode'] metaget.get_episode_meta('', imdb, season, episode) metaget.change_watched('episode', '', imdb, season=season, episode=episode, year='', watched=watched) try: dialog.close() except: pass except: try: dialog.close() except: pass try: if trakt.getTraktIndicatorsInfo() == False: raise Exception() if int(watched) == 7: trakt.markTVShowAsWatched(tvdb) else: trakt.markTVShowAsNotWatched(tvdb) trakt.cachesyncTVShows() except: pass control.refresh()
def delSearch(self): try: cache.clear('rel_srch') control.refresh() except: log_utils.error()
def del_watch_later(self, video_id): from resources.lib.modules.globosat import scraper_vod scraper_vod.del_watch_later(video_id) control.refresh() control.infoDialog(control.lang(32057).encode('utf-8'), sound=True, icon='INFO')
def manager(name, imdb=None, tvdb=None, season=None, episode=None, refresh=True): lists = [] try: if season: season = int(season) if episode: episode = int(episode) if tvdb: media_type = 'Show' else: media_type = 'Movie' items = [(control.lang(33651), 'watch')] items += [(control.lang(33652), 'unwatch')] items += [(control.lang(33653), 'rate')] items += [(control.lang(33654), 'unrate')] items += [(control.lang(40075) % media_type, 'hideItem')] if control.setting('trakt.scrobble') == 'true' and control.setting( 'resume.source') == '1': items += [(control.lang(40076), 'scrobbleReset')] items += [(control.lang(33575), '/sync/collection')] items += [(control.lang(33576), '/sync/collection/remove')] if season or episode: items += [(control.lang(33573), '/sync/watchlist')] items += [(control.lang(33574), '/sync/watchlist/remove')] items += [(control.lang(33577), '/sync/watchlist')] items += [(control.lang(33578), '/sync/watchlist/remove')] items += [(control.lang(33579), '/users/me/lists/%s/items')] result = getTraktAsJson('/users/me/lists') lists = [(i['name'], i['ids']['slug']) for i in result] lists = [lists[i // 2] for i in range(len(lists) * 2)] for i in range(0, len(lists), 2): lists[i] = ((control.lang(33580) % lists[i][0]), '/users/me/lists/%s/items' % lists[i][1]) for i in range(1, len(lists), 2): lists[i] = ((control.lang(33581) % lists[i][0]), '/users/me/lists/%s/items/remove' % lists[i][1]) items += lists control.hide() select = control.selectDialog([i[0] for i in items], heading=control.addonInfo('name') + ' - ' + control.lang(32515)) if select == -1: return if select >= 0: if items[select][0] == control.lang(33651): watch(name, imdb=imdb, tvdb=tvdb, season=season, episode=episode, refresh=refresh) elif items[select][0] == control.lang(33652): unwatch(name, imdb=imdb, tvdb=tvdb, season=season, episode=episode, refresh=refresh) elif items[select][0] == control.lang(33653): rate(imdb=imdb, tvdb=tvdb, season=season, episode=episode) elif items[select][0] == control.lang(33654): unrate(imdb=imdb, tvdb=tvdb, season=season, episode=episode) elif items[select][0] == control.lang(40075) % media_type: hideItem(name=name, imdb=imdb, tvdb=tvdb, season=season, episode=episode) elif items[select][0] == control.lang(40076): scrobbleReset(imdb=imdb, tvdb=tvdb, season=season, episode=episode) else: if not tvdb: post = {"movies": [{"ids": {"imdb": imdb}}]} else: if episode: if items[select][0] == control.lang(33573) or items[ select][0] == control.lang(33574): post = {"shows": [{"ids": {"tvdb": tvdb}}]} else: post = { "shows": [{ "ids": { "tvdb": tvdb }, "seasons": [{ "number": season, "episodes": [{ "number": episode }] }] }] } name = name + ' - ' + '%sx%02d' % (season, episode) elif season: if items[select][0] == control.lang(33573) or items[ select][0] == control.lang(33574): post = {"shows": [{"ids": {"tvdb": tvdb}}]} else: post = { "shows": [{ "ids": { "tvdb": tvdb }, "seasons": [{ "number": season }] }] } name = name + ' - ' + 'Season %s' % season else: post = {"shows": [{"ids": {"tvdb": tvdb}}]} if items[select][0] == control.lang(33579): slug = listAdd(successNotification=True) if slug: getTrakt(items[select][1] % slug, post=post)[0] else: getTrakt(items[select][1], post=post)[0] control.hide() list = re.search('\[B](.+?)\[/B]', items[select][0]).group(1) message = control.lang( 33583) if 'remove' in items[select][1] else control.lang( 33582) if items[select][0].startswith('Add'): refresh = False control.hide() if refresh: control.refresh() control.trigger_widget_refresh() if control.setting('trakt.general.notifications') == 'true': control.notification(title=name, message=message + ' (%s)' % list) except: log_utils.error() control.hide()
def marktvshows(tvshowtitle, imdb, tvdb, watched): try: import sys, xbmc if not trakt.getTraktIndicatorsInfo() == False: raise Exception() watched = int(watched) from metahandler import metahandlers from resources.lib.indexers import episodes imdb = imdb.encode('utf-8') metaget = metahandlers.MetaData(preparezip=False) name = control.addonInfo('name') dialog = control.progressDialogBG dialog.create(str(name), str(tvshowtitle)) dialog.update(0, str(name), str(tvshowtitle)) items = episodes.episodes().get(tvshowtitle, '0', imdb, tvdb, '0', idx=False) try: items = [i for i in items] except: pass items = [{ 'label': '%s S%02dE%02d' % (tvshowtitle, int(i['season']), int(i['episode'])), 'season': int('%01d' % int(i['season'])), 'episode': int('%01d' % int(i['episode'])) } for i in items] season_file = control.seasons_meta try: from sqlite3 import dbapi2 as database except: from pysqlite2 import dbapi2 as database try: if watched == 6: total = '6' dbcon = database.connect(season_file) dbcur = dbcon.cursor() dbcur.execute("DELETE FROM season_meta WHERE imdb = '%s'" % (imdb)) dbcon.commit() except: pass for i in range(len(items)): if xbmc.abortRequested == True: return sys.exit() dialog.update(int((100 / float(len(items))) * i), str(name), str(items[i]['label'])) season, episode = items[i]['season'], items[i]['episode'] metaget.get_episode_meta('', imdb, season, episode) metaget.change_watched('episode', '', imdb, season=season, episode=episode, year='', watched=watched) try: if watched == 7: total = '7' dbcon = database.connect(season_file) dbcur = dbcon.cursor() dbcur.execute( "DELETE FROM season_meta WHERE imdb = '%s' AND season = '%s'" % (imdb, season)) dbcur.execute( "INSERT INTO season_meta Values (?, ?, ?, ?)", (imdb, tvdb, season, total)) dbcon.commit() except: pass try: dialog.close() except: pass except: try: dialog.close() except: pass try: import sys, xbmc watched = int(watched) imdb = imdb.encode('utf-8') from metahandler import metahandlers from resources.lib.indexers import episodes metaget = metahandlers.MetaData(preparezip=False) metaget.get_meta('tvshow', name='', imdb_id=imdb) metaget._update_watched(imdb, 'tvshow', watched) metaget.change_watched('tvshow', '', imdb, watched=watched) except: pass control.refresh()
def tvshows(tvshowtitle, imdb, tvdb, season, watched): try: import sys, xbmc if not trakt.getTraktIndicatorsInfo() == False: raise Exception() watched = int(watched) from metahandler import metahandlers from resources.lib.indexers import episodes imdb = imdb.encode('utf-8') metaget = metahandlers.MetaData(preparezip=False) name = control.addonInfo('name') dialog = control.progressDialogBG dialog.create(str(name), str(tvshowtitle)) dialog.update(0, str(name), str(tvshowtitle)) items = episodes.episodes().get(tvshowtitle, '0', imdb, tvdb, '0', idx=False) try: items = [ i for i in items if int('%01d' % int(season)) == int('%01d' % int(i['season'])) ] except: pass items = [{ 'label': '%s S%02dE%02d' % (tvshowtitle, int(i['season']), int(i['episode'])), 'season': int('%01d' % int(i['season'])), 'episode': int('%01d' % int(i['episode'])) } for i in items] for i in range(len(items)): if xbmc.abortRequested == True: return sys.exit() dialog.update(int((100 / float(len(items))) * i), str(name), str(items[i]['label'])) season, episode = items[i]['season'], items[i]['episode'] metaget.get_episode_meta('', imdb, season, episode) metaget.change_watched('episode', '', imdb, season=season, episode=episode, year='', watched=watched) try: dialog.close() except: pass except: try: dialog.close() except: pass control.refresh()
def delete(self, type, folder_id=None, folder_name=None): try: if type == 'folder': url = folder_delete_url else: url = item_delete_url if not control.yesnoDialog( control.lang(40050) % folder_name, '', ''): return data = {'id': folder_id} response = self._post(url, data=data) if not response: return if 'status' in response: if response.get('status') == 'success': control.refresh() except: log_utils.error() # # from resolveURL # def get_all_hosters(self): # try: # response = self._get(list_services_path_url) # if not response: # return None # aliases = response.get('aliases', {}) # patterns = response.get('regexpatterns', {}) # tldlist = [] # for tlds in aliases.values(): # for tld in tlds: # tldlist.append(tld) # if self.get_setting('torrents') == 'true': # tldlist.extend([u'torrent', u'magnet']) # regex_list = [] # for regexes in patterns.values(): # for regex in regexes: # try: # regex_list.append(re.compile(regex)) # except: # log_utils.log('Throwing out bad Premiumize regex: %s' % regex, __name__, log_utils.LOGDEBUG) # log_utils.log('Premiumize.me patterns: %s regex: (%d) hosts: %s' % (patterns, len(regex_list), tldlist), __name__, log_utils.LOGDEBUG) # return tldlist, regex_list # except Exception as e: # log_utils.log('Error getting Premiumize hosts: %s' % e, __name__, log_utils.LOGDEBUG) # return [], [] # # from resolveURL # def valid_url(self, url, host): # if url and self.get_setting('torrents') == 'true': # url_lc = url.lower() # if url_lc.endswith('.torrent') or url_lc.startswith('magnet:'): # return True # if not self.patterns or not self.hosts: # self.hosts, self.patterns = self.get_all_hosters() # if url: # if not url.endswith('/'): # url += '/' # for pattern in self.patterns: # if pattern.findall(url): # return True # elif host: # if host.startswith('www.'): # host = host.replace('www.', '') # if any(host in item for item in self.hosts): # return True # return False
def save_theme(self): control.setSetting('appearance.1', self.selectedArtwork) self.close() control.refresh()
def manager(name, imdb=None, tvdb=None, season=None, episode=None, refresh=True): lists = [] try: if season is not None: season = int(season) if episode is not None: episode = int(episode) if tvdb is not None: media_type = 'Show' else: media_type = 'Movie' items = [(control.lang(33651).encode('utf-8'), 'watch')] items += [(control.lang(33652).encode('utf-8'), 'unwatch')] items += [(control.lang(33653).encode('utf-8'), 'rate')] items += [(control.lang(33654).encode('utf-8'), 'unrate')] items += [(control.lang(40075).encode('utf-8') % media_type, 'hideItem')] items += [(control.lang(33575).encode('utf-8'), '/sync/collection')] items += [(control.lang(33576).encode('utf-8'), '/sync/collection/remove')] if season or episode is not None: items += [(control.lang(33573).encode('utf-8'), '/sync/watchlist')] items += [(control.lang(33574).encode('utf-8'), '/sync/watchlist/remove')] items += [(control.lang(33577).encode('utf-8'), '/sync/watchlist')] items += [(control.lang(33578).encode('utf-8'), '/sync/watchlist/remove')] items += [(control.lang(33579).encode('utf-8'), '/users/me/lists/%s/items')] result = getTraktAsJson('/users/me/lists') lists = [(i['name'], i['ids']['slug']) for i in result] lists = [lists[i // 2] for i in range(len(lists) * 2)] for i in range(0, len(lists), 2): lists[i] = ((control.lang(33580) % lists[i][0]).encode('utf-8'), '/users/me/lists/%s/items' % lists[i][1]) for i in range(1, len(lists), 2): lists[i] = ((control.lang(33581) % lists[i][0]).encode('utf-8'), '/users/me/lists/%s/items/remove' % lists[i][1]) items += lists control.hide() select = control.selectDialog([i[0] for i in items], heading=control.addonInfo('name') + ' - ' + control.lang(32515).encode('utf-8')) if select == -1: return if select >= 0: # if select == 0: if items[select][0] == control.lang(33651).encode('utf-8'): control.busy() watch(name, imdb=imdb, tvdb=tvdb, season=season, episode=episode, refresh=refresh) control.hide() # elif select == 1: elif items[select][0] == control.lang(33652).encode('utf-8'): control.busy() unwatch(name, imdb=imdb, tvdb=tvdb, season=season, episode=episode, refresh=refresh) control.hide() # elif select == 2: elif items[select][0] == control.lang(33653).encode('utf-8'): control.busy() rate(imdb=imdb, tvdb=tvdb, season=season, episode=episode) control.hide() # elif select == 3: elif items[select][0] == control.lang(33654).encode('utf-8'): control.busy() unrate(imdb=imdb, tvdb=tvdb, season=season, episode=episode) control.hide() # elif select == 4: elif items[select][0] == control.lang(40075).encode( 'utf-8') % media_type: control.busy() hideItem(name=name, imdb=imdb, tvdb=tvdb, season=season, episode=episode) control.hide() else: if tvdb is None: post = {"movies": [{"ids": {"imdb": imdb}}]} else: if episode is not None: if items[select][0] == control.lang(33573).encode( 'utf-8') or items[select][0] == control.lang( 33574).encode('utf-8'): post = {"shows": [{"ids": {"tvdb": tvdb}}]} else: post = { "shows": [{ "ids": { "tvdb": tvdb }, "seasons": [{ "number": season, "episodes": [{ "number": episode }] }] }] } name = name + ' - ' + '%sx%02d' % (season, episode) elif season is not None: if items[select][0] == control.lang(33573).encode( 'utf-8') or items[select][0] == control.lang( 33574).encode('utf-8'): post = {"shows": [{"ids": {"tvdb": tvdb}}]} else: post = { "shows": [{ "ids": { "tvdb": tvdb }, "seasons": [{ "number": season }] }] } name = name + ' - ' + 'Season %s' % season else: post = {"shows": [{"ids": {"tvdb": tvdb}}]} # if select == 8: if items[select][0] == control.lang(33579).encode('utf-8'): slug = listAdd(successNotification=True) if slug is not None: getTrakt(items[select][1] % slug, post=post)[0] else: getTrakt(items[select][1], post=post)[0] control.hide() # message = 33583 if (select % 2) == 0 else 33582 message = 33583 if 'remove' in items[select][1] else 33582 if refresh: control.refresh() control.trigger_widget_refresh() if general_notification: control.notification(title=name, message=message, icon='INFO', sound=notificationSound) except: log_utils.error() control.hide()
def onPlayBackStopped(self): control.refresh() pass
def clearCacheSearch(self): control.idle() if control.yesnoDialog(control.lang(32056).encode('utf-8'), '', ''): control.setSetting('tvsearch', '') control.setSetting('moviesearch', '') control.refresh()
def clearfinished(): url = urlparse.urljoin(premiumize_Api, premiumizeClearFinished) r = reqJson(url) control.refresh()
navigator.navigator().filtered(action, filtertype, params); elif action == 'updatemyqueue': from resources.lib.modules import control; from resources.lib.modules import utils; success = utils.addremovequeueitem(params); emessage = 32507; if success is not None: emessage = success[1]; if success[0] is True: control.refresh(); utils.sendNotification(emessage, 10000); elif action == 'updatewatched': from resources.lib.modules import control; from resources.lib.modules import utils; logger.error(params) success = utils.markwatchedstatus(params); if success is not None: control.refresh();
def selectiveLibraryManager(id, name): modes = ['Delete From Auto Sync', 'Force Update'] select = control.selectDialog(modes) if select == 0: selective_update(id=id, name=name, mode='delete') elif select == 1: selective_update(id=id, name=name, mode='update') control.refresh()
elif action == 'mytvNavigator' : navigator.navigator().mytvshows() elif action == 'collectionsMovies' : navigator.navigator().collectionsMovies() elif action == 'kidsCollections' : navigator.navigator().kidsCollections() elif action == 'holidayCollections' : navigator.navigator().holidayCollections() elif action == 'openSettings' : control.openSettings(query) elif action == 'play': select = control.setting('hosts.mode') if select == '3' and 'plugin' in control.infoLabel('Container.PluginName'): sources().play_dialog(title, year, imdb, tvdb, season, episode, tvshowtitle, premiered, meta, select) elif select == '4' and 'plugin' in control.infoLabel('Container.PluginName'): sources().play_dialog_list(title, year, imdb, tvdb, season, episode, tvshowtitle, premiered, meta, select) else : sources().play(title, year, imdb, tvdb, season, episode, tvshowtitle, premiered, meta, select) elif action == 'play_alter' : sources().play_alter(title, year, imdb, tvdb, season, episode, tvshowtitle, premiered, meta) elif action == 'play_library' : sources().play_library(title, year, imdb, tvdb, season, episode, tvshowtitle, premiered, meta, select) elif action == 'playItem' : sources().playItem(title, source) elif action == 'queueItem' : control.queueItem() elif action == 'rdAuthorize' : debrid.rdAuthorize() elif action == 'refresh' : control.refresh() elif action == 'restorewatchlist': zipdir = control.setting('remote_restore_path') if not zipdir == '': with zipfile.ZipFile(zipdir, "r") as z: z.extractall(datapath) dialog.ok('Restore Watchlist', 'Restore complete', '', '') else: dialog.ok('Restore Watchlist', 'No item found: Please select your zipfile location in the addon settings', '', '') xbmc.executebuiltin('RunPlugin(%s?action=openSettings&query=7.1)' % sys.argv[0]) elif action == 'searchNavigator' : navigator.navigator().search() elif action == 'seasons' : episodes.seasons().get(tvshowtitle, year, imdb, tvdb) elif action == 'ShowChangelog' : changelog.get() elif action == 'showsProgress' : episodes.episodes().in_progress() elif action == 'similar_movies' : movies.movies().similar_movies(imdb) elif action == 'similar_shows' : tvshows.tvshows().similar_shows(imdb)
def manager(imdb, tmdbtvdb, meta, content): try: if DBURL == None or DBURL == '': control.infoDialog('RemoteDB Address is Empty...', time=3000) return HOSTDB = str(DBURL) DBLINK = str(HOSTDB) + "/library.php?action=%s" # #print("DATABASE REMOTE", DBLINK) if imdb == '' or imdb == '0' or imdb == None: raise Exception() actions = ['Add to Library', 'Remove from Library'] meta = json.loads(meta) dbname = meta['title'] if 'title' in meta else '0' # #print("DATABASE REMOTE", dbname) dbposter = meta['poster'] if 'poster' in meta else '0' # #print("DATABASE REMOTE", dbposter) dbfanart = meta['fanart'] if 'fanart' in meta else '0' # #print("DATABASE REMOTE", dbfanart) dbyear = meta['year'] if 'year' in meta else '0' # #print("DATABASE REMOTE", dbyear) dbrating = meta['rating'] if 'rating' in meta else '0' # #print("DATABASE REMOTE", dbrating) dbgenre = meta['genre'] if 'genre' in meta else '0' # #print("DATABASE REMOTE", dbgenre) dbplot = meta['plot'] if 'plot' in meta else '0' # #print("DATABASE REMOTE", dbplot) payload = {'title':dbname, 'imdb':imdb, 'tmdbtvdb': tmdbtvdb, 'poster':dbposter, 'fanart':dbfanart, 'year':dbyear, 'rating':dbrating, 'genre':dbgenre, 'plot':dbplot} # #print ("DATABASE PAYLOAD", payload) select = control.selectDialog(actions, 'Remote Library Manager') if tmdbtvdb == '0' or tmdbtvdb == None or tmdbtvdb == '': tmdbtvdb = imdb if select == -1: return elif select == 0: if content == 'movie': dbcheck = DBLINK % 'movies' check = requests.get(dbcheck).content if imdb in check or tmdbtvdb in check: control.infoDialog('Item already in Library', heading=str(dbname), sound=True) return act = 'addmovie' else: dbcheck = DBLINK % 'tv' check = requests.get(dbcheck).content if imdb in check or tmdbtvdb in check: control.infoDialog('Item already in Library', heading=str(dbname), sound=True) return act = 'addtv' url = DBLINK % act r = requests.post(url, data=payload).content elif select == 1: if content == 'movie': dbcheck = DBLINK % 'movies' check = requests.get(dbcheck).content if not str(imdb) in check: control.infoDialog('Item Not in Library', heading=str(dbname), sound=True) return if not str(tmdbtvdb) in check: control.infoDialog('Item Not in Library', heading=str(dbname), sound=True) return act = 'deletemovie' else: dbcheck = DBLINK % 'tv' check = requests.get(dbcheck).content if not str(imdb) in check: control.infoDialog('Item Not in Library', heading=str(dbname), sound=True) return if not str(tmdbtvdb) in check: control.infoDialog('Item Not in Library', heading=str(dbname), sound=True) return act = 'deletetv' url = DBLINK % act r = requests.post(url, data=payload).content icon = control.infoLabel('ListItem.Icon') if not r == None else 'ERROR' control.infoDialog(r, heading=str(dbname), sound=True, icon=icon) if act == 'deletemovie' or act == 'deletetv': control.refresh() except: return
def onPlayBackEnded(self): self.libForPlayback() self.onPlayBackStopped() if control.setting('crefresh') == 'true': control.refresh()
def marktvshows(tvshowtitle, imdb, tvdb, watched): try: import sys,xbmc if not trakt.getTraktIndicatorsInfo() == False: raise Exception() watched=int(watched) from metahandler import metahandlers from resources.lib.indexers import episodes imdb = imdb.encode('utf-8') metaget = metahandlers.MetaData(preparezip=False) name = control.addonInfo('name') dialog = control.progressDialogBG dialog.create(str(name), str(tvshowtitle)) dialog.update(0, str(name), str(tvshowtitle)) items = episodes.episodes().get(tvshowtitle, '0', imdb, tvdb, '0', idx=False) try: items = [i for i in items] except: pass items = [{'label': '%s S%02dE%02d' % (tvshowtitle, int(i['season']), int(i['episode'])), 'season': int('%01d' % int(i['season'])), 'episode': int('%01d' % int(i['episode']))} for i in items] season_file = control.seasons_meta try: from sqlite3 import dbapi2 as database except: from pysqlite2 import dbapi2 as database try: if watched == 6: total = '6' dbcon = database.connect(season_file) dbcur = dbcon.cursor() dbcur.execute("DELETE FROM season_meta WHERE imdb = '%s'" % (imdb)) dbcon.commit() except: pass for i in range(len(items)): if xbmc.abortRequested == True: return sys.exit() dialog.update(int((100 / float(len(items))) * i), str(name), str(items[i]['label'])) season, episode = items[i]['season'], items[i]['episode'] metaget.get_episode_meta('', imdb, season, episode) metaget.change_watched('episode', '', imdb, season=season, episode=episode, year='', watched=watched) try: if watched == 7: total = '7' dbcon = database.connect(season_file) dbcur = dbcon.cursor() dbcur.execute("DELETE FROM season_meta WHERE imdb = '%s' AND season = '%s'" % (imdb, season)) dbcur.execute("INSERT INTO season_meta Values (?, ?, ?, ?)", (imdb, tvdb, season, total)) dbcon.commit() except: pass try: dialog.close() except: pass except: try: dialog.close() except: pass try: import sys,xbmc watched=int(watched) imdb = imdb.encode('utf-8') from metahandler import metahandlers from resources.lib.indexers import episodes metaget = metahandlers.MetaData(preparezip=False) metaget.get_meta('tvshow', name='', imdb_id=imdb) metaget._update_watched(imdb, 'tvshow', watched) metaget.change_watched('tvshow', '', imdb, watched=watched) except: pass control.refresh()
elif action == 'tvWidget': from resources.lib.indexers import episodes episodes.episodes().widget() elif action == 'calendars': from resources.lib.indexers import episodes episodes.episodes().calendars() elif action == 'episodeUserlists': from resources.lib.indexers import episodes episodes.episodes().userlists() elif action == 'refresh': from resources.lib.modules import control control.refresh() elif action == 'queueItem': from resources.lib.modules import control control.queueItem() elif action == 'openSettings': from resources.lib.modules import control control.openSettings(query) elif action == 'artwork': from resources.lib.modules import control control.artwork() elif action == 'addView': from resources.lib.modules import views
def run(self, argv): try: from resources.lib.modules import control control.log('ARGV: %s' % argv) params = dict(urlparse.parse_qsl(argv)) #Parameters action = params.get('action') id_globo_videos = params.get('id_globo_videos') id_cms = params.get('id_cms') id = params.get('id') kind = params.get('kind') slug = params.get('slug') letter = params.get('letter') id_sexyhot = params.get('id_sexyhot') meta = params.get('meta') provider = params.get('provider') try: metaJson = json.loads(meta) if meta is not None else None except: traceback.print_exc() metaJson = {} pass is_folder = params.get('isFolder') url = params.get('url') page = params.get('page') q = params.get('q') category = params.get('category') program_id = params.get('program_id') season_id = params.get('season_id') date = params.get('date') poster = params.get('poster') fanart = params.get('fanart') bingewatch = (params.get('bingewatch') or 'false').lower() == "true" children_id = params.get('children_id') state = params.get('state') region = params.get('region') subcategory = params.get('subcategory') #Actions if action is None: from resources.lib.indexers import navigator navigator.navigator().root() elif action == 'settings': from resources.lib.indexers import navigator navigator.navigator().openSettings() elif action == 'clear': from resources.lib.indexers import navigator navigator.navigator().clear_cache() elif action == 'clearAuth': from resources.lib.indexers import navigator navigator.navigator().clear_credentials() elif action == 'login': from resources.lib.indexers import navigator navigator.navigator().cache_auth() elif action == 'refresh': from resources.lib.modules import control control.refresh() elif action == 'searchMenu': from resources.lib.indexers import navigator navigator.navigator().searchMenu() elif action == 'search': from resources.lib.indexers import navigator print('SEARCH -->') print(q) print('PAGE -->') print(page) navigator.navigator().search(q, page) elif action == 'featured': from resources.lib.indexers import vod vod.Vod().get_extras() elif action == 'favorites': from resources.lib.indexers import vod vod.Vod().get_favorites() elif action == 'addFavorites': from resources.lib.indexers import vod vod.Vod().add_favorites(id_globo_videos) elif action == 'delFavorites': from resources.lib.indexers import vod vod.Vod().del_favorites(id_globo_videos) elif action == 'watchlater': from resources.lib.indexers import vod vod.Vod().get_watch_later() elif action == 'addwatchlater': from resources.lib.indexers import vod vod.Vod().add_watch_later(id_globo_videos) elif action == 'delwatchlater': from resources.lib.indexers import vod vod.Vod().del_watch_later(id_globo_videos) elif action == 'watchhistory': from resources.lib.indexers import vod vod.Vod().get_watch_history() elif action == 'liveChannels': from resources.lib.indexers import live live.Live().get_channels() elif action == 'vodChannels': from resources.lib.indexers import vod vod.Vod().get_vod_channels_directory() ## COMMON elif action == 'showdates': from resources.lib.indexers import vod page = page or 1 vod.Vod().get_program_dates(program_id, poster, provider) elif action == 'openvideos' and date: from resources.lib.indexers import vod vod.Vod().get_videos_by_program_date(program_id, date, poster, provider, bingewatch, fanart) ###GLOBOSAT PLAY #PREMIER FC elif action == 'openvideos' and provider == 'premierefc': from resources.lib.indexers import live live.Live().get_subitems_pfc(metaJson) #LIVE CHANNELS elif action == 'playlive' and provider == 'globosat': from resources.lib.modules.globosat import player player.Player().playlive(id_globo_videos, meta) #VOD CHANNELS elif action == 'openchannel' and provider == 'globosat': from resources.lib.indexers import vod if slug == 'combate': vod.Vod().get_channel_categories(slug=slug) elif id_globo_videos: vod.Vod().get_channel_programs(channel_id=id_globo_videos) elif action == 'openvideos' and provider == 'globosat': from resources.lib.indexers import vod # page = page or 1 # vod.Vod().get_videos_by_program(program_id, id_globo_videos, int(page), poster, 'globosat', bingewatch, fanart) vod.Vod().get_seasons_by_program(id_globo_videos) elif action == 'openepisodes' and provider == 'globosat': from resources.lib.indexers import vod vod.Vod().get_episodes_by_program(program_id, season_id) elif action == 'playvod' and provider == 'globosat': from resources.lib.modules.globosat import player player.Player().playlive(id_globo_videos, meta) elif action == 'opencategory' and provider == 'combate': from resources.lib.indexers import vod vod.Vod().get_events_by_categories(category) elif action == 'openevent' and provider == 'combate': from resources.lib.indexers import vod vod.Vod().get_event_videos(category, url) elif action == 'openfighters': from resources.lib.indexers import vod vod.Vod().get_fighters(letter) elif action == 'openfighter': from resources.lib.indexers import vod vod.Vod().get_fighter_videos(slug, page) elif action == 'openfeatured' and provider == 'globosat': from resources.lib.indexers import vod vod.Vod().get_featured() elif action == 'openextra' and provider == 'globosat': from resources.lib.indexers import vod vod.Vod().get_track(id, kind) ###GLOBO PLAY elif action == 'playlive' and provider == 'multicam' and ( is_folder is True or str(is_folder).lower() == 'true'): from resources.lib.indexers import live live.Live().get_subitems_bbb(id_globo_videos) elif action == 'playlive' and provider == 'globoplay': from resources.lib.modules.globoplay import player player.Player().play_stream(id_globo_videos, meta) elif action == 'openchannel' and provider == 'globoplay': from resources.lib.indexers import vod vod.Vod().get_channel_categories() elif action == 'openextra' and provider == 'globoplay': from resources.lib.indexers import vod vod.Vod().get_videos_by_category(category, int(page or 1), poster) elif action == 'opencategory' and provider == 'globoplay' and subcategory is not None: from resources.lib.indexers import vod vod.Vod().get_programs_by_subcategory(category, subcategory) elif action == 'opencategory' and provider == 'globoplay': from resources.lib.indexers import vod vod.Vod().get_programs_by_category(category) elif action == 'openlocal' and region is not None and provider == 'globoplay': from resources.lib.indexers import vod vod.Vod().get_programs_by_region(region) elif action == 'openlocal' and state is not None and provider == 'globoplay': from resources.lib.indexers import vod vod.Vod().get_regions(state) elif action == 'openlocal' and provider == 'globoplay': from resources.lib.indexers import vod vod.Vod().get_states() elif action == 'openvideos' and provider == 'globoplay': from resources.lib.indexers import vod page = page or 1 vod.Vod().get_videos_by_program(program_id, id_globo_videos, int(page), poster, 'globoplay', bingewatch, fanart) elif action == 'playvod' and provider == 'globoplay': from resources.lib.modules.globoplay import player player.Player().play_stream(id_globo_videos, meta, children_id) elif action == 'open4k' and provider == 'globoplay': from resources.lib.indexers import vod vod.Vod().get_4k() ###SEXY HOT elif action == 'openchannel' and provider == 'sexyhot': from resources.lib.modules.sexyhotplay import indexer # indexer.indexer().get_categories() indexer.Indexer().get_videos(1) elif action == 'getVideos' and provider == 'sexyhot': from resources.lib.modules.sexyhotplay import indexer indexer.indexer().get_videos(page) elif action == 'playvod' and provider == 'sexyhot': from resources.lib.modules.sexyhotplay import player player.Player().play_vod(id_sexyhot, meta) ###Oi Play elif action == 'playlive' and provider == 'oiplay': from resources.lib.modules.oiplay import player player.Player().playlive(id_globo_videos, meta) ###TNT Play elif action == 'playlive' and provider == 'tntplay': from resources.lib.modules.tntplay import player player.Player().playlive(id_globo_videos, meta) except Exception: buggalo.onExceptionRaised()
def tvshows(tvshowtitle, imdb, tvdb, season, watched): try: import sys, xbmc if not trakt.getTraktIndicatorsInfo() == False: raise Exception() from metahandler import metahandlers from resources.lib.indexers import episodes metaget = metahandlers.MetaData(preparezip=False) name = control.addonInfo("name") dialog = control.progressDialogBG dialog.create(str(name), str(tvshowtitle)) dialog.update(0, str(name), str(tvshowtitle)) metaget.get_meta("tvshow", name="", imdb_id=imdb) items = episodes.episodes().get(tvshowtitle, "0", imdb, tvdb, "0", idx=False) try: items = [i for i in items if int("%01d" % int(season)) == int("%01d" % int(i["season"]))] except: pass items = [ { "label": "%s S%02dE%02d" % (tvshowtitle, int(i["season"]), int(i["episode"])), "season": int("%01d" % int(i["season"])), "episode": int("%01d" % int(i["episode"])), } for i in items ] for i in range(len(items)): if xbmc.abortRequested == True: return sys.exit() dialog.update(int((100 / float(len(items))) * i), str(name), str(items[i]["label"])) season, episode = items[i]["season"], items[i]["episode"] metaget.get_episode_meta("", imdb_id=imdb, season=season, episode=episode) metaget.change_watched("episode", "", imdb_id=imdb, season=season, episode=episode, watched=int(watched)) try: dialog.close() except: pass except: try: dialog.close() except: pass try: if trakt.getTraktIndicatorsInfo() == False: raise Exception() if int(watched) == 7: trakt.markTVShowAsWatched(tvdb) else: trakt.markTVShowAsNotWatched(tvdb) trakt.cachesyncTVShows() except: pass control.refresh()
def search_clear(): cache.delete(control.searchFile, withyes=False) control.refresh() control.idle()
def tvshows(tvshowtitle, imdb, tmdb, season, watched): control.busy() try: import sys, xbmc if not trakt.getTraktIndicatorsInfo() == False: raise Exception() from resources.lib.indexers import episodes name = control.addonInfo('name') dialog = control.progressDialogBG dialog.create(str(name), str(tvshowtitle)) dialog.update(0, str(name), str(tvshowtitle)) #log_utils.log('playcount_season: ' + str(season)) items = [] if season: items = episodes.episodes().get(tvshowtitle, '0', imdb, tmdb, meta=None, season=season, idx=False) items = [ i for i in items if int('%01d' % int(season)) == int('%01d' % int(i['season'])) ] items = [{ 'label': '%s S%02dE%02d' % (tvshowtitle, int(i['season']), int(i['episode'])), 'season': int('%01d' % int(i['season'])), 'episode': int('%01d' % int(i['episode'])), 'unaired': i['unaired'] } for i in items] for i in list(range(len(items))): if control.monitor.abortRequested(): return sys.exit() dialog.update(int((100 / float(len(items))) * i), str(name), str(items[i]['label'])) _season, _episode, unaired = items[i]['season'], items[i][ 'episode'], items[i]['unaired'] if int(watched) == 7: if not unaired == 'true': bookmarks.reset(1, 1, 'episode', imdb, _season, _episode) else: pass else: bookmarks._delete_record('episode', imdb, _season, _episode) else: seasons = episodes.seasons().get(tvshowtitle, '0', imdb, tmdb, meta=None, idx=False) seasons = [i['season'] for i in seasons] #log_utils.log('playcount_seasons: ' + str(seasons)) for s in seasons: items = episodes.episodes().get(tvshowtitle, '0', imdb, tmdb, meta=None, season=s, idx=False) items = [{ 'label': '%s S%02dE%02d' % (tvshowtitle, int(i['season']), int(i['episode'])), 'season': int('%01d' % int(i['season'])), 'episode': int('%01d' % int(i['episode'])), 'unaired': i['unaired'] } for i in items] #log_utils.log('playcount_items2: ' + str(items)) for i in list(range(len(items))): if control.monitor.abortRequested(): return sys.exit() dialog.update(int((100 / float(len(items))) * i), str(name), str(items[i]['label'])) _season, _episode, unaired = items[i]['season'], items[i][ 'episode'], items[i]['unaired'] if int(watched) == 7: if not unaired == 'true': bookmarks.reset(1, 1, 'episode', imdb, _season, _episode) else: pass else: bookmarks._delete_record('episode', imdb, _season, _episode) try: dialog.close() except: pass except: log_utils.log('playcount_local_shows', 1) try: dialog.close() except: pass try: if trakt.getTraktIndicatorsInfo() == False: raise Exception() #log_utils.log('playcount_season: ' + str(season)) if season: from resources.lib.indexers import episodes items = episodes.episodes().get(tvshowtitle, '0', imdb, tmdb, meta=None, season=season, idx=False) items = [(int(i['season']), int(i['episode'])) for i in items] items = [ i[1] for i in items if int('%01d' % int(season)) == int('%01d' % i[0]) ] for i in items: if int(watched) == 7: trakt.markEpisodeAsWatched(imdb, season, i) else: trakt.markEpisodeAsNotWatched(imdb, season, i) else: if int(watched) == 7: trakt.markTVShowAsWatched(imdb) else: trakt.markTVShowAsNotWatched(imdb) trakt.cachesyncTVShows() except: log_utils.log('playcount_trakt_shows', 1) pass control.refresh() control.idle()
def clearFav(self): self.dbcur.execute("DELETE FROM favorites;") self.dbcon.commit() control.refresh()