def LIST_TVSHOWS_TYPES(type=False): import tv as tvDB if not type: type = common.args.url if type == 'GENRE': mode = 'LIST_TVSHOWS_GENRE_FILTERED' items = tvDB.getShowTypes('genres') elif type == 'NETWORKS': mode = 'LIST_TVSHOWS_NETWORKS_FILTERED' items = tvDB.getShowTypes('network') elif type == 'YEARS': mode = 'LIST_TVSHOWS_YEARS_FILTERED' items = tvDB.getShowTypes('year') elif type == 'MPAA': mode = 'LIST_TVSHOWS_MPAA_FILTERED' items = tvDB.getShowTypes('mpaa') elif type == 'CREATORS': mode = 'LIST_TVSHOWS_CREATORS_FILTERED' items = tvDB.getShowTypes('creator') for item in items: export_mode = mode + '_EXPORT' cm = [( 'Export to Library', 'XBMC.RunPlugin(plugin://plugin.video.amazon?mode="listtv"&sitemode="%s"&url="%s")' % (export_mode, urllib.quote_plus(item)))] common.addDir(item, 'listtv', mode, item, cm=cm) xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL) xbmcplugin.endOfDirectory(pluginhandle, updateListing=False)
def modes(): if sys.argv[2]=='': common.Log('Version: %s' % common.__version__) common.Log('Unicode support: %s' % common.os.path.supports_unicode_filenames) cm_watchlist = [(common.getString(30185) % 'Watchlist', 'XBMC.RunPlugin(%s?mode=<appfeed>&sitemode=<ExportList>&url=<%s>)' % (sys.argv[0], common.wl) )] cm_library = [(common.getString(30185) % common.getString(30060), 'XBMC.RunPlugin(%s?mode=<appfeed>&sitemode=<ExportList>&url=<%s>)' % (sys.argv[0], common.lib) ), (common.getString(30116), 'XBMC.RunPlugin(%s?mode=<appfeed>&sitemode=<RefreshList>&url=<%s>)' % (sys.argv[0], common.lib) )] common.addDir('Watchlist','appfeed','ListMenu', common.wl, cm=cm_watchlist) updatemovie = [] updatemovie.append( (common.getString(30103), 'XBMC.RunPlugin(%s?mode=<appfeed>&sitemode=<updateAll>)' % sys.argv[0] ) ) updatemovie.append( (common.getString(30102), 'XBMC.RunPlugin(%s?mode=<movies>&sitemode=<addMoviesdb>&url=<f>)' % sys.argv[0] ) ) common.addDir(common.getString(30104),'listmovie','LIST_MOVIE_ROOT', cm=updatemovie) updatetv = [] updatetv.append( (common.getString(30103), 'XBMC.RunPlugin(%s?mode=<appfeed>&sitemode=<updateAll>)' % sys.argv[0] ) ) updatetv.append( (common.getString(30105), 'XBMC.RunPlugin(%s?mode=<tv>&sitemode=<addTVdb>&url=<f>)' % sys.argv[0] ) ) common.addDir(common.getString(30107),'listtv','LIST_TV_ROOT', cm=updatetv) common.addDir(common.getString(30108),'appfeed','SEARCH_DB') common.addDir(common.getString(30060),'appfeed','ListMenu', common.lib, cm=cm_library) common.xbmcplugin.endOfDirectory(common.pluginhandle) else: exec 'import resources.lib.%s as sitemodule' % common.args.mode exec 'sitemodule.%s()' % common.args.sitemode
def LIST_MOVIE_TYPES(type=False): import movies as moviesDB if not type: type = common.args.url if type == 'GENRE': mode = 'LIST_MOVIES_GENRE_FILTERED' items = moviesDB.getMovieTypes('genres') elif type == 'STUDIOS': mode = 'LIST_MOVIES_STUDIO_FILTERED' items = moviesDB.getMovieTypes('studio') elif type == 'YEARS': mode = 'LIST_MOVIES_YEAR_FILTERED' items = moviesDB.getMovieTypes('year') elif type == 'DIRECTORS': mode = 'LIST_MOVIES_DIRECTOR_FILTERED' items = moviesDB.getMovieTypes('director') elif type == 'MPAA': mode = 'LIST_MOVIES_MPAA_FILTERED' items = moviesDB.getMovieTypes('mpaa') elif type == 'ACTORS': mode = 'LIST_MOVIES_ACTOR_FILTERED' items = moviesDB.getMovieTypes('actors') for item in items: common.addDir(item, 'listmovie', mode, item) xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL) xbmcplugin.endOfDirectory(pluginhandle, updateListing=False)
def GetCategoriesList(iconimage): sortString = common.GetLocaleString( 30002) if sortBy == 0 else common.GetLocaleString(30003) name = "{0}: {1}".format(common.GetLocaleString(30001), sortString) common.addDir( name, "toggleSortingMethod", 4, iconimage, { "Title": name, "Plot": "{0}[CR]{1}[CR]{2} / {3}".format( name, common.GetLocaleString(30004), common.GetLocaleString(30002), common.GetLocaleString(30003)) }, module=module, isFolder=False) name = common.GetLabelColor("כל התכניות", bold=True, color="none") common.addDir(name, '', 0, iconimage, infos={ "Title": name, "Plot": "צפיה בתכניות ערוץ מורשת 20" }, module=module)
def GetSeriesList(iconimage): text = common.OpenURL( 'https://www.20il.co.il/tochniot_haarutz/%d7%97%d7%93%d7%a9%d7%95%d7%aa-%d7%a2%d7%a8%d7%95%d7%a5-20/' ) match = re.compile('<div class="tochniot-in-use-images(.*?)</div>', re.S).findall(text) match = re.compile('<a href="(.*?)".*?<img src="\s*(.*?)"', re.S).findall(match[0]) grids_arr = [] for link, iconimage in match: iconimage = GetQuoteUrl(iconimage) name = common.unquote( common.encode(link[link.rfind('/') + 1:], 'utf-8')) name = common.GetLabelColor(common.UnEscapeXML(name.replace('-', ' ')), keyColor="prColor", bold=True) if iconimage.startswith('http') == False: iconimage = '{0}{1}'.format(baseUrl, iconimage) grids_arr.append((name, '{0}{1}'.format(baseUrl, link), iconimage, { "Title": name })) grids_sorted = grids_arr if sortBy == 0 else sorted( grids_arr, key=lambda grids_arr: grids_arr[0]) for name, link, image, infos in grids_sorted: common.addDir(name, link, 1, common.encode(image, 'utf-8'), infos=infos, module=module)
def APP_ROOT(): common.addDir('Prime Movie Categories','appfeed','APP_LEVEL2','2,2') common.addDir('Prime TV shows Categories','appfeed','APP_LEVEL2','3,2') common.addDir('All Seasons','appfeed','BROWSE_SEASONS','') common.addDir('All Shows','appfeed','BROWSE_SERIES','') common.addDir('Full Category List','appfeed','APP_LEVEL0','') xbmcplugin.endOfDirectory(pluginhandle)
def LIST_COLLECTIONS(): data = common.getURL(BASE) tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) for item in tree.findAll('a', attrs={'class': 'showhomepagestunt'}): name = item.string common.addDir(name, 'listmovie', 'LIST_STUNT', item['stunt_id']) xbmcplugin.endOfDirectory(pluginhandle)
def LIBRARY_LIST_TV(): url = common.args.url data = common.getURL(url,useCookie=True) scripts = re.compile(r'<script.*?script>',re.DOTALL) data = scripts.sub('', data) style = re.compile(r'<style.*?style>',re.DOTALL) data = style.sub('', data) tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) videos = tree.findAll('div',attrs={'class':'lib-item','asin':True}) totalItems = len(videos) for video in videos: xbmcplugin.setContent(int(sys.argv[1]), 'tvshows') asin = video['asin'] name = video.find('',attrs={'class':'title'}).a.string thumb = video.find('img')['src'].replace('._SS160_','') if '[HD]' in name: isHD = True else: isHD = False url = common.BASE_URL+video.find('div',attrs={'class':'title'}).a['href'] #if xbmcplugin.getSetting(pluginhandle,'enablelibrarymeta') == 'true': # asin2,season,episodes,plot,creator,runtime,year,network,actors,genres,stars,votes,HD,TVDBbanner,TVDBposter,TVDBfanart = getShowInfo(url,asin,isHD) # actors = actors.split(',') # infoLabels={'Title': name,'Plot':plot,'year':year,'rating':stars,'votes':votes, # 'Genre':genres,'Season':season,'episode':episodes,'studio':network, # 'duration':runtime,'cast':actors,'TVShowTitle':name,'credits':creator} # if year <> 0: infoLabels['premiered'] = str(year) #else: infoLabels = { 'Title':name} common.addDir(name,'library','LIBRARY_EPISODES',url,thumb,thumb,infoLabels,totalItems) viewenable=xbmcplugin.getSetting(pluginhandle,"viewenable") if viewenable == 'true': view=int(xbmcplugin.getSetting(pluginhandle,"showview")) xbmc.executebuiltin("Container.SetViewMode("+str(confluence_views[view])+")") xbmcplugin.endOfDirectory(pluginhandle)
def modes( ): if sys.argv[2]=='': common.addDir('Featured Movies','appfeed','APP_LEVEL2','2,2') common.addDir('Featured Television','appfeed','APP_LEVEL2','3,2') updatemovie = [] updatemovie.append( ('Export Movie Favorites to Library', 'XBMC.RunPlugin(plugin://plugin.video.amazon/?mode="xbmclibrary"&sitemode="LIST_MOVIES")' ) ) updatemovie.append( ('Full Movie Refresh(DB)', 'XBMC.RunPlugin(plugin://plugin.video.amazon/?mode="movies"&sitemode="addMoviesdb")' ) ) common.addDir('Movies','listmovie','LIST_MOVIE_ROOT', cm=updatemovie) updatetv = [] updatetv.append( ('Export TV Favorites to Library', 'XBMC.RunPlugin(plugin://plugin.video.amazon/?mode="xbmclibrary"&sitemode="LIST_TVSHOWS")' ) ) updatetv.append( ('Full Television Refresh(DB)', 'XBMC.RunPlugin(plugin://plugin.video.amazon/?mode="tv"&sitemode="addTVdb")' ) ) #updatetv.append( ('Scan TVDB(DB)', 'XBMC.RunPlugin(plugin://plugin.video.amazon/?mode="tv"&sitemode="scanTVDBshows")' ) )] common.addDir('Television','listtv','LIST_TV_ROOT', cm=updatetv) common.addDir('Search Prime','appfeed','SEARCH_PRIME','') #OLD SEARCH #common.addDir('Search Prime','searchprime','SEARCH_PRIME','http://www.amazon.com/s?ie=UTF8&field-is_prime_benefit=1&rh=n%3A2858778011%2Ck%3A') #TESTS #common.addDir('Categories Testing','appfeed','APP_ROOT') xbmcplugin.endOfDirectory(pluginhandle) else: exec 'import resources.lib.%s as sitemodule' % common.args.mode exec 'sitemodule.%s()' % common.args.sitemode
def LIST_TVSHOWS_TYPES(type=False): import tv as tvDB if not type: type = common.args.url if type == "GENRE": mode = "LIST_TVSHOWS_GENRE_FILTERED" items = tvDB.getShowTypes("genres") elif type == "NETWORKS": mode = "LIST_TVSHOWS_NETWORKS_FILTERED" items = tvDB.getShowTypes("network") elif type == "YEARS": mode = "LIST_TVSHOWS_YEARS_FILTERED" items = tvDB.getShowTypes("year") elif type == "MPAA": mode = "LIST_TVSHOWS_MPAA_FILTERED" items = tvDB.getShowTypes("mpaa") elif type == "CREATORS": mode = "LIST_TVSHOWS_CREATORS_FILTERED" items = tvDB.getShowTypes("creator") for item in items: export_mode = mode + "_EXPORT" cm = [ ( "Export to Library", 'XBMC.RunPlugin(plugin://plugin.video.amazon?mode="listtv"&sitemode="%s"&url="%s")' % (export_mode, urllib.quote_plus(item)), ) ] common.addDir(item, "listtv", mode, item, cm=cm) xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL) xbmcplugin.endOfDirectory(pluginhandle, updateListing=False)
def GetChannels(url, iconimage): html = common.OpenURL(url, headers={"User-Agent": UA}) if html == "": return None match = re.compile("var makoliveJson ='(.*?)';").findall(html) resultJSON = json.loads(match[0]) if resultJSON is None or len(resultJSON) < 1: return None for channel in resultJSON['list']: name = common.GetLabelColor(common.encode(channel['title'], "utf-8"), keyColor="prColor") infos = { "Title": name, "Plot": common.encode(channel['subtitle'], "utf-8") } url = '{0}{1}'.format(baseUrl, channel['link']) iconimage = channel['picUrl'] common.addDir( name, url, 5, iconimage, infos, contextMenu=[(common.GetLocaleString( 30005 ), 'RunPlugin({0}?url={1}&name={2}&mode=5&iconimage={3}&moredata=choose&module=keshet)' .format(sys.argv[0], common.quote_plus(url), common.quote_plus(name), common.quote_plus(iconimage)))], moreData=bitrate, module='keshet', isFolder=False, isPlayable=True)
def GetSeasonsList(url, iconimage): url = "{0}&{1}".format(url, endings) if "?" in url else "{0}?{1}".format( url, endings) prms = GetJson(url) if prms is None or "programData" not in prms or "seasons" not in prms[ "programData"]: xbmc.log("Cannot get Seasons list", 2) return if iconimage == os.path.join(imagesDir, 'search.jpg'): iconimage = GetImage(prms["programData"], "picI", iconimage) for prm in prms["programData"]["seasons"]: try: if "vods" not in prm: continue name = common.GetLabelColor(common.encode(prm.get('name', ''), "utf-8"), keyColor="timesColor", bold=True) url = "{0}{1}".format(baseUrl, prm["url"]) description = common.encode(prm.get('brief', ''), "utf-8") infos = {"Title": name, "Plot": description} common.addDir(name, url, 3, iconimage, infos, module=module, moreData=prm["id"]) except Exception as ex: xbmc.log(str(ex), 3)
def LIST_TVSHOWS_TYPES(type=False): import tv as tvDB if not type: type = common.args.url if type=='GENRE': mode = 'LIST_TVSHOWS_GENRE_FILTERED' items = tvDB.getShowTypes('genres') elif type=='NETWORKS': mode = 'LIST_TVSHOWS_NETWORKS_FILTERED' items = tvDB.getShowTypes('network') elif type=='YEARS': mode = 'LIST_TVSHOWS_YEARS_FILTERED' items = tvDB.getShowTypes('year') elif type=='MPAA': mode = 'LIST_TVSHOWS_MPAA_FILTERED' items = tvDB.getShowTypes('mpaa') elif type=='CREATORS': mode = 'LIST_TVSHOWS_CREATORS_FILTERED' items = tvDB.getShowTypes('creator') for item in items: export_mode=mode+'_EXPORT' cm = [('Export to Library', 'XBMC.RunPlugin(plugin://plugin.video.amazon?mode="listtv"&sitemode="%s"&url="%s")' % ( export_mode, urllib.quote_plus(item) ) ) ] common.addDir(item,'listtv',mode,item,cm=cm) xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL) xbmcplugin.endOfDirectory(pluginhandle,updateListing=False)
def GetRadioEpisodesList(url): data = GetRadioData() for id in data[url]['children']: episode = data[id] name = common.GetLabelColor(episode['name'], keyColor="chColor") desc = episode.get('description', '') link = episode['url'].replace(u'\u200f', '') iconimage = '{0}/{1}'.format(radioUrl, episode['imageUrl']) common.addDir( name, link, 23, iconimage, infos={ "Title": name, "Plot": desc, "Aired": episode['time'] }, contextMenu= [(common.GetLocaleString(30005), 'RunPlugin({0}?url={1}&name={2}&mode=4&iconimage={3}&moredata=choose&module={4})' .format(sys.argv[0], common.quote_plus(link), name, common.quote_plus(iconimage), module)), (common.GetLocaleString(30023), 'RunPlugin({0}?url={1}&name={2}&mode=4&iconimage={3}&moredata=set_{4}_res&module={4})' .format(sys.argv[0], common.quote_plus(link), name, common.quote_plus(iconimage), module))], module=module, moreData=bitrate, isFolder=False, isPlayable=True)
def LIST_MOVIE_AZ(): common.addDir('#','listmovie','LIST_MOVIES_AZ_FILTERED','') alphabet=set(string.ascii_uppercase) for letter in alphabet: common.addDir(letter,'listmovie','LIST_MOVIES_AZ_FILTERED',letter) xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL) xbmcplugin.endOfDirectory(pluginhandle)
def APP_LEVEL3(): url = BUILD_BASE_API('catalog/GetCategoryList') + '&version=1' data = common.getATVURL(url) json = demjson.decode(data) del data categories = json['message']['body']['categories'][int( common.args.url.split(',')[0])]['categories'][int( common.args.url.split(',')[1])]['categories'][int( common.args.url.split(',')[2])]['categories'] del json for item in categories: if item.has_key('categories'): common.addDir(item['title'], 'appfeed', 'APP_LEVEL4', common.args.url + ',' + str(categories.index(item))) else: cm = [( 'Export to Library', 'XBMC.RunPlugin(plugin://plugin.video.amazon?mode="appfeed"&sitemode="BROWSE_EXPORT"&url="%s")' % (urllib.quote_plus(item['query'])))] common.addDir(item['title'], 'appfeed', 'BROWSE', item['query'], cm=cm) xbmcplugin.endOfDirectory(pluginhandle)
def GetEpisodes(text): #raw_unicode_escape = False #match = []#re.compile(u'<main id="main"(.*?)</main>', re.S).findall(text) #if len(match) < 1: match = re.compile(u'pageGlobals.*?"id":(.*?),').findall(text) link = 'https://sport1.maariv.co.il/wp-json/sport1/v1/league/{0}/video/content?is_mobile=false&rows=800'.format(match[0]) text = common.OpenURL(link) match[0] = text.replace('\\"', '"').replace('\/', '/') #raw_unicode_escape = True match = re.compile(u'<div class="video-card(.*?)</a>', re.S).findall(match[0]) for item in match: m = re.compile("<a href=['\"](.*?)['\"].*?<img(.*?)>.*?<h3.*?>(.*?)</h3>", re.S).findall(item) if len(m) < 1: continue url, icon, name = m[0] m = re.compile(u'data-lazy="(.*?)"', re.S).findall(icon) if len(m) < 1: m = re.compile(u'src=["\'](.*?)["\']', re.S).findall(icon) icon = m[0] #if raw_unicode_escape: name = common.decode(name, 'raw_unicode_escape', force=True) url = common.decode(url, 'raw_unicode_escape', force=True) icon = common.decode(icon, 'raw_unicode_escape', force=True) name = common.GetLabelColor(common.UnEscapeXML(name.strip()), keyColor="chColor", bold=True) try: common.addDir(name, url.replace(baseUrl, ''), 4, icon, infos={"Title": name}, contextMenu=[(common.GetLocaleString(30005), 'RunPlugin({0}?url={1}&name={2}&mode=4&iconimage={3}&moredata=choose&module={4})'.format(sys.argv[0], common.quote_plus(url), name, common.quote_plus(icon), module)), (common.GetLocaleString(30023), 'RunPlugin({0}?url={1}&name={2}&mode=4&iconimage={3}&moredata=set_{4}_res&module={4})'.format(sys.argv[0], common.quote_plus(url), name, common.quote_plus(icon), module))], module=module, moreData=bitrate, isFolder=False, isPlayable=True) except Exception as ex: xbmc.log(str(ex), 3)
def APP_ROOT(): common.addDir('Prime Movie Categories', 'appfeed', 'APP_LEVEL2', '2,2') common.addDir('Prime TV shows Categories', 'appfeed', 'APP_LEVEL2', '3,2') common.addDir('All Seasons', 'appfeed', 'BROWSE_SEASONS', '') common.addDir('All Shows', 'appfeed', 'BROWSE_SERIES', '') common.addDir('Full Category List', 'appfeed', 'APP_LEVEL0', '') xbmcplugin.endOfDirectory(pluginhandle)
def LIST_MOVIE_TYPES(type=False): import movies as moviesDB if not type: type = common.args.url if type=='GENRE': mode = 'LIST_MOVIES_GENRE_FILTERED' items = moviesDB.getMovieTypes('genres') elif type=='STUDIOS': mode = 'LIST_MOVIES_STUDIO_FILTERED' items = moviesDB.getMovieTypes('studio') elif type=='YEARS': mode = 'LIST_MOVIES_YEAR_FILTERED' items = moviesDB.getMovieTypes('year') elif type=='DIRECTORS': mode = 'LIST_MOVIES_DIRECTOR_FILTERED' items = moviesDB.getMovieTypes('director') elif type=='MPAA': mode = 'LIST_MOVIES_MPAA_FILTERED' items = moviesDB.getMovieTypes('mpaa') elif type=='ACTORS': mode = 'LIST_MOVIES_ACTOR_FILTERED' items = moviesDB.getMovieTypes('actors') for item in items: common.addDir(item,'listmovie',mode,item) xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL) xbmcplugin.endOfDirectory(pluginhandle,updateListing=False)
def AddSeries(matches, catName): for link, iconimage, name, description in matches: i = link.lower().find('catid=') if i > 0: link = link[i + 6:] elif 'page.aspx' in link.lower(): try: t = common.OpenURL(link) m = re.compile( 'magazine_info_link w-inline-block\s*"\s*href=\'.*?catid=(.*?)&' ).findall(t) link = m[0] except: pass name = common.GetLabelColor(name.strip(), keyColor="prColor", bold=True) common.addDir(name, link, 2, iconimage, infos={ "Title": name, "Plot": description }, module=module, moreData='kan|||{0}'.format(catName), urlParamsData={'catName': catName})
def LIST_TVSHOWS(HDonly=False,genrefilter=False,creatorfilter=False,networkfilter=False,yearfilter=False,favorfilter=False): xbmcplugin.setContent(pluginhandle, 'tvshows') import tv as tvDB shows = tvDB.loadTVShowdb(HDonly=HDonly,genrefilter=genrefilter,creatorfilter=creatorfilter,networkfilter=networkfilter,yearfilter=yearfilter,favorfilter=favorfilter) artOptions = ['Poster','Banner','Amazon'] tvart=int(common.addon.getSetting("tvart")) option = artOptions[tvart] editenable=common.addon.getSetting("editenable") for seriestitle,plot,creator,network,genres,actors,year,stars,votes,episodetotal,watched,unwatched,isHD,isprime,favor,TVDBbanner,TVDBposter,TVDBfanart,TVDBseriesid in shows: infoLabels={'Title': seriestitle,'TVShowTitle':seriestitle} if plot: infoLabels['Plot'] = plot if actors: infoLabels['Cast'] = actors.split(',') if year: infoLabels['Year'] = year infoLabels['Premiered'] = str(year) if stars: infoLabels['Rating'] = stars if votes: infoLabels['Votes'] = votes if genres: infoLabels['Genre'] = genres if episodetotal: infoLabels['Episode'] = episodetotal if network: infoLabels['Studio'] = network if creator: infoLabels['Credits'] = creator if HDonly==True: listmode = 'LIST_HDTV_SEASONS' else: listmode = 'LIST_TV_SEASONS' if TVDBposter and option == 'Poster': poster = TVDBposter elif TVDBbanner and option == 'Banner': poster = TVDBbanner else: poster = tvDB.getPoster(seriestitle) if TVDBfanart: fanart = TVDBfanart else: fanart = tvDB.getPoster(seriestitle) cm = [] if favor: cm.append( ('Remove from Favorites', 'XBMC.RunPlugin(%s?mode="tv"&sitemode="unfavorShowdb"&title="%s")' % ( sys.argv[0], urllib.quote_plus(seriestitle) ) ) ) else: cm.append( ('Add to Favorites', 'XBMC.RunPlugin(%s?mode="tv"&sitemode="favorShowdb"&title="%s")' % ( sys.argv[0], urllib.quote_plus(seriestitle) ) ) ) if editenable == 'true': cm.append( ('Rename Show', 'XBMC.RunPlugin(%s?mode="tv"&sitemode="renameShowdb"&title="%s")' % ( sys.argv[0], urllib.quote_plus(seriestitle) ) ) ) if TVDBseriesid: cm.append( ('Refresh TVDB Data', 'XBMC.RunPlugin(%s?mode="tv"&sitemode="refreshTVDBshow"&title="%s")' % ( sys.argv[0], urllib.quote_plus(seriestitle) ) ) ) cm.append( ('Lookup Show in TVDB', 'XBMC.RunPlugin(%s?mode="tv"&sitemode="scanTVDBshow"&title="%s")' % ( sys.argv[0], urllib.quote_plus(seriestitle) ) ) ) cm.append( ('Remove Show', 'XBMC.RunPlugin(%s?mode="tv"&sitemode="deleteShowdb"&title="%s")' % ( sys.argv[0], urllib.quote_plus(seriestitle) ) ) ) common.addDir(seriestitle,'listtv',listmode,seriestitle,poster,fanart,infoLabels,cm=cm) 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) viewenable=common.addon.getSetting("viewenable") if viewenable == 'true': view=int(common.addon.getSetting("showview")) xbmc.executebuiltin("Container.SetViewMode("+str(confluence_views[view])+")") xbmcplugin.endOfDirectory(pluginhandle,updateListing=False)
def LIST_COLLECTIONS(): data = common.getURL(BASE) tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) for item in tree.findAll('a',attrs={'class':'showhomepagestunt'}): name = item.string common.addDir(name,'listmovie','LIST_STUNT',item['stunt_id']) xbmcplugin.endOfDirectory(pluginhandle)
def LIST_MOVIE_TYPES(type=False): import movies as moviesDB if not type: type = common.args.url if type=='GENRE': mode = 'LIST_MOVIES_GENRE_FILTERED' items = moviesDB.getMovieTypes('genres') elif type=='STUDIOS': mode = 'LIST_MOVIES_STUDIO_FILTERED' items = moviesDB.getMovieTypes('studio') elif type=='YEARS': mode = 'LIST_MOVIES_YEAR_FILTERED' items = moviesDB.getMovieTypes('year') elif type=='DIRECTORS': mode = 'LIST_MOVIES_DIRECTOR_FILTERED' items = moviesDB.getMovieTypes('director') elif type=='MPAA': mode = 'LIST_MOVIES_MPAA_FILTERED' items = moviesDB.getMovieTypes('mpaa') elif type=='ACTORS': mode = 'LIST_MOVIES_ACTOR_FILTERED' items = moviesDB.getMovieTypes('actors') for item in items: export_mode=mode+'_EXPORT' cm = [('Export to Library', 'XBMC.RunPlugin(plugin://plugin.video.amazon?mode="listmovie"&sitemode="%s"&url="%s")' % ( export_mode, urllib.quote_plus(item) ) ) ] common.addDir(item,'listmovie',mode,item,cm=cm) xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL) xbmcplugin.endOfDirectory(pluginhandle,updateListing=False)
def LIST_GENRE(): url = genreURL + '1/1/1/' data = common.getURL(url) jsondata = demjson.decode(data) for url,name in jsondata['all_items'].iteritems(): common.addDir(name,'listmovie','LIST_GENRE_FILTERED',url) xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL) xbmcplugin.endOfDirectory(pluginhandle)
def LIST_GENRE(): url = genreURL + '1/1/1/' data = common.getURL(url) jsondata = demjson.decode(data) for url, name in jsondata['all_items'].iteritems(): common.addDir(name, 'listmovie', 'LIST_GENRE_FILTERED', url) xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL) xbmcplugin.endOfDirectory(pluginhandle)
def LIBRARY_ROOT(): common.addDir( 'Movies', 'library', 'LIBRARY_LIST_MOVIES', 'https://www.amazon.com/gp/video/library/movie?show=all&sort=alpha') common.addDir( 'Television', 'library', 'LIBRARY_LIST_TV', 'https://www.amazon.com/gp/video/library/tv?show=all&sort=alpha') xbmcplugin.endOfDirectory(pluginhandle)
def LIST_TV_SEASONS(HDonly=False): namefilter = common.args.url editenable=common.addon.getSetting("editenable") import tv as tvDB seasons = tvDB.loadTVSeasonsdb(showname=namefilter,HDonly=HDonly).fetchall() seasonTotal = len(seasons) for url,poster,season,seriestitle,plot,creator,network,genres,actors,year,stars,votes,episodetotal,watched,unwatched,isHD,isprime in seasons: if seasonTotal == 1: if isHD: LIST_HDEPISODES_DB(url=seriestitle+'<split>'+str(season)) else: LIST_EPISODES_DB(url=seriestitle+'<split>'+str(season)) return infoLabels={'Title': seriestitle,'TVShowTitle':seriestitle} if plot: infoLabels['Plot'] = plot if actors: infoLabels['Cast'] = actors.split(',') if year: infoLabels['Year'] = year infoLabels['Premiered'] = str(year) if stars: infoLabels['Rating'] = stars if votes: infoLabels['Votes'] = votes if genres: infoLabels['Genre'] = genres if episodetotal: infoLabels['Episode'] = episodetotal if season: infoLabels['Season'] = season if network: infoLabels['Studio'] = network if creator: infoLabels['Credits'] = creator if isHD: mode = 'LIST_HDEPISODES_DB' else: mode = 'LIST_EPISODES_DB' if season <> 0 and len(str(season)) < 3: displayname = 'Season '+str(season) elif len(str(season)) > 2: displayname = 'Year '+str(season) else: displayname = 'Specials' if isHD: displayname += ' [HD]' cm = [] if editenable == 'true': cm.append( ('Rename Season', 'XBMC.RunPlugin(%s?mode="tv"&sitemode="renameSeasondb"&title="%s"&season="%s")' % ( sys.argv[0], urllib.quote_plus(seriestitle), str(season) ) ) ) cm.append( ('Remove Season', 'XBMC.RunPlugin(%s?mode="tv"&sitemode="deleteSeasondb"&title="%s"&season="%s")' % ( sys.argv[0], urllib.quote_plus(seriestitle), str(season) ) ) ) if common.args.fanart and common.args.fanart <> '': fanart = common.args.fanart else: fanart=poster common.addDir(displayname,'listtv',mode,seriestitle+'<split>'+str(season),poster,fanart,infoLabels,cm=cm) xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL) xbmcplugin.setContent(pluginhandle, 'tvshows') viewenable=common.addon.getSetting("viewenable") if viewenable == 'true': view=int(common.addon.getSetting("seasonview")) xbmc.executebuiltin("Container.SetViewMode("+str(confluence_views[view])+")") xbmcplugin.endOfDirectory(pluginhandle,updateListing=False)
def GetCategories(iconimage): categories = [ {'name': 'ערוצים פופולרים', 'cat': 'popular'}, {'name': 'ערוצים דיגיטלים', 'cat': 'digital'}, {'name': 'ערוצי תוכן', 'cat': 'content'} ] for category in categories: name = common.GetLabelColor(category['name'], keyColor="prColor", bold=True) common.addDir(name, category['cat'], 1, iconimage, infos={"Title": name}, module=module)
def ADD_SEASON_ITEM(seasondata,mode='listtv',submode='LIST_EPISODES_DB',seriesTitle=False,inWatchlist=False): #asin,episodeFeed,poster,season,seriestitle,plot,actors,studio,mpaa,genres,premiered,year,stars,votes,episodetotal,watched,unwatched,isHD,isprime asin,seriesASIN,episodeFeed,poster,season,seriestitle,plot,actors,network,mpaa,genres,premiered,year,stars,votes,episodetotal,watched,unwatched,isHD,isprime = seasondata infoLabels={'Title': seriestitle,'TVShowTitle':seriestitle} if plot: infoLabels['Plot'] = plot if mpaa: infoLabels['MPAA'] = mpaa if actors: infoLabels['Cast'] = actors.split(',') if year: infoLabels['Year'] = year if premiered: infoLabels['Premiered'] = premiered if stars: infoLabels['Rating'] = stars if votes: infoLabels['Votes'] = votes if genres: infoLabels['Genre'] = genres if episodetotal: infoLabels['Episode'] = episodetotal if season: infoLabels['Season'] = season if network: infoLabels['Studio'] = network if mode == 'listtv': url = seriestitle+'<split>'+str(season) if isHD: submode = 'LIST_HDEPISODES_DB' elif mode == 'appfeed': url = asin if isHD: submode = 'BROWSE_EPISODES_HD' else: url = asin if seriesTitle: displayname=seriestitle+' ' else: displayname='' if season <> 0 and len(str(season)) < 3: displayname += 'Season '+str(season) elif len(str(season)) > 2: displayname += 'Year '+str(season) else: displayname += 'Specials' if isHD: displayname += ' [COLOR FFE47911][HD][/COLOR]' cm = [] if inWatchlist: cm.append( ('Remove from Watchlist', 'XBMC.RunPlugin(%s?mode="common"&sitemode="removeTVWatchlist"&asin="%s")' % ( sys.argv[0], urllib.quote_plus(asin) ) ) ) else: cm.append( ('Add to Watchlist', 'XBMC.RunPlugin(%s?mode="common"&sitemode="addTVWatchlist"&asin="%s")' % ( sys.argv[0], urllib.quote_plus(asin) ) ) ) cm.append( ('Export to Library', 'XBMC.RunPlugin(plugin://plugin.video.amazon?mode="xbmclibrary"&sitemode="EXPORT_SEASON"&asin="%s")' % ( urllib.quote_plus(asin) ) ) ) if common.addon.getSetting("editenable") == 'true': cm.append( ('Rename Season', 'XBMC.RunPlugin(%s?mode="tv"&sitemode="renameSeasondb"&title="%s"&season="%s"&asin="%s")' % ( sys.argv[0], urllib.quote_plus(seriestitle), str(season),urllib.quote_plus(asin) ) ) ) cm.append( ('Remove Season', 'XBMC.RunPlugin(%s?mode="tv"&sitemode="deleteSeasondb"&title="%s"&season="%s"&asin="%s")' % ( sys.argv[0], urllib.quote_plus(seriestitle), str(season),urllib.quote_plus(asin) ) ) ) #try:fanart = common.args.fanart #except: fanart = poster common.addDir(displayname,mode,submode,url,poster,fanart,infoLabels,cm=cm)
def GetEpisodesList(url, iconimage): result = GetUrlJson(url) seasons, episodes = GetLinks(url, result, iconimage) for link, title in common.items(seasons): if 'reshet.tv/news/tonight/' in link: name = 'אין פרקים מלאים' common.addDir(name, '', 99, iconimage, infos={"Title": name}, module=module, isFolder=False) return ShowEpisodes(episodes, iconimage) ShowPaging(result.get('Content', {}).get('PageGrid', {}), result.get('PageMeta', {}).get('page_url', ''), iconimage, 2)
def LIST_ALPHA(): url = alphaURL + '1/1/1/' data = common.getURL(url) jsondata = demjson.decode(data) for url,name in jsondata['all_items'].iteritems(): if name == 'ALL': name = '(ALL)' common.addDir(name,'listmovie','LIST_ALPHA_FILTERED',url) xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL) xbmcplugin.endOfDirectory(pluginhandle)
def LIST_STUNT(id=common.args.url): url = 'http://www.epixhd.com/ajax/getstuntlimited/?stunt_id='+id+'&limit=72' data = common.getURL(url) jsondata = demjson.decode(data) for movie in jsondata['rs']: movie = jsondata['rs'][movie] print movie common.addDir(movie['title'],'movie','MOVIE_VIDEOS','/'+movie['short_name']+'/') #common.addVideo(movie['title'],'/'+movie['short_name']+'/') xbmcplugin.endOfDirectory(pluginhandle)
def LIST_ALPHA(): url = alphaURL + '1/1/1/' data = common.getURL(url) jsondata = demjson.decode(data) for url, name in jsondata['all_items'].iteritems(): if name == 'ALL': name = '(ALL)' common.addDir(name, 'listmovie', 'LIST_ALPHA_FILTERED', url) xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL) xbmcplugin.endOfDirectory(pluginhandle)
def GetSeasonList(url, iconimage): result = GetUrlJson(url) seasons, episodes = GetLinks(url, result, iconimage) if len(seasons) > 0: for link, title in common.items(seasons): name = common.GetLabelColor(title, keyColor="timesColor", bold=True) common.addDir(name, link, 2, iconimage, infos={"Title": name}, module=module) if len(episodes) < 1: return ShowEpisodes(episodes, iconimage)
def LIST_ALPHA_FILTERED(): url = alphaURL + common.args.url + '/1/4000/' data = common.getURL(url) jsondata = demjson.decode(data) for movie in jsondata['content']: try: thumb = movie['movie_playerposter'].replace('thumbs/','') except: thumb = '' common.addDir(movie['movie_title'],'movie','MOVIE_VIDEOS',movie['movie_url'],thumb,thumb) #common.addVideo(movie['movie_title'],movie['movie_url'],thumb,thumb) xbmcplugin.endOfDirectory(pluginhandle)
def modes(): if sys.argv[2] == '': common.Log('Version: %s' % common.__version__) common.Log('Unicode support: %s' % common.os.path.supports_unicode_filenames) cm_watchlist = [] cm_library = [( common.getString(30116), 'XBMC.RunPlugin(%s?mode=<appfeed>&sitemode=<RefreshList>&url=<%s>)' % (sys.argv[0], common.lib))] common.addDir('Watchlist', 'appfeed', 'ListMenu', common.wl, cm=cm_watchlist) updatemovie = [] updatemovie.append( (common.getString(30103), 'XBMC.RunPlugin(%s?mode=<appfeed>&sitemode=<updateAll>)' % sys.argv[0])) updatemovie.append(( common.getString(30102), 'XBMC.RunPlugin(%s?mode=<movies>&sitemode=<addMoviesdb>&url=<f>)' % sys.argv[0])) common.addDir(common.getString(30104), 'listmovie', 'LIST_MOVIE_ROOT', cm=updatemovie) updatetv = [] updatetv.append( (common.getString(30103), 'XBMC.RunPlugin(%s?mode=<appfeed>&sitemode=<updateAll>)' % sys.argv[0])) updatetv.append( (common.getString(30105), 'XBMC.RunPlugin(%s?mode=<tv>&sitemode=<addTVdb>&url=<f>)' % sys.argv[0])) common.addDir(common.getString(30107), 'listtv', 'LIST_TV_ROOT', cm=updatetv) common.addDir(common.getString(30108), 'appfeed', 'SEARCH_DB') common.addDir(common.getString(30060), 'appfeed', 'ListMenu', common.lib, cm=cm_library) common.xbmcplugin.endOfDirectory(common.pluginhandle) else: exec 'import resources.lib.%s as sitemodule' % common.args.mode exec 'sitemodule.%s()' % common.args.sitemode
def LIST_QUEUE(): url = 'http://www.epixhd.com/epx/ajax/myqueue/' data = common.getURL(url,useCookie=True) jsondata = demjson.decode(data) for movie in jsondata['queue']: try: poster = movie['poster'].replace('thumbs/','') except: poster = '' try: fanart = movie['playerposter'].replace('thumbs/','') except: fanart = '' common.addDir(movie['title'],'movie','MOVIE_VIDEOS','/'+movie['short_name']+'/',poster,fanart) xbmcplugin.endOfDirectory(pluginhandle)
def LIST_POP(): url = 'http://www.epixhd.com/all-movies/' data = common.getURL(url) tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) for item in tree.find('div',attrs={'id':'am-top-posters'}).findAll('a'): url = item['href']+'/' name = item['href'].replace('/','').replace('-',' ').title() thumb = item.find('img')['src'].replace('thumbs/','') common.addDir(name,'movie','MOVIE_VIDEOS',url,thumb,thumb) #common.addVideo(name,url,thumb,thumb) xbmcplugin.endOfDirectory(pluginhandle)
def ShowEpisodes(episodes, iconimage): if len(episodes) < 1: name = 'אין פרקים מלאים' common.addDir(name, '', 99, iconimage, infos={"Title": name}, module=module, isFolder=False) return programNameFormat = int(Addon.getSetting("programNameFormat")) #for gridTitle, link, icon, title, subtitle, publishDate in sorted(episodes,key=lambda episodes: episodes[5]):#reversed(episodes): for gridTitle, link, icon, title, subtitle, publishDate in episodes: name = common.GetLabelColor(title, keyColor="chColor") if gridTitle is None or gridTitle == '' else common.getDisplayName(gridTitle, title, programNameFormat) link = str(link) common.addDir(name, link, 3, icon, infos={"Title": name, "Plot": subtitle, "Aired": publishDate}, contextMenu=[(common.GetLocaleString(30005), 'RunPlugin({0}?url={1}&name={2}&mode=3&iconimage={3}&moredata=choose&module=reshet)'.format(sys.argv[0], common.quote_plus(link), common.quote_plus(name), common.quote_plus(icon))), (common.GetLocaleString(30023), 'RunPlugin({0}?url={1}&name={2}&mode=3&iconimage={3}&moredata=set_reshet_res&module=reshet)'.format(sys.argv[0], common.quote_plus(link), common.quote_plus(name), common.quote_plus(icon)))], moreData=bitrate, module=module, isFolder=False, isPlayable=True)
def LIST_STUNT(id=common.args.url): url = 'http://www.epixhd.com/ajax/getstuntlimited/?stunt_id=' + id + '&limit=72' data = common.getURL(url) jsondata = demjson.decode(data) for movie in jsondata['rs']: movie = jsondata['rs'][movie] print movie common.addDir(movie['title'], 'movie', 'MOVIE_VIDEOS', '/' + movie['short_name'] + '/') #common.addVideo(movie['title'],'/'+movie['short_name']+'/') xbmcplugin.endOfDirectory(pluginhandle)
def LIST_POP(): url = 'http://www.epixhd.com/all-movies/' data = common.getURL(url) tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) for item in tree.find('div', attrs={'id': 'am-top-posters'}).findAll('a'): url = item['href'] + '/' name = item['href'].replace('/', '').replace('-', ' ').title() thumb = item.find('img')['src'].replace('thumbs/', '') common.addDir(name, 'movie', 'MOVIE_VIDEOS', url, thumb, thumb) #common.addVideo(name,url,thumb,thumb) xbmcplugin.endOfDirectory(pluginhandle)
def SEARCH_PRIME(searchString=False,results=MAX,index=0): if not searchString: keyboard = xbmc.Keyboard('') keyboard.doModal() q = keyboard.getText() if (keyboard.isConfirmed()): searchString=urllib.quote_plus(keyboard.getText()) if searchString <> '': common.addDir('[Search Suggestions]','appfeed','SEARCH_SUGGEST_PRIME',searchString) # '+str(results)+' BROWSE_PARAMS = '&searchString='+searchString+'&OfferGroups=B0043YVHMY&IncludeAll=T&SuppressBlackedoutEST=T&version=2&NumberOfResults='+str(results)+'&StartIndex='+str(index) url = BUILD_BASE_API('catalog/Search')+BROWSE_PARAMS BROWSE_ADDITEMS(url,results,index,search=True)
def WATCHLIST_ROOT(): cm = [( 'Export to Library', 'XBMC.RunPlugin(plugin://plugin.video.amazon?mode="library"&sitemode="WATCHLIST_LIST_MOVIES_EXPORT"&url="")' )] common.addDir('Movies', 'library', 'WATCHLIST_LIST_MOVIES', '', cm=cm) cm = [( 'Export to Library', 'XBMC.RunPlugin(plugin://plugin.video.amazon?mode="library"&sitemode="WATCHLIST_LIST_TV_EXPORT"&url="")' )] common.addDir('Television', 'library', 'WATCHLIST_LIST_TV', '', cm=cm) xbmcplugin.endOfDirectory(pluginhandle)
def LIST_FEATURE(): data = common.getURL(BASE) url = BASE + re.compile('flashvars.xmlPath = "(.*?)";').findall(data)[0] data = common.getURL(url) tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) for item in tree.findAll('movie'): url = item.find('moviepage').string name = item.find('title').string thumb = item.find('poster').string common.addDir(name,'movie','MOVIE_VIDEOS',url,thumb) #common.addVideo(name,url,thumb) xbmcplugin.endOfDirectory(pluginhandle)
def LIST_FEATURE(): data = common.getURL(BASE) url = BASE + re.compile('flashvars.xmlPath = "(.*?)";').findall(data)[0] data = common.getURL(url) tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) for item in tree.findAll('movie'): url = item.find('moviepage').string name = item.find('title').string thumb = item.find('poster').string common.addDir(name, 'movie', 'MOVIE_VIDEOS', url, thumb) #common.addVideo(name,url,thumb) xbmcplugin.endOfDirectory(pluginhandle)
def ADD_SHOW_ITEM(showdata,mode='listtv',submode='LIST_TV_SEASONS',HDonly=False): artOptions = ['Poster','Banner','Amazon'] tvart=int(common.addon.getSetting("tvart")) option = artOptions[tvart] asin,asin2,feed,seriestitle,poster,plot,network,mpaa,genres,actors,premiered,year,stars,votes,seasontotal,episodetotal,watched,unwatched,isHD,isprime,favor,TVDBbanner,TVDBposter,TVDBfanart,TVDBseriesid = showdata infoLabels={'Title': seriestitle,'TVShowTitle':seriestitle} if plot: infoLabels['Plot'] = plot if mpaa: infoLabels['MPAA'] = mpaa if actors: infoLabels['Cast'] = actors.split(',') if year: infoLabels['Year'] = year if premiered: infoLabels['Premiered'] = premiered if stars: infoLabels['Rating'] = stars if votes: infoLabels['Votes'] = votes if genres: infoLabels['Genre'] = genres if episodetotal: infoLabels['Episode'] = episodetotal if network: infoLabels['Studio'] = network if mode == 'listtv': item_url = seriestitle if HDonly==True: submode = 'LIST_HDTV_SEASONS' else: submode = 'LIST_TV_SEASONS' else: item_url = asin if poster is None: poster='' if TVDBposter and option == 'Poster': poster = TVDBposter elif TVDBbanner and option == 'Banner': poster = TVDBbanner if TVDBfanart: fanart = TVDBfanart else: fanart = poster cm = [] if favor: cm.append( ('Remove from Favorites', 'XBMC.RunPlugin(%s?mode="tv"&sitemode="unfavorShowdb"&title="%s")' % ( sys.argv[0], urllib.quote_plus(seriestitle) ) ) ) else: cm.append( ('Add to Favorites', 'XBMC.RunPlugin(%s?mode="tv"&sitemode="favorShowdb"&title="%s")' % ( sys.argv[0], urllib.quote_plus(seriestitle) ) ) ) cm.append( ('Export to Library', 'XBMC.RunPlugin(plugin://plugin.video.amazon?mode="xbmclibrary"&sitemode="EXPORT_SHOW"&asin="%s")' % ( urllib.quote_plus(asin) ) ) ) if common.addon.getSetting("editenable") == 'true': cm.append( ('Rename Show', 'XBMC.RunPlugin(%s?mode="tv"&sitemode="renameShowdb"&title="%s"&asin="%s")' % ( sys.argv[0], urllib.quote_plus(seriestitle),asin ) ) ) if TVDBseriesid: cm.append( ('Refresh TVDB Data', 'XBMC.RunPlugin(%s?mode="tv"&sitemode="refreshTVDBshow"&title="%s")' % ( sys.argv[0], urllib.quote_plus(seriestitle) ) ) ) cm.append( ('Lookup Show in TVDB', 'XBMC.RunPlugin(%s?mode="tv"&sitemode="scanTVDBshow"&title="%s")' % ( sys.argv[0], urllib.quote_plus(seriestitle) ) ) ) cm.append( ('Remove Show', 'XBMC.RunPlugin(%s?mode="tv"&sitemode="deleteShowdb"&title="%s")' % ( sys.argv[0], urllib.quote_plus(seriestitle) ) ) ) common.addDir(seriestitle,mode,submode,item_url,poster,fanart,infoLabels,cm=cm)
def LIST_GENRE_FILTERED(): url = genreURL + common.args.url + '/1/4000/' data = common.getURL(url) jsondata = demjson.decode(data) for movie in jsondata['content']: try: thumb = movie['movie_playerposter'].replace('thumbs/', '') except: thumb = '' common.addDir(movie['movie_title'], 'movie', 'MOVIE_VIDEOS', movie['movie_url'], thumb, thumb) #common.addVideo(movie['movie_title'],movie['movie_url'],thumb,thumb) xbmcplugin.endOfDirectory(pluginhandle)
def APP_LEVEL1(): url = BUILD_BASE_API('catalog/GetCategoryList')+'&version=1' data = common.getATVURL(url) json = demjson.decode(data) del data categories = json['message']['body']['categories'][int(common.args.url)]['categories'] del json for item in categories: if item.has_key('categories'): common.addDir(item['title'],'appfeed','APP_LEVEL2',common.args.url+','+str(categories.index(item))) else: common.addDir(item['title'],'appfeed','BROWSE',item['query']) xbmcplugin.endOfDirectory(pluginhandle)
def ShowPaging(grids, page_url, iconimage, mode): WpQuery = grids[0].get('WpQuery', None) if WpQuery is None: paged = 0 else: paged = WpQuery.get('paged', 0) if paged > 0 and len(grids) > 0: max_page = grids[0].get('max_page', 0) if paged > 1: prev_page = page_url + 'page/' + str(paged-1) + '/' if paged - 1 > 1 else page_url common.addDir(common.GetLabelColor(common.GetLocaleString(30011), color="green"), prev_page, mode, iconimage, module=module) if max_page > paged: common.addDir(common.GetLabelColor(common.GetLocaleString(30012), color="green"), page_url + 'page/' + str(paged+1) + '/', mode, iconimage, module=module)
def APP_LEVEL3(): url = BUILD_BASE_API('catalog/GetCategoryList')+'&version=1' data = common.getATVURL(url) json = demjson.decode(data) del data categories = json['message']['body']['categories'][int(common.args.url.split(',')[0])]['categories'][int(common.args.url.split(',')[1])]['categories'][int(common.args.url.split(',')[2])]['categories'] del json for item in categories: if item.has_key('categories'): common.addDir(item['title'],'appfeed','APP_LEVEL4',common.args.url+','+str(categories.index(item))) else: cm = [('Export to Library', 'XBMC.RunPlugin(plugin://plugin.video.amazon?mode="appfeed"&sitemode="BROWSE_EXPORT"&url="%s")' % ( urllib.quote_plus(item['query']) ) ) ] common.addDir(item['title'],'appfeed','BROWSE',item['query'],cm=cm) xbmcplugin.endOfDirectory(pluginhandle)
def APP_LEVEL0(): url = BUILD_BASE_API('catalog/GetCategoryList') + '&version=1' data = common.getATVURL(url) json = demjson.decode(data) del data categories = json['message']['body']['categories'] del json for item in categories: if item.has_key('categories'): common.addDir(item['title'], 'appfeed', 'APP_LEVEL1', str(categories.index(item))) else: common.addDir(item['title'], 'appfeed', 'BROWSE', item['query']) xbmcplugin.endOfDirectory(pluginhandle)
def modes( ): if sys.argv[2]=='': common.mechanizeLogin() updatemovie = [] updatemovie.append( ('Export Movie Favorites to Library', 'XBMC.RunPlugin(plugin://plugin.video.amazon/?mode="xbmclibrary"&sitemode="LIST_MOVIES")' ) ) updatemovie.append( ('Full Movie Refresh(DB)', 'XBMC.RunPlugin(plugin://plugin.video.amazon/?mode="movies"&sitemode="addMoviesdb")' ) ) updatemovie.append( ('Recent Movies Refresh(DB)', 'XBMC.RunPlugin(plugin://plugin.video.amazon/?mode="movies"&sitemode="addNewMoviesdb")' ) ) common.addDir('Movies','listmovie','LIST_MOVIE_ROOT', cm=updatemovie) updatetv = [] updatetv.append( ('Export TV Favorites to Library', 'XBMC.RunPlugin(plugin://plugin.video.amazon/?mode="xbmclibrary"&sitemode="LIST_TVSHOWS")' ) ) updatetv.append( ('Full Television Refresh(DB)', 'XBMC.RunPlugin(plugin://plugin.video.amazon/?mode="tv"&sitemode="addTVdb")' ) ) #updatetv.append( ('Update New Television', 'XBMC.RunPlugin(%s?mode="tv"&sitemode="addNewTVdb")' % ( sys.argv[0] ) ) ) updatetv.append( ('Scan TVDB(DB)', 'XBMC.RunPlugin(plugin://plugin.video.amazon/?mode="tv"&sitemode="scanTVDBshows")' ) ) updatetv.append( ('Delete User Database', 'XBMC.RunPlugin(plugin://plugin.video.amazon/?mode="tv"&sitemode="deleteUserDatabase")' ) ) updatetv.append( ('Delete Backup Database', 'XBMC.RunPlugin(plugin://plugin.video.amazon/?mode="tv"&sitemode="deleteBackupDatabase")' ) ) #updatetv.append( ('Fix HD Shows', 'XBMC.RunPlugin(%s?mode="tv"&sitemode="fixHDshows")' % ( sys.argv[0] ) ) ) #updatetv.append( ('Fix Genres', 'XBMC.RunPlugin(%s?mode="tv"&sitemode="fixGenres")' % ( sys.argv[0] ) ) ) #updatetv.append( ('Fix Years', 'XBMC.RunPlugin(%s?mode="tv"&sitemode="fixYears")' % ( sys.argv[0] ) ) ) common.addDir('Television','listtv','LIST_TV_ROOT', cm=updatetv) common.addDir('Search Prime','searchprime','SEARCH_PRIME','http://www.amazon.com/s?ie=UTF8&field-is_prime_benefit=1&rh=n%3A2858778011%2Ck%3A') if common.addon.getSetting('enablelibrary') == 'true': common.addDir('My Library','library','LIBRARY_ROOT') xbmcplugin.endOfDirectory(pluginhandle) else: exec 'import resources.lib.%s as sitemodule' % common.args.mode exec 'sitemodule.%s()' % common.args.sitemode
def GetPlaylists(url): url = '{0}player/getplayerdata?rootId={1}'.format(apiUrl, channels[url]['rootId']) playlist = common.OpenURL(url, headers=headers, responseMethod='json') for item in playlist['musicChannels']: name = common.GetLabelColor(item['name'], keyColor="chColor") common.addDir(name, item['fileUrl'], 2, 'https://glz.co.il{0}'.format(item['playerImage']), infos={"Title": name}, module=module, isFolder=False, isPlayable=True)
def SEARCH_PRIME(): keyboard = xbmc.Keyboard('')#Put amazon prime video link here.') keyboard.doModal() q = keyboard.getText() if (keyboard.isConfirmed()): xbmcplugin.setContent(0, 'Movies')#int(sys.argv[1]) url = common.args.url + ( urllib.quote_plus(keyboard.getText())) + "%2Cp_85%3A2470955011&page=1" data = common.getURL(url,useCookie=False) tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) #videos = tree.findAll('div',attrs={'class':re.compile("^result.+product$"),'name':True}) atf = tree.find(attrs={'id':'atfResults'}).findAll('div',recursive=False,attrs={'name':True}) try: btf = tree.find(attrs={'id':'btfResults'}).findAll('div',recursive=False,attrs={'name':True}) atf.extend(btf) del btf except: print 'AMAZON: No btf found' del tree del data #nextpage = tree.find(attrs={'title':'Next page','id':'pagnNextLink','class':'pagnNext'}) totalItems = len(atf) print totalItems for video in atf: #price = video.find('span',attrs={'class':'price'}) #print price #if (price != None and price.string != None and price.string.strip() == '$0.00'): asin = video['name'] movietitle = video.find('',attrs={'class':'data'}).a.string url = video.find('div',attrs={'class':'data'}).a['href'] # thumb = video.find('img')['src'].replace('._AA160_','') # was SS160 for purchased tv/movies, regular search is just this fanart = thumb infoLabels = { 'Title':movietitle} prices = video.findAll(attrs={'class':'priceInfo'}) episodes = False for price in prices: if 'episode' in price.renderContents(): episodes = True if episodes: common.addDir(movietitle,'library','LIST_EPISODES', url,thumb,fanart,infoLabels) else: fanart = fanart.replace('.jpg','._BO354,0,0,0_CR177,354,708,500_.jpg') common.addVideo(movietitle,url,thumb,fanart,infoLabels=infoLabels,totalItems=totalItems) #viewenable=common.addon.getSetting("viewenable") #if viewenable == 'true': # view=int(xbmcplugin.getSetting(pluginhandle,"movieview")) # xbmc.executebuiltin("Container.SetViewMode("+str(confluence_views[view])+")") xbmcplugin.endOfDirectory(pluginhandle)
def LIST_TVSHOWS_TYPES(type=False): import tv as tvDB if not type: type = common.args.url if type=='GENRE': mode = 'LIST_TVSHOWS_GENRE_FILTERED' items = tvDB.getShowTypes('genres') elif type=='NETWORKS': mode = 'LIST_TVSHOWS_NETWORKS_FILTERED' items = tvDB.getShowTypes('network') elif type=='YEARS': mode = 'LIST_TVSHOWS_YEARS_FILTERED' items = tvDB.getShowTypes('year') elif type=='CREATORS': mode = 'LIST_TVSHOWS_CREATORS_FILTERED' items = tvDB.getShowTypes('creator') for item in items: common.addDir(item,'listtv',mode,item) xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL) xbmcplugin.endOfDirectory(pluginhandle,updateListing=False)
def MOVIE_VIDEOS(): xbmcplugin.setContent(pluginhandle, 'Movies') url = BASE + common.args.url data = common.getURL(url) tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) try:fanart = tree.find('div',attrs={'class':'more-images wallpapers'}).find('img')['src'].replace('thumbs/','') except: try:fanart = re.compile("\('(.*?)'\)").findall(tree.find('div',attrs={'id':'playerposter'})['style'])[0] except:fanart = '' checkdata = common.getURL('http://www.epixhd.com/epx/ajax/theater/soloplayer'+common.args.url) if 'This movie is not currently playing on EPIX' not in data and 'outofwindow' not in checkdata: movie_id = re.compile('csa_movie_id = "movie_(.*?)";').findall(data)[0] inqueue = CHECK_QUEUE(movie_id) movietitle = tree.find('h1',attrs={'class':'movie_title'}).string try: plot = tree.find('div',attrs={'class':'synP'}).renderContents() tags = re.compile(r'<.*?>') plot = tags.sub('', plot).strip() except: plot = '' mpaa = tree.find('span',attrs={'id':'rating'})['class'] metadata = tree.find('span',attrs={'class':'genres'}).findAll('span',recursive=False) genredata = tree.find('span',attrs={'class':'genres'}).findAll('a') genre = '' for item in genredata: genre +=item.string+',' genre = genre[:-1] if len(metadata) == 3: year = int(tree.find('span',attrs={'class':'genres'}).contents[0].strip()) runtime = metadata[1].string.replace('mins','').strip() else: year = int(metadata[0].string) runtime = metadata[2].string.replace('mins','').strip() try: poster = tree.find('div',attrs={'class':'more-images posters'}).find('img')['src'].replace('thumbs/','') except: poster = '' infoLabels={ "Title": movietitle, 'plot':plot, 'mpaa':mpaa, 'duration':runtime, 'year':year, 'genre':genre} common.addVideo('Play Movie: '+movietitle,common.args.url,poster,fanart,infoLabels=infoLabels) if inqueue: common.addDir('Remove from Queue','movie','REMOVE_QUEUE',movie_id,poster,fanart,infoLabels=infoLabels) else: common.addDir('Add to Queue','movie','ADD_QUEUE',movie_id,poster,fanart,infoLabels=infoLabels) for item in tree.findAll('div',attrs={'class':re.compile('more-videos ')}): name = item.find('h5').string thumb = item.find('img')['src'].replace('thumbs/','') common.addDir(name,'movie','MOVIE_EXTRAS',url,thumb,fanart) #view=int(common.addon.getSetting("movieview")) xbmc.executebuiltin("Container.SetViewMode("+str(confluence_views[3])+")") xbmcplugin.endOfDirectory(pluginhandle)
def LIST_MOVIE_ROOT(): cm = [('Export Favorited to Library', 'XBMC.RunPlugin(plugin://plugin.video.amazon?mode="listmovie"&sitemode="LIST_MOVIES_FAVOR_FILTERED_EXPORT"&url="")' ) ] common.addDir('Favorited','listmovie','LIST_MOVIES_FAVOR_FILTERED',cm=cm) cm = [('Export All to Library', 'XBMC.RunPlugin(plugin://plugin.video.amazon?mode="listmovie"&sitemode="LIST_MOVIES_EXPORT"&url="")' ) ] common.addDir('All Movies','listmovie','LIST_MOVIES',cm=cm) #common.addDir('Alphabetical','listmovie','LIST_MOVIE_AZ') common.addDir('Genres','listmovie','LIST_MOVIE_TYPES','GENRE') common.addDir('Years','listmovie','LIST_MOVIE_TYPES','YEARS') common.addDir('Studios','listmovie','LIST_MOVIE_TYPES','STUDIOS') common.addDir('MPAA Rating','listmovie','LIST_MOVIE_TYPES','MPAA') common.addDir('Directors','listmovie','LIST_MOVIE_TYPES','DIRECTORS') #common.addDir('Actors','listmovie','LIST_MOVIE_TYPES','ACTORS') cm = [('Export Watched to Library', 'XBMC.RunPlugin(plugin://plugin.video.amazon?mode="listmovie"&sitemode="LIST_MOVIES_WATCHED_FILTERED_EXPORT"&url="")' ) ] common.addDir('Watched History','listmovie','LIST_MOVIES_WATCHED_FILTERED',cm=cm) xbmcplugin.endOfDirectory(pluginhandle)
def ADD_SEASON_ITEM(seasondata, mode="listtv", submode="LIST_EPISODES_DB", seriesTitle=False, inWatchlist=False): # asin,episodeFeed,poster,season,seriestitle,plot,actors,studio,mpaa,genres,premiered,year,stars,votes,episodetotal,watched,unwatched,isHD,isprime asin, seriesASIN, episodeFeed, poster, season, seriestitle, plot, actors, network, mpaa, genres, premiered, year, stars, votes, episodetotal, watched, unwatched, isHD, isprime = ( seasondata ) infoLabels = {"Title": seriestitle, "TVShowTitle": seriestitle} if plot: infoLabels["Plot"] = plot if mpaa: infoLabels["MPAA"] = mpaa if actors: infoLabels["Cast"] = actors.split(",") if year: infoLabels["Year"] = year if premiered: infoLabels["Premiered"] = premiered if stars: infoLabels["Rating"] = stars if votes: infoLabels["Votes"] = votes if genres: infoLabels["Genre"] = genres if episodetotal: infoLabels["Episode"] = episodetotal if season: infoLabels["Season"] = season if network: infoLabels["Studio"] = network if mode == "listtv": url = seriestitle + "<split>" + str(season) if isHD: submode = "LIST_HDEPISODES_DB" elif mode == "appfeed": url = asin if isHD: submode = "BROWSE_EPISODES_HD" else: url = asin if seriesTitle: displayname = seriestitle + " " else: displayname = "" if season <> 0 and len(str(season)) < 3: displayname += "Season " + str(season) elif len(str(season)) > 2: displayname += "Year " + str(season) else: displayname += "Specials" if isHD: displayname += " [COLOR FFE47911][HD][/COLOR]" cm = [] # if inWatchlist: # cm.append( ('Remove from Watchlist', 'XBMC.RunPlugin(%s?mode="common"&sitemode="removeTVWatchlist"&asin="%s")' % ( sys.argv[0], urllib.quote_plus(asin) ) ) ) # else: # cm.append( ('Add to Watchlist', 'XBMC.RunPlugin(%s?mode="common"&sitemode="addTVWatchlist"&asin="%s")' % ( sys.argv[0], urllib.quote_plus(asin) ) ) ) cm.append( ( "Export to Library", 'XBMC.RunPlugin(plugin://plugin.video.amazon?mode="xbmclibrary"&sitemode="EXPORT_SEASON"&asin="%s")' % (urllib.quote_plus(asin)), ) ) # if common.addon.getSetting("editenable") == 'true': # cm.append( ('Rename Season', 'XBMC.RunPlugin(%s?mode="tv"&sitemode="renameSeasondb"&title="%s"&season="%s"&asin="%s")' % ( sys.argv[0], urllib.quote_plus(seriestitle), str(season),urllib.quote_plus(asin) ) ) ) # cm.append( ('Remove Season', 'XBMC.RunPlugin(%s?mode="tv"&sitemode="deleteSeasondb"&title="%s"&season="%s"&asin="%s")' % ( sys.argv[0], urllib.quote_plus(seriestitle), str(season),urllib.quote_plus(asin) ) ) ) # try:fanart = common.args.fanart # except: fanart = poster common.addDir(displayname, mode, submode, url, poster, fanart, infoLabels, cm=cm)