def ListCont(): import tv mov = False showonly = False rvalue = 'distinct *' url = common.args.url if 'movie' in url: mov = True if common.addon.getSetting('disptvshow') == 'true': showonly = True rvalue = 'seriesasin' asins = common.SCRAP_ASINS(url) if not asins: common.SetView('movies') return asinlist = [] for value in asins: ret = 0 if mov: ret = listmovie.LIST_MOVIES('asin', value, search=True, cmmode=1) if ret == 0 and not mov: for seasondata in tv.lookupTVdb(value, tbl='seasons', rvalue=rvalue, single=False): if not seasondata: continue if showonly: ret = 0 value = seasondata[0] for asin in tv.lookupTVdb(value, tbl='shows', rvalue='asin').split(','): if asin in asinlist: ret = 1 else: ret = 1 listtv.ADD_SEASON_ITEM(seasondata, disptitle=True, cmmode=1) if ret == 0 and not mov: listtv.LIST_TVSHOWS('asin', value, search=True, cmmode=1) asinlist.append(value) if mov: common.SetView('movies') else: common.SetView('tvshows')
def LIST_MOVIES(filter='', value=False, sortcol=False, sortaz=True, search=False, cmmode=0, export=False): import movies as moviesDB if 'year' in filter: value = value.replace('0 -', '') movies = moviesDB.loadMoviedb(filter=filter, value=value, sortcol=sortcol) count = 0 for moviedata in movies: count += 1 ADD_MOVIE_ITEM(moviedata, cmmode=cmmode, export=export) if not search: if sortaz: if not 'year' in filter: xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_VIDEO_TITLE) xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_VIDEO_YEAR) xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_VIDEO_RUNTIME) xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_VIDEO_RATING) xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_DURATION) xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_STUDIO_IGNORE_THE) common.SetView('movies', 'movieview') return count
def LIST_TVSHOWS(filter='', value=False, sortcol=False, sortaz=True, search=False, cmmode=0): import tv as tvDB if 'year' in filter: value = value.replace('0 -', '') shows = tvDB.loadTVShowdb(filter=filter, value=value, sortcol=sortcol) count = 0 for showdata in shows: count += 1 ADD_SHOW_ITEM(showdata, cmmode=cmmode) if not search: if sortaz: if 'year' not in filter: xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL) xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_VIDEO_YEAR) xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_VIDEO_RATING) xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_STUDIO_IGNORE_THE) common.SetView('tvshows') return count
def LIST_TVSEASON_SORTED(seasons=False, cmmode=0): import tv as tvDB if not seasons: seasons = tvDB.loadTVSeasonsdb(sortcol=common.args.url).fetchall() for seasondata in seasons: ADD_SEASON_ITEM(seasondata, disptitle=True, cmmode=cmmode) common.SetView('seasons')
def LIST_TVSHOWS_CATS(): import tv as tvDB id = common.args.url if id: asins = tvDB.lookupTVdb(id, rvalue='asins', name='title', tbl='categories') epidb = tvDB.lookupTVdb('', name='asin', rvalue='asin, seasonasin', tbl='episodes', single=False) if not asins: return for asin in asins.split(','): seasonasin = None for epidata in epidb: if asin in str(epidata): seasonasin = epidata[1] break if not seasonasin: seasonasin = asin for seasondata in tvDB.loadTVSeasonsdb( seasonasin=seasonasin).fetchall(): ADD_SEASON_ITEM(seasondata, disptitle=True) common.SetView('tvshows', 'seasonview') del epidb else: for title in tvDB.lookupTVdb('', name='asins', tbl='categories', single=False): if title: common.addDir(title[0], 'listtv', 'LIST_TVSHOWS_CATS', title[0]) xbmcplugin.endOfDirectory(pluginhandle, updateListing=False)
def getSimilarities(): import tv data = getList(NumberOfResults=250,catalog='GetSimilarities',asin=common.args.asin) for title in data['message']['body']['titles']: asin = title['titleId'] if not listmovie.LIST_MOVIES('asin', asin, search=True): for seasondata in tv.lookupTVdb(asin, tbl='seasons', single=False): if seasondata: listtv.ADD_SEASON_ITEM(seasondata, disptitle=True) common.SetView('tvshows', 'showview')
def LIST_TV_SEASONS(seasons=False): seriesasin = common.args.url import tv as tvDB for asin in seriesasin.split(','): seasons = tvDB.loadTVSeasonsdb(seriesasin=asin).fetchall() for seasondata in seasons: ADD_SEASON_ITEM(seasondata) xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL) common.SetView('seasons')
def LIST_EPISODES_DB(owned=False, url=False): if not url: seriestitle = common.args.url import tv as tvDB for asin in seriestitle.split(','): episodes = tvDB.loadTVEpisodesdb(asin) for episodedata in episodes: ADD_EPISODE_ITEM(episodedata) xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL) common.SetView('episodes', 'episodeview')
def ListCont(export=False): import tv mov = False showonly = False rvalue = 'distinct *' if export: url = export export = True else: url = common.args.url if 'movie' in url: mov = True if common.addon.getSetting('disptvshow') == 'true': showonly = True rvalue = 'seriesasin' asins = common.SCRAP_ASINS(url) if not asins: xbmcgui.Dialog().notification(common.__plugin__, common.getString(30199), sound = False) return asinlist = [] for value in asins: ret = 0 if mov: ret = listmovie.LIST_MOVIES('asin', value, search=True, cmmode=1, export=export) if ret == 0 and not mov: for seasondata in tv.lookupTVdb(value, tbl='seasons', rvalue=rvalue, single=False): if seasondata: if showonly: ret = 0 value = seasondata[0] for asin in tv.lookupTVdb(value, tbl='shows', rvalue='asin').split(','): if asin in asinlist: ret = 1 else: ret = 1 listtv.ADD_SEASON_ITEM(seasondata, disptitle=True, cmmode=1, export=export) if ret == 0 and not mov: listtv.LIST_TVSHOWS('asin', value, search=True, cmmode=1, export=export) asinlist.append(value) if not export: if mov: common.SetView('movies', 'movieview') else: common.SetView('tvshows', 'showview')
def SEARCH_DB(searchString=False): if not searchString: keyboard = xbmc.Keyboard('') keyboard.doModal() q = keyboard.getText() if (keyboard.isConfirmed()): searchString=keyboard.getText() if searchString <> '': common.addText(' ----=== ' + common.getString(30104) + ' ===----') if not listmovie.LIST_MOVIES('movietitle', searchString, search=True): common.addText(common.getString(30202)) common.addText(' ----=== ' + common.getString(30107) + ' ===----') if not listtv.LIST_TVSHOWS('seriestitle', searchString, search=True): common.addText(common.getString(30202)) common.SetView('tvshows', 'showview')
def LIST_MOVIES_CATS(): import movies as moviesDB id = common.args.url if id: asins = moviesDB.lookupMoviedb(id, rvalue='asins', name='title', table='categories') for asin in asins.split(','): LIST_MOVIES('asin', asin, search=True) common.SetView('movies', 'movieview') else: for title in moviesDB.lookupMoviedb('', name='asins', table='categories', single=False): if title: common.addDir(title[0], 'listmovie', 'LIST_MOVIES_CATS', title[0]) xbmcplugin.endOfDirectory(pluginhandle, updateListing=False)