def range(self, url): control.idle() yes = control.yesnoDialog(control.lang(32555).encode('utf-8'), '', '') if not yes: return if not control.condVisibility( 'Window.IsVisible(infodialog)') and not control.condVisibility( 'Player.HasVideo'): control.infoDialog(control.lang(32552).encode('utf-8'), time=10000000) self.infoDialog = True from resources.lib.indexers import tvshows items = tvshows.tvshows().get(url, idx=False) if items == None: items = [] for i in items: try: if xbmc.abortRequested == True: return sys.exit() self.add(i['title'], i['year'], i['imdb'], i['tvdb'], range=True) except: pass if self.infoDialog == True: control.infoDialog(control.lang(32554).encode('utf-8'), time=1) if self.library_setting == 'true' and not control.condVisibility( 'Library.IsScanningVideo'): control.execute('UpdateLibrary(video)')
def range(self, url): control.idle() yes = control.yesnoDialog(control.lang(32555).encode('utf-8'), '', '') if not yes: return if not control.condVisibility('Window.IsVisible(infodialog)') and not control.condVisibility('Player.HasVideo'): control.infoDialog(control.lang(32552).encode('utf-8'), time=10000000) self.infoDialog = True from resources.lib.indexers import tvshows items = tvshows.tvshows().get(url, idx=False) if items == None: items = [] for i in items: try: if xbmc.abortRequested == True: return sys.exit() self.add(i['title'], i['year'], i['imdb'], i['tvdb'], range=True) except: pass if self.infoDialog == True: control.infoDialog(control.lang(32554).encode('utf-8'), time=1) if self.library_setting == 'true' and not control.condVisibility('Library.IsScanningVideo'): control.execute('UpdateLibrary(video)')
def silent(self, url): control.idle() if not control.condVisibility( 'Window.IsVisible(infodialog)') and not control.condVisibility( 'Player.HasVideo'): control.infoDialog( "Farbe für noch nicht gesendete Staffeln/Episoden", time=10000000) self.infoDialog = True self.silentDialog = True from resources.lib.indexers import tvshows items = tvshows.tvshows().get(url, idx=False) if items == None: items = [] for i in items: try: if xbmc.abortRequested == True: return sys.exit() self.add(i['title'], i['year'], i['imdb'], i['tvdb'], range=True) except: pass if self.infoDialog is True: self.silentDialog = False control.infoDialog("Trakt-Synchronisierung abgeschlossen", time=1)
def range(self, url, query): if query == 'tool': return xbmc.executebuiltin('RunPlugin(%s?action=tvshowsToLibrary&url=%s)' % (sys.argv[0], urllib.quote_plus(url))) yes = control.yesnoDialog(control.lang(30425).encode('utf-8'), '', '') if not yes: return if not control.condVisibility('Window.IsVisible(infodialog)') and not control.condVisibility('Player.HasVideo'): control.infoDialog(control.lang(30421).encode('utf-8'), time=10000000) self.infoDialog = True from resources.lib.indexers import tvshows items = tvshows.tvshows().get(url, idx=False) if items == None: items = [] for i in items: try: if xbmc.abortRequested == True: return sys.exit() self.add(i['title'], i['year'], i['imdb'], i['tmdb'], i['tvdb'], i['tvrage'], range=True) except: pass if self.infoDialog == True: control.infoDialog(control.lang(30423).encode('utf-8'), time=1) if self.library_setting == 'true' and not control.condVisibility('Library.IsScanningVideo'): control.execute('UpdateLibrary(video)')
def seasonList(self, url): # Dirty implementation, but avoids rewritting everything from episodes.py. episodes = episodesx.episodes(type = self.type, kids = self.kids) self.list = cache.get(episodes.trakt_list, 0, url, self.trakt_user) self.list = self.list[::-1] tvshows = tvshowsx.tvshows(type = self.type, kids = self.kids) tvshows.list = self.list tvshows.worker() self.list = tvshows.list # Remove duplicate season entries. try: result = [] for i in self.list: found = False for j in result: if i['imdb'] == j['imdb'] and i['season'] == j['season']: found = True break if not found: result.append(i) self.list = result except: pass self.seasonDirectory(self.list)
def range(self, url): control.idle() yes = control.yesnoDialog(control.lang(30425).encode("utf-8"), "", "") if not yes: return if not control.condVisibility("Window.IsVisible(infodialog)") and not control.condVisibility("Player.HasVideo"): control.infoDialog(control.lang(30421).encode("utf-8"), time=10000000) self.infoDialog = True from resources.lib.indexers import tvshows items = tvshows.tvshows().get(url, idx=False) if items == None: items = [] for i in items: try: if xbmc.abortRequested == True: return sys.exit() self.add(i["title"], i["year"], i["imdb"], i["tmdb"], i["tvdb"], i["tvrage"], range=True) except: pass if self.infoDialog == True: control.infoDialog(control.lang(30423).encode("utf-8"), time=1) if self.library_setting == "true" and not control.condVisibility("Library.IsScanningVideo"): control.execute("UpdateLibrary(video)")
def getPeople(self, name, url): try: select = control.selectDialog(['Movies', 'TV Shows', 'Biography'], heading=name) if select == -1: return elif select == 0: from resources.lib.indexers import movies movies.movies().get(self.person_movie_link % url) elif select == 1: from resources.lib.indexers import tvshows tvshows.tvshows().get(self.person_tv_link % url) elif select == 2: self.bio_txt(url, name) except: log_utils.log('getPeople', 1) pass
def range(self, url): control.idle() yes = control.yesnoDialog(control.lang(32555).encode("utf-8"), "", "") if not yes: return if not control.condVisibility( "Window.IsVisible(infodialog)" ) and not control.condVisibility("Player.HasVideo"): control.infoDialog(control.lang(32552).encode("utf-8"), time=10000000) self.infoDialog = True from resources.lib.indexers import tvshows items = tvshows.tvshows().get(url, idx=False) if items == None: items = [] for i in items: try: if xbmc.abortRequested == True: return sys.exit() self.add(i["title"], i["year"], i["imdb"], i["tvdb"], range=True) except: pass if self.infoDialog == True: control.infoDialog(control.lang(32554).encode("utf-8"), time=1) if self.library_setting == "true" and not control.condVisibility( "Library.IsScanningVideo" ): control.execute("UpdateLibrary(video)")
def range(self, url): control.idle() yes = control.yesnoDialog("Sind sie sicher?", '', '') if not yes: return if not control.condVisibility( 'Window.IsVisible(infodialog)') and not control.condVisibility( 'Player.HasVideo'): control.infoDialog("Hinzufügen zur Bibliothek...", time=10000000) self.infoDialog = True from resources.lib.indexers import tvshows items = tvshows.tvshows().get(url, idx=False) if items == None: items = [] for i in items: try: if xbmc.abortRequested == True: return sys.exit() self.add(i['title'], i['year'], i['imdb'], i['tvdb'], range=True) except: pass if self.infoDialog == True: control.infoDialog("Vorgang abgeschlossen", time=1) if self.library_setting == 'true' and not control.condVisibility( 'Library.IsScanningVideo'): control.execute('UpdateLibrary(video)')
def silent(self, url): control.idle() if not control.condVisibility( 'Window.IsVisible(infodialog)') and not control.condVisibility( 'Player.HasVideo'): control.infoDialog(control.lang(32608).encode('utf-8'), time=10000000) self.infoDialog = True self.silentDialog = True from resources.lib.indexers import tvshows items = tvshows.tvshows().get(url, idx=False) if items == None: items = [] for i in items: try: if xbmc.abortRequested == True: return sys.exit() self.add(i['title'], i['year'], i['imdb'], i['tvdb'], range=True) except: pass if self.infoDialog is True: self.silentDialog = False control.infoDialog("Trakt TV Show Sync Complete", time=1)
def arrivals(self): if trakt.getTraktIndicatorsInfo() == True: setting = tools.Settings.getInteger('interface.arrivals.shows') else: setting = 0 if setting == 0: self.calendar(self.added_link) elif setting == 1: self.home() elif setting == 2: from resources.lib.indexers import tvshows tvshows.tvshows(type = self.type, kids = self.kids).get('airing') elif setting == 3: self.calendar(self.progress_link) elif setting == 4: self.calendar(self.mycalendar_link) else: self.home()
def _televisionAddMultiple(self, link): interface.Loader.hide() count = -1 if interface.Dialog.option(title=33244, message=35179): count = 0 if self._ready(): interface.Dialog.notification( title=33244, message=35177, icon=interface.Dialog.IconInformation, time=100000000) self.mDialog = True items = None try: from resources.lib.indexers import tvshows items = tvshows.tvshows().get(link, idx=False, notifications=False) except: pass if not items or len(items) == 0: from resources.lib.indexers import episodes items = episodes.episodes().calendar(link) if items == None: items = [] for i in items: try: if tools.System.aborted(): return sys.exit() count += self._televisionAddSingle( i['tvshowtitle'] if 'tvshowtitle' in i else i['title'], i['year'], i['imdb'], i['tvdb'], i, multiple=True) except: pass return count
def silent(self, url): control.idle() if not control.condVisibility('Window.IsVisible(infodialog)') and not control.condVisibility('Player.HasVideo'): control.infoDialog(control.lang(32608).encode('utf-8'), time=10000000) self.infoDialog = True self.silentDialog = True from resources.lib.indexers import tvshows items = tvshows.tvshows().get(url, idx=False) if items == None: items = [] for i in items: try: if xbmc.abortRequested == True: return sys.exit() self.add(i['title'], i['year'], i['imdb'], i['tvdb'], range=True) except: pass if self.infoDialog is True: self.silentDialog = False control.infoDialog("Trakt TV Show Sync Complete", time=1)
elif action == 'moviePersons': from resources.lib.indexers import movies movies.movies().persons(url) elif action == 'movieUserlists': from resources.lib.indexers import movies movies.movies().userlists() elif action == 'channels': from resources.lib.indexers import channels channels.channels().get() elif action == 'tvshows': from resources.lib.indexers import tvshows tvshows.tvshows().get(url) elif action == 'tvshowPage': from resources.lib.indexers import tvshows tvshows.tvshows().get(url) elif action == 'tvSearch': from resources.lib.indexers import tvshows tvshows.tvshows().search() elif action == 'tvPerson': from resources.lib.indexers import tvshows tvshows.tvshows().person() elif action == 'tvGenres': from resources.lib.indexers import tvshows
elif action == 'moviePersons': from resources.lib.indexers import movies movies.movies().persons() elif action == 'movieUserlists': from resources.lib.indexers import movies movies.movies().userlists() elif action == 'channels': from resources.lib.indexers import channels channels.channels().get() elif action == 'tvshows': from resources.lib.indexers import tvshows tvshows.tvshows().get(url) elif action == 'tvSearch': from resources.lib.indexers import tvshows tvshows.tvshows().search(query) elif action == 'tvPerson': from resources.lib.indexers import tvshows tvshows.tvshows().person(query) elif action == 'tvGenres': from resources.lib.indexers import tvshows tvshows.tvshows().genres() elif action == 'tvNetworks': from resources.lib.indexers import tvshows
else: control.infoDialog(control.lang2(161).encode('utf-8'), heading='"Progress Database"', sound=False, icon=thumbnail) elif action == 'clearSources' : import universalscrapers universalscrapers.clear_cache() elif action == 'deleteFavourite' : favourites.deleteFavourite(meta, content) elif action == 'deleteProgress' : favourites.deleteProgress(meta, content) elif action == 'download': try : downloader.download(name, image, sources().sourcesResolve(json.loads(source)[0], True)) except: pass elif action == 'downloadNavigator' : navigator.navigator().downloads() elif action == 'episodePlaycount' : playcount.episodes(imdb, tvdb, season, episode, query) elif action == 'episodes' : episodes.episodes().get(tvshowtitle, year, imdb, tvdb, season, episode) elif action == 'episodeUserlists' : episodes.episodes().userlists() elif action == 'get_similar_movies' : movies.movies().get_similar_movies(imdb) elif action == 'get_similar_shows' : tvshows.tvshows().get_similar_shows(imdb) elif action == 'lists_navigator' : navigator.navigator().lists_navigator() elif action == 'movieCertificates' : movies.movies().certifications() elif action == 'movieFavourites' : movies.movies().favourites() elif action == 'movieGenres' : movies.movies().genres() elif action == 'movieLanguages' : movies.movies().languages() elif action == 'movielist' : navigator.navigator().mymovies() elif action == 'movieliteNavigator' : navigator.navigator().movies(lite=True) elif action == 'movieNavigator' : navigator.navigator().movies() elif action == 'moviePage' : movies.movies().get(url) elif action == 'moviePerson' : movies.movies().person(query) elif action == 'moviePersons' : movies.movies().persons() elif action == 'moviePlaycount' : playcount.movies(imdb, query) elif action == 'movieProgress' : movies.movies().in_progress() elif action == 'movies' : movies.movies().get(url) elif action == 'movieSearch' : movies.movies().search(query)
elif action == 'movieYears': from resources.lib.indexers import movies movies.movies().years(lang) elif action == 'movies': from resources.lib.indexers import movies movies.movies().get(url, provider=provider, lang=lang) elif action == 'movieSearch': from resources.lib.indexers import movies movies.movies().search(query, lang) elif action == 'tvshows': from resources.lib.indexers import tvshows tvshows.tvshows().get(url, provider=provider, network=name) elif action == 'seasons': from resources.lib.indexers import episodes episodes.seasons().get(tvshowtitle, year, imdb, tmdb, tvdb, tvrage) elif action == 'episodes': from resources.lib.indexers import episodes episodes.episodes().get(tvshowtitle, year, imdb, tmdb, tvdb, tvrage, season, episode,
def routing(_argv): params = dict(urllib_parse.parse_qsl(_argv.replace('?', ''))) action = params.get('action') name = params.get('name') title = params.get('title') year = params.get('year') imdb = params.get('imdb') tvdb = params.get('tvdb') tmdb = params.get('tmdb') season = params.get('season') episode = params.get('episode') tvshowtitle = params.get('tvshowtitle') premiered = params.get('premiered') url = params.get('url') image = params.get('image') meta = params.get('meta') select = params.get('select') query = params.get('query') source = params.get('source') content = params.get('content') status = params.get('status') rtype = params.get('rtype') windowedtrailer = params.get('windowedtrailer') windowedtrailer = int(windowedtrailer) if windowedtrailer in ('0', '1') else 0 if action == None: from resources.lib.indexers import navigator from resources.lib.modules import cache cache.cache_version_check() navigator.navigator().root() elif action == 'furkNavigator': from resources.lib.indexers import navigator navigator.navigator().furk() elif action == 'furkMetaSearch': from resources.lib.indexers import furk furk.furk().furk_meta_search(url) elif action == 'furkSearch': from resources.lib.indexers import furk furk.furk().search() elif action == 'furkUserFiles': from resources.lib.indexers import furk furk.furk().user_files() elif action == 'furkSearchNew': from resources.lib.indexers import furk furk.furk().search_new() elif action == 'movieNavigator': from resources.lib.indexers import navigator navigator.navigator().movies() elif action == 'movieliteNavigator': from resources.lib.indexers import navigator navigator.navigator().movies(lite=True) elif action == 'mymovieNavigator': from resources.lib.indexers import navigator navigator.navigator().mymovies() elif action == 'mymovieliteNavigator': from resources.lib.indexers import navigator navigator.navigator().mymovies(lite=True) elif action == 'tvNavigator': from resources.lib.indexers import navigator navigator.navigator().tvshows() elif action == 'tvliteNavigator': from resources.lib.indexers import navigator navigator.navigator().tvshows(lite=True) elif action == 'mytvNavigator': from resources.lib.indexers import navigator navigator.navigator().mytvshows() elif action == 'mytvliteNavigator': from resources.lib.indexers import navigator navigator.navigator().mytvshows(lite=True) elif action == 'downloadNavigator': from resources.lib.indexers import navigator navigator.navigator().downloads() elif action == 'libraryNavigator': from resources.lib.indexers import navigator navigator.navigator().library() elif action == 'toolNavigator': from resources.lib.indexers import navigator navigator.navigator().tools() elif action == 'searchNavigator': from resources.lib.indexers import navigator navigator.navigator().search() elif action == 'viewsNavigator': from resources.lib.indexers import navigator navigator.navigator().views() elif action == 'cacheNavigator': from resources.lib.indexers import navigator navigator.navigator().cache_functions() elif action == 'logNavigator': from resources.lib.indexers import navigator navigator.navigator().log_functions() elif action == 'clearCache': from resources.lib.indexers import navigator navigator.navigator().clearCache() elif action == 'clearCacheProviders': from resources.lib.indexers import navigator navigator.navigator().clearCacheProviders() elif action == 'clearDebridCheck': from resources.lib.indexers import navigator navigator.navigator().clearDebridCheck() elif action == 'clearCacheSearch': from resources.lib.indexers import navigator navigator.navigator().clearCacheSearch(select) elif action == 'clearAllCache': from resources.lib.indexers import navigator navigator.navigator().clearCacheAll() elif action == 'infoCheck': from resources.lib.indexers import navigator navigator.navigator().infoCheck('') elif action == 'uploadLog': from resources.lib.indexers import navigator navigator.navigator().uploadLog() elif action == 'emptyLog': from resources.lib.indexers import navigator navigator.navigator().emptyLog() elif action == 'viewLog': from resources.lib.modules import log_utils log_utils.view_log() elif action == 'movies': from resources.lib.indexers import movies movies.movies().get(url) elif action == 'moviePage': from resources.lib.indexers import movies movies.movies().get(url) elif action == 'movieWidget': from resources.lib.indexers import movies movies.movies().widget() elif action == 'movieSearch': from resources.lib.indexers import movies movies.movies().search() elif action == 'movieSearchnew': from resources.lib.indexers import movies movies.movies().search_new() elif action == 'movieSearchterm': from resources.lib.indexers import movies movies.movies().search_term(name) elif action == 'movieMosts': from resources.lib.indexers import movies movies.movies().mosts() elif action == 'movieGenres': from resources.lib.indexers import movies movies.movies().genres() elif action == 'movieLanguages': from resources.lib.indexers import movies movies.movies().languages() elif action == 'movieCertificates': from resources.lib.indexers import movies movies.movies().certifications() elif action == 'movieYears': from resources.lib.indexers import movies movies.movies().years() elif action == 'movieDecades': from resources.lib.indexers import movies movies.movies().decades() elif action == 'movieKeywords': from resources.lib.indexers import movies movies.movies().keywords() elif action == 'movieKeywords2': from resources.lib.indexers import movies movies.movies().keywords2() elif action == 'movieCustomLists': from resources.lib.indexers import movies movies.movies().custom_lists() elif action == 'movieUserlists': from resources.lib.indexers import movies movies.movies().userlists() elif action == 'channels': from resources.lib.indexers import channels channels.channels().get() elif action == 'tvshows': from resources.lib.indexers import tvshows tvshows.tvshows().get(url) elif action == 'tvshowPage': from resources.lib.indexers import tvshows tvshows.tvshows().get(url) elif action == 'tvSearch': from resources.lib.indexers import tvshows tvshows.tvshows().search() elif action == 'tvSearchnew': from resources.lib.indexers import tvshows tvshows.tvshows().search_new() elif action == 'tvSearchterm': from resources.lib.indexers import tvshows tvshows.tvshows().search_term(name) elif action == 'tvMosts': from resources.lib.indexers import tvshows tvshows.tvshows().mosts() elif action == 'tvGenres': from resources.lib.indexers import tvshows tvshows.tvshows().genres() elif action == 'tvNetworks': from resources.lib.indexers import tvshows tvshows.tvshows().networks() elif action == 'tvLanguages': from resources.lib.indexers import tvshows tvshows.tvshows().languages() elif action == 'tvCertificates': from resources.lib.indexers import tvshows tvshows.tvshows().certifications() elif action == 'tvUserlists': from resources.lib.indexers import tvshows tvshows.tvshows().userlists() elif action == 'peopleSearch': from resources.lib.indexers import people people.People().search(content) elif action == 'peopleSearchnew': from resources.lib.indexers import people people.People().search_new(content) elif action == 'peopleSearchterm': from resources.lib.indexers import people people.People().search_term(name, content) elif action == 'persons': from resources.lib.indexers import people people.People().persons(url, content) elif action == 'moviePerson': from resources.lib.indexers import people people.People().persons(url, content='movies') elif action == 'tvPerson': from resources.lib.indexers import people people.People().persons(url, content='tvshows') elif action == 'personsSelect': from resources.lib.indexers import people people.People().getPeople(name, url) elif action == 'seasons': from resources.lib.indexers import episodes episodes.seasons().get(tvshowtitle, year, imdb, tmdb, meta) elif action == 'episodes': from resources.lib.indexers import episodes episodes.episodes().get(tvshowtitle, year, imdb, tmdb, meta, season, episode) elif action == 'calendar': from resources.lib.indexers import episodes episodes.episodes().calendar(url) 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 views.addView(content) elif action == 'moviePlaycount': from resources.lib.modules import playcount playcount.movies(imdb, query) elif action == 'episodePlaycount': from resources.lib.modules import playcount playcount.episodes(imdb, tmdb, season, episode, query) elif action == 'tvPlaycount': from resources.lib.modules import playcount playcount.tvshows(name, imdb, tmdb, season, query) elif action == 'yt_trailer': from resources.lib.modules import control, trailer if not control.condVisibility('System.HasAddon(plugin.video.youtube)'): control.installAddon('plugin.video.youtube') trailer.YT_trailer().play(name, url, tmdb, imdb, season, episode, windowedtrailer) elif action == 'tmdb_trailer': from resources.lib.modules import control, trailer if not control.condVisibility('System.HasAddon(plugin.video.youtube)'): control.installAddon('plugin.video.youtube') trailer.TMDb_trailer().play(tmdb, imdb, season, episode, windowedtrailer) elif action == 'imdb_trailer': from resources.lib.modules import trailer trailer.IMDb_trailer().play(imdb, name, tmdb, season, episode, windowedtrailer) elif action == 'traktManager': from resources.lib.modules import trakt trakt.manager(name, imdb, tmdb, content) elif action == 'authTrakt': from resources.lib.modules import trakt trakt.authTrakt() elif action == 'smuSettings': try: import resolveurl resolveurl.display_settings() except: pass elif action == 'oathscrapersettings': from resources.lib.modules import control control.openSettings('0.0', 'script.module.oathscrapers') elif action == 'installOrion': from resources.lib.modules import control control.installAddon('script.module.orion') control.sleep(200) control.refresh() elif action == 'orionsettings': from resources.lib.modules import control control.openSettings('0.0', 'script.module.orion') elif action == 'download': import simplejson as json from resources.lib.modules import sources from resources.lib.modules import downloader try: downloader.download( name, image, sources.sources().sourcesResolve(json.loads(source)[0], True)) except: pass elif action == 'play': from resources.lib.modules import control control.busy() from resources.lib.modules import sources sources.sources().play(title, year, imdb, tmdb, season, episode, tvshowtitle, premiered, meta, select, unfiltered=False) elif action == 'playUnfiltered': from resources.lib.modules import control control.busy() from resources.lib.modules import sources sources.sources().play(title, year, imdb, tmdb, season, episode, tvshowtitle, premiered, meta, select, unfiltered=True) elif action == 'addItem': from resources.lib.modules import sources sources.sources().addItem(title) elif action == 'playItem': from resources.lib.modules import sources sources.sources().playItem(title, source) elif action == 'alterSources': from resources.lib.modules import sources sources.sources().alterSources(url, meta) elif action == 'clearSources': from resources.lib.modules import sources sources.sources().clearSources() elif action == 'random': from sys import argv if rtype == 'movie': from resources.lib.indexers import movies rlist = movies.movies().get(url, create_directory=False) r = argv[0] + '?action=play' elif rtype == 'episode': from resources.lib.indexers import episodes rlist = episodes.episodes().get(tvshowtitle, year, imdb, tmdb, meta, season, create_directory=False) r = argv[0] + '?action=play' elif rtype == 'season': from resources.lib.indexers import episodes rlist = episodes.seasons().get(tvshowtitle, year, imdb, tmdb, None, create_directory=False) r = argv[0] + '?action=random&rtype=episode' elif rtype == 'show': from resources.lib.indexers import tvshows rlist = tvshows.tvshows().get(url, create_directory=False) r = argv[0] + '?action=random&rtype=season' from random import randint import simplejson as json try: from resources.lib.modules import control rand = randint(1, len(rlist)) - 1 for p in [ 'title', 'year', 'imdb', 'tmdb', 'season', 'episode', 'tvshowtitle', 'premiered', 'select' ]: if rtype == 'show' and p == 'tvshowtitle': try: r += '&' + p + '=' + urllib_parse.quote_plus( rlist[rand]['title']) except: pass else: if rtype == 'movie': rlist[rand]['title'] = rlist[rand]['originaltitle'] elif rtype == 'episode': rlist[rand]['tvshowtitle'] = urllib_parse.unquote_plus( rlist[rand]['tvshowtitle']) try: r += '&' + p + '=' + urllib_parse.quote_plus( rlist[rand][p]) except: pass try: r += '&meta=' + urllib_parse.quote_plus(json.dumps( rlist[rand])) except: r += '&meta={}' if rtype == 'movie': try: control.infoDialog( '%s (%s)' % (rlist[rand]['title'], rlist[rand]['year']), control.lang(32536), time=20000) except: pass elif rtype == 'episode': try: control.infoDialog( '%s - %01dx%02d . %s' % (urllib_parse.unquote_plus(rlist[rand]['tvshowtitle']), int(rlist[rand]['season']), int( rlist[rand]['episode']), rlist[rand]['title']), control.lang(32536), time=20000) except: pass control.execute('RunPlugin(%s)' % r) except: from resources.lib.modules import control control.infoDialog(control.lang(32537), time=8000) elif action == 'movieToLibrary': from resources.lib.modules import libtools libtools.libmovies().add(name, title, year, imdb, tmdb) elif action == 'moviesToLibrary': from resources.lib.modules import libtools libtools.libmovies().range(url) elif action == 'moviesToLibrarySilent': from resources.lib.modules import libtools libtools.libmovies().silent(url) elif action == 'tvshowToLibrary': from resources.lib.modules import libtools libtools.libtvshows().add(tvshowtitle, year, imdb, tmdb) elif action == 'tvshowsToLibrary': from resources.lib.modules import libtools libtools.libtvshows().range(url) elif action == 'tvshowsToLibrarySilent': from resources.lib.modules import libtools libtools.libtvshows().silent(url) elif action == 'updateLibrary': from resources.lib.modules import libtools libtools.libepisodes().update(query) elif action == 'service': from resources.lib.modules import libtools libtools.libepisodes().service() elif action == 'syncTraktStatus': from resources.lib.modules import trakt trakt.syncTraktStatus() elif action == 'changelog': from resources.lib.modules import changelog changelog.get() elif action == 'cleanSettings': from resources.lib.modules import control control.clean_settings() elif action == 'tvcredits': from resources.lib.modules import credits credits.Credits().get_tv(tmdb, status) elif action == 'moviecredits': from resources.lib.modules import credits credits.Credits().get_movies(tmdb, status)
for name in dirs: try: os.rmdir(os.path.join(root, name)) os.rmdir(root) except: pass time.sleep(3) except: pass premiumize.library_service() elif action == 'tvdbFav': from resources.lib.indexers import tvshows tvshows.tvshows().getTvdbFav() elif action == 'tvdbAdd': from resources.lib.api import tvdbapi tvdbapi.addTvShow(tvshowtitle, tvdb) elif action == 'tvdbRemove': from resources.lib.api import tvdbapi tvdbapi.removeTvShow(tvdb) elif action == 'AuthorizeTvdb': from resources.lib.api import tvdbapi tvdbapi.forceToken() elif action == 'updateAddon': from resources.lib.modules import updater
elif action == 'moviePersons': from resources.lib.indexers import movies movies.movies(type = type, kids = kids).persons(url) elif action == 'movieUserlists': from resources.lib.indexers import movies movies.movies(type = type, kids = kids).userlists(mode = params.get('mode')) elif action == 'channels': from resources.lib.indexers import channels channels.channels(type = type, kids = kids).get() elif action == 'tvshows': from resources.lib.indexers import tvshows tvshows.tvshows(type = type, kids = kids).get(url) elif action == 'tvshowPage': from resources.lib.indexers import tvshows tvshows.tvshows(type = type, kids = kids).get(url) elif action == 'tvSearch': from resources.lib.indexers import tvshows tvshows.tvshows(type = type, kids = kids).search(params.get('terms')) elif action == 'tvPerson': from resources.lib.indexers import tvshows tvshows.tvshows(type = type, kids = kids).person(params.get('terms')) elif action == 'tvGenres': from resources.lib.indexers import tvshows
elif action == 'toptvNavigator': from resources.lib.indexers import navigator navigator.navigator().toptvshows() elif action == 'Birthsigns': from resources.lib.indexers import navigator navigator.navigator().Birthsigns() if action == 'HRmovieNavigator': from resources.lib.indexers import navigator navigator.navigator().HRrated() elif action == 'tvusNetworks': from resources.lib.indexers import tvshows tvshows.tvshows().networks() if action == 'networks2Navigator': from resources.lib.indexers import navigator navigator.navigator().networks2() if action == 'networks2tvNavigator': from resources.lib.indexers import navigator navigator.navigator().networks2tv() if action == 'bottommoviesNavigator': from resources.lib.indexers import navigator navigator.navigator().bottommovies(url) elif action == 'Aquarius':
name, image, sources().sourcesResolve(json.loads(source)[0], True)) except: pass elif action == 'downloadNavigator': navigator.navigator().downloads() elif action == 'episodePlaycount': playcount.episodes(imdb, tvdb, season, episode, query) elif action == 'episodes': episodes.episodes().get(tvshowtitle, year, imdb, tvdb, season, episode) elif action == 'episodeUserlists': episodes.episodes().userlists() elif action == 'get_similar_movies': movies.movies().get_similar_movies(imdb) elif action == 'get_similar_shows': tvshows.tvshows().get_similar_shows(imdb) elif action == 'lists_navigator': navigator.navigator().lists_navigator() elif action == 'movieCertificates': movies.movies().certifications() elif action == 'movieFavourites': movies.movies().favourites() elif action == 'movieGenres': movies.movies().genres() elif action == 'movieLanguages': movies.movies().languages() elif action == 'movielist': navigator.navigator().mymovies() elif action == 'movieliteNavigator': navigator.navigator().movies(lite=True) elif action == 'movieNavigator':
elif action == 'tmdbLists': from resources.lib.indexers import navigator navigator.navigator().tmdbLists() elif action == 'myimdbMovieLists': from resources.lib.indexers import movies movies.movies().my_imdbUserLists() elif action == 'mytmdbMovieLists': from resources.lib.indexers import movies2 movies2.movies().my_tmdbUserLists() elif action == 'myimdbTvLists': from resources.lib.indexers import tvshows tvshows.tvshows().my_imdbUserLists() elif action == 'mytmdbTvLists': from resources.lib.indexers import tvshows2 tvshows2.tvshows().my_tmdbUserLists() elif action == 'hellaLifeTimeHallMark': from resources.lib.indexers import movies movies.movies().hellaLifeTimeHallMark() elif action == 'tmdbUserLists': from resources.lib.indexers import tvshows2 tvshows2.tvshows().tmdbUserLists() elif action == 'tmdbActorCollections': from resources.lib.indexers import movies2
elif action == 'movieLanguages': from resources.lib.indexers import movies movies.movies().languages() elif action == 'movieCertificates': from resources.lib.indexers import movies movies.movies().certifications() elif action == 'animemovyears': from resources.lib.indexers import movies movies.movies().animeyears() elif action == 'animetvyears': from resources.lib.indexers import tvshows tvshows.tvshows().animeyears() elif action == 'tvanimecertifications': from resources.lib.indexers import tvshows tvshows.tvshows().animecertifications() elif action == 'movieanimecertifications': from resources.lib.indexers import movies movies.movies().animecertifications() elif action == 'movieYears': from resources.lib.indexers import movies movies.movies().years() elif action == 'tvYears': from resources.lib.indexers import tvshows
elif action == 'movieSearch': from resources.lib.indexers import movies movies.movies().search(query) elif action == 'movieGenres': from resources.lib.indexers import movies movies.movies().genres() elif action == 'movieUserlists': from resources.lib.indexers import movies movies.movies().userlists() elif action == 'tvFavourites': from resources.lib.indexers import tvshows tvshows.tvshows().favourites() elif action == 'tvSearch': from resources.lib.indexers import tvshows tvshows.tvshows().search(query) elif action == 'tvPerson': from resources.lib.indexers import tvshows tvshows.tvshows().person(query) elif action == 'tvGenres': from resources.lib.indexers import tvshows tvshows.tvshows().genres() elif action == 'tvNetworks': from resources.lib.indexers import tvshows
elif action == 'moviePersons': from resources.lib.indexers import movies movies.movies().persons() elif action == 'movieUserlists': from resources.lib.indexers import movies movies.movies().userlists() elif action == 'channels': from resources.lib.indexers import channels channels.channels().get() elif action == 'tvshows': from resources.lib.indexers import tvshows tvshows.tvshows().get(url) elif action == 'similar_shows': from resources.lib.indexers import tvshows tvshows.tvshows().similar_shows(imdb) elif action == 'get_similar_shows': from resources.lib.indexers import tvshows tvshows.tvshows().get_similar_shows(imdb) elif action == 'tvshowPage': from resources.lib.indexers import tvshows tvshows.tvshows().get(url) elif action == 'tvSearch': from resources.lib.indexers import tvshows
elif action == 'movieYears': from resources.lib.indexers import movies movies.movies().years(lang) elif action == 'movies': from resources.lib.indexers import movies movies.movies().get(url, provider=provider, lang=lang) elif action == 'movieSearch': from resources.lib.indexers import movies movies.movies().search(query, lang) elif action == 'tvshows': from resources.lib.indexers import tvshows tvshows.tvshows().get(url, provider=provider, network=name) elif action == 'seasons': from resources.lib.indexers import episodes episodes.seasons().get(tvshowtitle, year, imdb, tmdb, tvdb, tvrage) elif action == 'episodes': from resources.lib.indexers import episodes episodes.episodes().get(tvshowtitle, year, imdb, tmdb, tvdb, tvrage, season, episode, provider=provider, url=url) elif action == 'sources': from resources.lib.sources import sources sources().addItem(name, title, year, imdb, tmdb, tvdb, tvrage, season, episode, tvshowtitle, alter, date, meta) elif action == 'download': import json
elif action == 'movieYears': from resources.lib.indexers import movies movies.movies().years() elif action == 'moviePersons': from resources.lib.indexers import movies movies.movies().persons(url) elif action == 'movieUserlists': from resources.lib.indexers import movies movies.movies().userlists() elif action == 'tvshows': from resources.lib.indexers import tvshows tvshows.tvshows().get(url) elif action == 'tvshowPage': from resources.lib.indexers import tvshows tvshows.tvshows().get(url) elif action == 'tvSearch': from resources.lib.indexers import tvshows tvshows.tvshows().search() elif action == 'tvSearchnew': from resources.lib.indexers import tvshows tvshows.tvshows().search_new() elif action == 'tvSearchterm': from resources.lib.indexers import tvshows
elif action == 'moviePersons': from resources.lib.indexers import movies movies.movies().persons() elif action == 'movieUserlists': from resources.lib.indexers import movies movies.movies().userlists() elif action == 'channels': from resources.lib.indexers import channels channels.channels().get() elif action == 'tvshows': from resources.lib.indexers import tvshows tvshows.tvshows().get(url) elif action == 'tvshowPage': from resources.lib.indexers import tvshows tvshows.tvshows().get(url) elif action == 'tvSearch': from resources.lib.indexers import tvshows tvshows.tvshows().search(query) elif action == 'tvPerson': from resources.lib.indexers import tvshows tvshows.tvshows().person(query) elif action == 'tvGenres': from resources.lib.indexers import tvshows
def getFolder(id, meta=None, list=False): from resources.lib.indexers import movies, tvshows try: if id == 'root': url = urlparse.urljoin(premiumize_Api, premiumizeRootFolder) else: folder = premiumizeFolder + id url = urlparse.urljoin(premiumize_Api, folder) r = reqJson(url) r = r['content'] lists = [] for result in r: cm = [] season = '0' isMovie = True isFullShow = False artMeta = False type = result['type'] fileLabel = type id = result['id'] name = result['name'].encode('utf-8') name = normalize(name) superInfo = {'title': name, 'year':'0', 'imdb':'0'} # RETURN LIST FOR BROWSE SECTION if list==True: lists.append(name) continue # ################################## try: if meta != None and meta != '': raise Exception() try: if control.setting('tvshows.meta') != 'true': raise Exception() sxe_pattern = '(.+?)[._ -]season[._ -]([0-9]+)' sxe_pattern2 = '(.*?)[._ -]s(\d{1,2})[._ -ex]' sxe_pattern3 = '{._ -\[}TV{._ -\]}(.*?)\((\d{4})\)' matchSeason = re.search(sxe_pattern, name.lower()) matchSeason2 = re.search(sxe_pattern2, name.lower()) matchShow = re.compile('\[TV\]\s*(.*?)\((\d{4})\)').findall(name) if matchShow: isFullShow = True title = matchShow[0][0] year = matchShow[0][1] isMovie = False elif matchSeason: title, season = matchSeason.groups() isMovie = False elif matchSeason2: title, season = matchSeason2.groups() isMovie = False except: pass try: if control.setting('movies.meta') != 'true': raise Exception() if isMovie == True: cleanName = cleantitle_get(name) patternFull = '(.*?)[._ -](\d{4})?(?:[._ -]\d+[pP])' pattern = '(.*?)(\d{4}).*' match = re.search(patternFull, cleanName, re.I) match2 = re.search(pattern, cleanName) if match: isMovie = True title, year = match.groups() elif match2: isMovie = True title, year = match2.groups() except: pass title = cleantitle.query(title.encode('utf-8')) systitle = urllib.quote_plus(title) if isMovie == True: getSearch = movies.movies().getSearch(title=systitle) metaData = [i for i in getSearch if cleantitle.get(title) == cleantitle.get(i['title']) and i['year'] == year] else: if isFullShow == True: getSearch = tvshows.tvshows().getSearch(title=systitle) metaData = [i for i in getSearch if cleantitle.get(title) == cleantitle.get(i['title']) and year == i['year']] else: getSearch = tvshows.tvshows().getSearch(title=systitle) metaData = [i for i in getSearch if cleantitle.get(name).startswith(cleantitle.get(i['title']))] metaData = metaData[0] metarating = metaData['rating'] if 'rating' in metaData else '0' metavotes = metaData['votes'] if 'votes' in metaData else '0' metatitle = metaData['title'] if 'title' in metaData else '0' metayear = metaData['year'] if 'year' in metaData else '0' metaposter = metaData['poster'] if 'poster' in metaData else '0' metaplot = metaData['plot'] if 'plot' in metaData else '0' metafanart = metaData['fanart'] if 'fanart' in metaData else '0' if metaposter == '0' or metaposter == None: metaposter = control.icon if metafanart == '0' or metafanart == None: metafanart = control.fanart metagenre = metaData['genre'] if 'genre' in metaData else '0' metaimdb = metaData['imdb'] if 'imdb' in metaData else '0' metatvdb = metaData['tvdb'] if 'tvdb' in metaData else '0' metaduration = metaData['duration'] if 'duration' in metaData else '0' superInfo = {'title': metaData['title'], 'genre': metagenre, 'year': metayear, 'poster': metaposter, 'tvdb': metatvdb, 'imdb': metaimdb, 'fanart': metafanart, 'plot': metaplot, 'rating':metarating, 'duration':metaduration} artMeta = True except: pass #print ("PREMIUMIZER FOLDER 1", superInfo) playLink = '0' isFolder = True isPlayable = 'false' if meta != None and meta != '': artMeta = True items = json.loads(str(meta)) superInfo = {'title': items['title'], 'genre': items['genre'], 'year': items['year'], 'poster': items['poster'], 'imdb': items['imdb'], 'fanart': items['fanart'], 'plot':items['plot'], 'rating':items['rating'], 'duration':items['duration']} url = '%s?action=%s&id=%s' % (sysaddon, 'premiumizeOpenFolder', id) sysmeta = urllib.quote_plus(json.dumps(superInfo)) year = superInfo['year'] imdb = superInfo['imdb'] systitle = urllib.quote_plus(superInfo['title']) if artMeta == True: if isMovie == False: cm.append(('Browse Cloud Folder', 'Container.Update(%s)' % (url))) url = '%s?action=episodes&tvshowtitle=%s&year=%s&imdb=%s&tvdb=%s&season=%s' % (sysaddon, superInfo['title'], superInfo['year'], superInfo['imdb'], superInfo['tvdb'], season) cm.append(('Delete from Cloud', 'RunPlugin(%s?action=premiumizeDeleteItem&id=%s&type=%s)' % (sysaddon, id, type))) cm.append(('Rename Item', 'RunPlugin(%s?action=premiumizeRename&id=%s&type=%s&title=%s)' % (sysaddon, id, type, name))) links = [] if type == 'file': if control.setting('transcoded.play') == 'true': try: playLink = result['stream_link'] if not "http" in playLink: playLink = result['link'] type = 'TRANSCODED' except: playLink = result['link'] else: playLink = result['link'] ext = playLink.split('.')[-1] if not ext.lower() in VALID_EXT: continue fileLabel = type + " " + str(ext) try: size = result['size'] size = getSize(size) except: size = '' if size != '': fileLabel = fileLabel + " | " + str(size) isFolder = False isPlayable = 'true' try: playLink = urllib.quote_plus(playLink) except: pass url = '%s?action=directPlay&url=%s&title=%s&year=%s&imdb=%s&meta=%s&id=%s' % (sysaddon, playLink, systitle , year, imdb, sysmeta, id) if control.setting('downloads') == 'true': cm.append(('Download from Cloud', 'RunPlugin(%s?action=download&name=%s&url=%s)' % (sysaddon, name, url))) label = "[B]" + fileLabel.upper() + " |[/B] " + str(name) item = control.item(label=label) item.setProperty('IsPlayable', isPlayable) cm.append(('Add To Library', 'RunPlugin(%s?action=addToLibrary&id=%s&type=%s&name=%s)' % (sysaddon, id, type, name))) if artMeta == True: item.setProperty('Fanart_Image', superInfo['fanart']) item.setArt({'icon': superInfo['poster'], 'thumb': superInfo['poster']}) else: item.setArt({'icon': control.icon, 'thumb': control.icon}) item.setProperty('Fanart_Image', control.addonFanart()) item.setInfo(type='Video', infoLabels = superInfo) item.addContextMenuItems(cm) if list != True: control.addItem(handle=syshandle, url=url, listitem=item, isFolder=isFolder) if list == True: return lists control.directory(syshandle, cacheToDisc=False) except: pass
elif action == 'moviePersons': from resources.lib.indexers import movies movies.movies().persons() elif action == 'movieUserlists': from resources.lib.indexers import movies movies.movies().userlists() elif action == 'channels': from resources.lib.indexers import channels channels.channels().get() elif action == 'tvshows': from resources.lib.indexers import tvshows tvshows.tvshows().get(url) elif action == 'tvFavourites': from resources.lib.indexers import tvshows tvshows.tvshows().favourites() elif action == 'tvSearch': from resources.lib.indexers import tvshows tvshows.tvshows().search(query) elif action == 'tvPerson': from resources.lib.indexers import tvshows tvshows.tvshows().person(query) elif action == 'tvGenres': from resources.lib.indexers import tvshows
def _televisionAddMultiple(self, link): from resources.lib.indexers import tvshows from resources.lib.indexers import episodes interface.Loader.hide() count = -1 if interface.Dialog.option(title=33244, message=35179): count = 0 if self._ready(): interface.Dialog.notification( title=33244, message=35177, icon=interface.Dialog.IconInformation, time=100000000) self.mDialog = True items = None try: instance = tvshows.tvshows(type=self.mType, kids=self.mKids, notifications=False) try: function = getattr(instance, link) if not function or not callable(function): raise Exception() items = function() except: items = instance.get(link, idx=False) except: pass if not items or len(items) == 0: instance = episodes.episodes(type=self.mType, kids=self.mKids, notifications=False) try: function = getattr(instance, link) if not function or not callable(function): raise Exception() items = function() except: items = instance.calendar(link) if items == None: items = [] from resources.lib.indexers import seasons itemsEpisodes = [] threads = [] lock = threading.Lock() def resolveSeason(title, year, imdb, tvdb): result = episodes.episodes(type=self.mType, kids=self.mKids, notifications=False).get( title, year, imdb, tvdb) lock.acquire() itemsEpisodes.extend(result) lock.release() for i in items: if 'season' in i: itemsEpisodes.append(i) else: threads.append( threading.Thread( target=resolveSeason, args=(i['tvshowtitle'] if 'tvshowtitle' in i else i['title'], i['year'], i['imdb'], i['tvdb']))) [i.start() for i in threads] [i.join() for i in threads] for i in itemsEpisodes: try: if tools.System.aborted(): return sys.exit() value = self._televisionAddSingle( title=i['tvshowtitle'] if 'tvshowtitle' in i else i['title'], year=i['year'], season=i['season'], episode=i['episode'], imdb=i['imdb'], tvdb=i['tvdb'], metadata=i, multiple=True) if value > 0: count += value except: pass return count
elif action == 'moviePersons': from resources.lib.indexers import movies movies.movies().persons() elif action == 'movieUserlists': from resources.lib.indexers import movies movies.movies().userlists() elif action == 'channels': from resources.lib.indexers import channels channels.channels().get() elif action == 'tvshows': from resources.lib.indexers import tvshows tvshows.tvshows().get(url) elif action == 'tvFavourites': from resources.lib.indexers import tvshows tvshows.tvshows().favourites() elif action == 'tvSearch': from resources.lib.indexers import tvshows tvshows.tvshows().search(query) elif action == 'tvSearchHistory': from resources.lib.indexers import tvshows tvshows.tvshows().search_from_history() elif action == 'tvPerson': from resources.lib.indexers import tvshows