def traktlist(index,url): listdirs = [] if url == 'Popular': listdirs = trakt.listmovies(links.link().trakt_popular,index) elif url == 'Trending': listdirs = trakt.listmovies(links.link().trakt_trending,index) for j in listdirs: addDir(j['label'],j['imdbid'],2,j['poster'],False,len(listdirs)+1,j['info'],'',j['imdbid'],j['year'],j['originallabel'],j['fanart_image']) #addDir(language(30018)+'>>',url,15,'',True,len(listdirs)+1,'',int(index)+1,'','','') movies_view()
def cnmglist(index, url, originalname, year=''): listdirs = [] if year == 'liste' or year == 'filme': listdirs = cnmg.listmovies(url, year) for j in listdirs: addDir(j['label'], j['imdbid'], 2, j['poster'], False, len(listdirs) + 1, j['info'], '', j['imdbid'], j['year'], j['originallabel'], j['fanart_image']) addDir( language(30018) + '>>', (url + '?&pn=' + str(int(index) + 1)), 19, '', True, 1, '', int(index) + 1, '', 'filme', '') #with open('/root/.kodi/temp/files.py', 'wb') as f: f.write(repr((url+'?&pn='+str(int(index)+1)))) movies_view() if url == 'liste': liste = cnmg.getliste(links.link().cnmg_liste % (index)) for lista in liste: addDir(lista[3], lista[2], 19, lista[1], True, 1, lista[4], 1, '', 'liste', '') addDir( language(30018) + '>>', url, 19, '', True, len(liste) + 1, '', int(index) + 1, '', '', '', '') elif url == 'tari': tari = cnmg.gettari(links.link().cnmg_filme % ('1'), url) for tara in tari: addDir(tara[2], tara[1], 19, '', True, 1, '', 1, '', 'filme', '') elif url == 'gen': genuri = cnmg.gettari(links.link().cnmg_filme % ('1'), url) for gen in genuri: gen_n = cnmg.striphtml(gen[2]) if not gen_n == '': addDir(gen_n, gen[1], 19, '', True, 1, '', 1, '', 'filme', '')
def playcount_movies(title, year, imdb, watched): title = title.split(' (')[0] basic.log(u"main.playcount_movies %s, %s, %s, %s" % (title, year, imdb, watched)) try: metaget.get_meta('movie', title, year=year) metaget.change_watched('movie', '', imdb, season='', episode='', year='', watched=watched) except: pass try: if getSetting("trakt_sync") == 'true': if (links.link().trakt_user == '' or links.link().trakt_password == ''): raise Exception() if not imdb.startswith('tt'): imdb = 'tt' + imdb if watched == 7: url = links.link().trakt_history else: url = links.link().trakt_history_remove result = trakt.results(url, post={"movies": [{ "ids": { "imdb": imdb } }]}) basic.log(u"main.playcount_movies trakt result %s" % (result)) except: pass xbmc.executebuiltin("Container.Refresh")
def MAIN(): addDir(language(30000),'LatestReleases',3,'',True,7,'',0,'','','') addDir(language(30001),'TMDB',6,'',True,7,'',0,'','','') addDir(language(30002),'IMDB',4,'',True,7,'',0,'','','') if links.link().trakt_apikey <> '': addDir(language(30047),'trakt',14,'',True,7,'',0,'','','') if links.link().rotten_key <> '': addDir(language(30074),'rotten',16,'',True,7,'',0,'','','') addDir(language(30003),'search',7,'',True,7,'',0,'','','') addDir(language(30004),'Tools',9,'',True,7,'',0,'','','') menus_view()
def traktlist(index, url): listdirs = [] if url == 'Popular': listdirs = trakt.listmovies(links.link().trakt_popular, index) elif url == 'Trending': listdirs = trakt.listmovies(links.link().trakt_trending, index) for j in listdirs: addDir(j['label'], j['imdbid'], 2, j['poster'], False, len(listdirs) + 1, j['info'], '', j['imdbid'], j['year'], j['originallabel'], j['fanart_image']) #addDir(language(30018)+'>>',url,15,'',True,len(listdirs)+1,'',int(index)+1,'','','') movies_view()
def MAIN(): addDir(language(30000), 'LatestReleases', 3, '', True, 7, '', 0, '', '', '') addDir(language(30001), 'TMDB', 6, '', True, 7, '', 0, '', '', '') addDir(language(30002), 'IMDB', 4, '', True, 7, '', 0, '', '', '') if links.link().trakt_apikey <> '': addDir(language(30047), 'trakt', 14, '', True, 7, '', 0, '', '', '') if links.link().rotten_key <> '': addDir(language(30074), 'rotten', 16, '', True, 7, '', 0, '', '', '') addDir(language(30003), 'search', 7, '', True, 7, '', 0, '', '', '') addDir(language(30004), 'Tools', 9, '', True, 7, '', 0, '', '', '') menus_view()
def addDir(name,url,mode,poster,pasta,total,info,index,imdb_id,year,originalname,fanart=None): u=sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&name="+urllib.quote_plus(name.encode('ascii','xmlcharrefreplace'))+"&originalname="+urllib.quote_plus(originalname.encode('ascii','xmlcharrefreplace'))+"&index="+str(index)+"&imdb_id="+str(imdb_id)+"&year="+str(year) ok=True context = [] playcount = 0 liz=xbmcgui.ListItem(name, iconImage=poster, thumbnailImage=poster) liz.setProperty('fanart_image',fanart) try: playcount = metaget._get_watched('movie', imdb_id, '', '') if playcount == 7: info.update({'playcount': 1, 'overlay': 7}) else: info.update({'playcount': 0, 'overlay': 6}) except: pass if info <> '': liz.setInfo( type="Video", infoLabels=info ) try: trailer = info['trailer'].split('videoid=')[1] context.append((language(30019), 'RunPlugin(%s?mode=1&url=%s&name=%s)' % (sys.argv[0],trailer,urllib.quote_plus(originalname.encode('ascii','xmlcharrefreplace'))))) except: pass context.append((language(30020), 'Action(Info)')) if playcount == 7: context.append((language(30064), 'RunPlugin(%s?mode=13&url=%s&originalname=%s&year=%s&imdb_id=%s)' % (sys.argv[0],url,urllib.quote_plus(originalname.encode('ascii','xmlcharrefreplace')),year,imdb_id))) else: context.append((language(30063), 'RunPlugin(%s?mode=12&url=%s&originalname=%s&year=%s&imdb_id=%s)' % (sys.argv[0],url,urllib.quote_plus(originalname.encode('ascii','xmlcharrefreplace')),year,imdb_id))) if AddonsResolver == True: try: title = originalname.split(' (')[0] except: title = originalname context.append((language(30310), 'RunPlugin(%s?action=library&url=%s&name=%s&year=%s&imdbid=%s)' % (links.link().addon_plugin,url,urllib.quote_plus(title.encode('ascii','xmlcharrefreplace')),year,imdb_id))) context.append((language(30006), 'RunPlugin(%s?mode=10&url=%s)' % (sys.argv[0],links.link().addon_plugin))) liz.addContextMenuItems(context, replaceItems=False) ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=pasta,totalItems=total) return ok
def playcount_movies(title, year, imdb, watched): title = title.split(' (')[0] basic.log(u"main.playcount_movies %s, %s, %s, %s" % (title, year, imdb, watched)) try: metaget.get_meta('movie', title ,year=year) metaget.change_watched('movie', '', imdb, season='', episode='', year='', watched=watched) except: pass try: if getSetting("trakt_sync") == 'true': if (links.link().trakt_user == '' or links.link().trakt_password == ''): raise Exception() if not imdb.startswith('tt'): imdb = 'tt' + imdb if watched == 7: url = links.link().trakt_history else: url = links.link().trakt_history_remove result = trakt.results(url, post={"movies": [{"ids": {"imdb": imdb}}]}) basic.log(u"main.playcount_movies trakt result %s" % (result)) except: pass xbmc.executebuiltin("Container.Refresh")
def IMDBlist2(index,url,originalname): listdirs = [] if url == 'top250': listdirs = imdb.listmovies(links.link().imdb_top250) elif url == 'bot100': listdirs = imdb.listmovies(links.link().imdb_bot100) elif url == 'boxoffice': listdirs = imdb.listmovies(links.link().imdb_boxoffice % (index)) elif url == 'most_voted': listdirs = imdb.listmovies(links.link().imdb_most_voted % (index)) elif url == 'oscars': listdirs = imdb.listmovies(links.link().imdb_oscars % (index)) elif url == 'popular': listdirs = imdb.listmovies(links.link().imdb_popular % (index)) elif url == 'theaters': listdirs = imdb.listmovies(links.link().imdb_theaters) elif url == 'coming_soon': listdirs = imdb.listmovies(links.link().imdb_coming_soon) elif url == 'popularbygenre': if index == '1': originalname = imdb.getgenre(links.link().imdb_genre) listdirs = imdb.listmovies(links.link().imdb_popularbygenre % (index,originalname)) for j in listdirs: addDir(j['label'],j['imdbid'],2,j['poster'],False,len(listdirs)+1,j['info'],'',j['imdbid'],j['year'],j['originallabel'],j['fanart_image']) if url <> 'top250' and url <> 'bot100' and url <> 'theaters' and url <> 'coming_soon': if url == 'popularbygenre': addDir(language(30018)+'>>',url,11,'',True,len(listdirs)+1,'',int(index)+30,'','',originalname,'') else: addDir(language(30018)+'>>',url,11,'',True,len(listdirs)+1,'',int(index)+30,'','','','') movies_view()
def TMDBlist(index, url): listdirs = [] if url == 'search': keyb = xbmc.Keyboard('', language(30017)) keyb.doModal() if (keyb.isConfirmed()): search = keyb.getText() encode = urllib.quote(search) listdirs = tmdb.listmovies(links.link().tmdb_search % (encode)) elif url == 'discoverpop': listdirs = tmdb.listmovies(links.link().tmdb_discover % (index)) elif url == 'Theaters': listdirs = tmdb.listmovies(links.link().tmdb_theaters % (index)) elif url == 'Popular': listdirs = tmdb.listmovies(links.link().tmdb_popular % (index)) elif url == 'Upcoming': listdirs = tmdb.listmovies(links.link().tmdb_upcoming % (index)) elif url == 'TopRated': listdirs = tmdb.listmovies(links.link().tmdb_top_rated % (index)) for j in listdirs: addDir(j['label'], j['imdbid'], 2, j['poster'], False, len(listdirs) + 1, j['info'], '', j['imdbid'], j['year'], j['originallabel'], j['fanart_image']) if url <> 'search': addDir( language(30018) + '>>', url, 7, '', True, len(listdirs) + 1, '', int(index) + 1, '', '', '') movies_view()
def rottenlist(index,url): listdirs = [] if url == 'boxoffice': listdirs = rottentomatoes.listmovies(links.link().rotten_boxoffice % (links.link().rotten_key,index)) elif url == 'theaters': listdirs = rottentomatoes.listmovies(links.link().rotten_theaters % (links.link().rotten_key,index)) elif url == 'opening': listdirs = rottentomatoes.listmovies(links.link().rotten_opening % (links.link().rotten_key,index)) elif url == 'upcoming': listdirs = rottentomatoes.listmovies(links.link().rotten_upcoming % (links.link().rotten_key,index)) elif url == 'dvdtop_rentals': listdirs = rottentomatoes.listmovies(links.link().rotten_dvdtop_rentals % (links.link().rotten_key,index)) elif url == 'dvdcurrent_releases': listdirs = rottentomatoes.listmovies(links.link().rotten_dvdcurrent_releases % (links.link().rotten_key,index)) elif url == 'dvdnew_releases': listdirs = rottentomatoes.listmovies(links.link().rotten_dvdnew_releases % (links.link().rotten_key,index)) #elif url == 'dvdupcoming': listdirs = rottentomatoes.listmovies(links.link().rotten_dvdupcoming % (links.link().rotten_key,index)) for j in listdirs: addDir(j['label'],j['imdbid'],2,j['poster'],False,len(listdirs)+1,j['info'],'',j['imdbid'],j['year'],j['originallabel'],j['fanart_image']) if url == 'theaters' or ('dvd' in url and url <> 'dvdtop_rentals'): addDir(language(30018)+'>>',url,17,'',True,len(listdirs)+1,'',int(index)+1,'','','') movies_view()
def IMDBlist2(index, url, originalname): listdirs = [] if url == 'top250': listdirs = imdb.listmovies(links.link().imdb_top250) elif url == 'bot100': listdirs = imdb.listmovies(links.link().imdb_bot100) elif url == 'boxoffice': listdirs = imdb.listmovies(links.link().imdb_boxoffice % (index)) elif url == 'most_voted': listdirs = imdb.listmovies(links.link().imdb_most_voted % (index)) elif url == 'oscars': listdirs = imdb.listmovies(links.link().imdb_oscars % (index)) elif url == 'popular': listdirs = imdb.listmovies(links.link().imdb_popular % (index)) elif url == 'theaters': listdirs = imdb.listmovies(links.link().imdb_theaters) elif url == 'coming_soon': listdirs = imdb.listmovies(links.link().imdb_coming_soon) elif url == 'popularbygenre': if index == '1': originalname = imdb.getgenre(links.link().imdb_genre) listdirs = imdb.listmovies(links.link().imdb_popularbygenre % (index, originalname)) for j in listdirs: addDir(j['label'], j['imdbid'], 2, j['poster'], False, len(listdirs) + 1, j['info'], '', j['imdbid'], j['year'], j['originallabel'], j['fanart_image']) if url <> 'top250' and url <> 'bot100' and url <> 'theaters' and url <> 'coming_soon': if url == 'popularbygenre': addDir( language(30018) + '>>', url, 11, '', True, len(listdirs) + 1, '', int(index) + 30, '', '', originalname, '') else: addDir( language(30018) + '>>', url, 11, '', True, len(listdirs) + 1, '', int(index) + 30, '', '', '', '') movies_view()
def TMDBlist(index,url): listdirs = [] if url == 'search': keyb = xbmc.Keyboard('', language(30017)) keyb.doModal() if (keyb.isConfirmed()): search = keyb.getText() encode=urllib.quote(search) listdirs = tmdb.listmovies(links.link().tmdb_search % (encode)) elif url == 'discoverpop': listdirs = tmdb.listmovies(links.link().tmdb_discover % (index)) elif url == 'Theaters': listdirs = tmdb.listmovies(links.link().tmdb_theaters % (index)) elif url == 'Popular': listdirs = tmdb.listmovies(links.link().tmdb_popular % (index)) elif url == 'Upcoming': listdirs = tmdb.listmovies(links.link().tmdb_upcoming % (index)) elif url == 'TopRated': listdirs = tmdb.listmovies(links.link().tmdb_top_rated % (index)) for j in listdirs: addDir(j['label'],j['imdbid'],2,j['poster'],False,len(listdirs)+1,j['info'],'',j['imdbid'],j['year'],j['originallabel'],j['fanart_image']) if url <> 'search': addDir(language(30018)+'>>',url,7,'',True,len(listdirs)+1,'',int(index)+1,'','','') movies_view()
def addDir(name, url, mode, poster, pasta, total, info, index, imdb_id, year, originalname, fanart=None): u = sys.argv[0] + "?url=" + urllib.quote_plus(url) + "&mode=" + str( mode) + "&name=" + urllib.quote_plus( name.encode('ascii', 'xmlcharrefreplace') ) + "&originalname=" + urllib.quote_plus( originalname.encode( 'ascii', 'xmlcharrefreplace')) + "&index=" + str( index) + "&imdb_id=" + str(imdb_id) + "&year=" + str(year) ok = True context = [] playcount = 0 liz = xbmcgui.ListItem(name, iconImage=poster, thumbnailImage=poster) liz.setProperty('fanart_image', fanart) try: playcount = metaget._get_watched('movie', imdb_id, '', '') if playcount == 7: info.update({'playcount': 1, 'overlay': 7}) else: info.update({'playcount': 0, 'overlay': 6}) except: pass tor_title, tor_year = xbmc.getCleanMovieTitle(originalname) context.append((language( 30314 ), 'RunPlugin(plugin://plugin.video.torrenter/?action=searchWindow&mode=search&query=%s)' % (tor_title))) if info <> '': try: dur = int(info['duration']) * 60 info.update({'duration': dur}) except: pass liz.setInfo(type="Video", infoLabels=info) try: if 'cinemagia' in info['trailer']: trailer = info['trailer'] context.append( (language(30019) + ' Cinemagia', 'RunPlugin(%s?mode=20&url=%s&name=%s)' % (sys.argv[0], trailer, urllib.quote_plus( originalname.encode('ascii', 'xmlcharrefreplace'))))) else: trailer = info['trailer'].split('videoid=')[1] context.append( (language(30019), 'RunPlugin(%s?mode=1&url=%s&name=%s)' % (sys.argv[0], trailer, urllib.quote_plus( originalname.encode('ascii', 'xmlcharrefreplace'))))) except: pass context.append((language(30020), 'Action(Info)')) if playcount == 7: context.append(( language(30064), 'RunPlugin(%s?mode=13&url=%s&originalname=%s&year=%s&imdb_id=%s)' % (sys.argv[0], url, urllib.quote_plus( originalname.encode('ascii', 'xmlcharrefreplace')), year, imdb_id))) else: context.append(( language(30063), 'RunPlugin(%s?mode=12&url=%s&originalname=%s&year=%s&imdb_id=%s)' % (sys.argv[0], url, urllib.quote_plus( originalname.encode('ascii', 'xmlcharrefreplace')), year, imdb_id))) if AddonsResolver == True: try: title = originalname.split(' (')[0] except: title = originalname context.append( (language(30310), 'RunPlugin(%s?action=library&url=%s&name=%s&year=%s&imdbid=%s)' % (links.link().addon_plugin, url, urllib.quote_plus(title.encode( 'ascii', 'xmlcharrefreplace')), year, imdb_id))) context.append((language(30006), 'RunPlugin(%s?mode=10&url=%s)' % (sys.argv[0], links.link().addon_plugin))) liz.addContextMenuItems(context, replaceItems=False) ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=u, listitem=liz, isFolder=pasta, totalItems=total) return ok
def rottenlist(index, url): listdirs = [] if url == 'boxoffice': listdirs = rottentomatoes.listmovies(links.link().rotten_boxoffice % (links.link().rotten_key, index)) elif url == 'theaters': listdirs = rottentomatoes.listmovies(links.link().rotten_theaters % (links.link().rotten_key, index)) elif url == 'opening': listdirs = rottentomatoes.listmovies(links.link().rotten_opening % (links.link().rotten_key, index)) elif url == 'upcoming': listdirs = rottentomatoes.listmovies(links.link().rotten_upcoming % (links.link().rotten_key, index)) elif url == 'dvdtop_rentals': listdirs = rottentomatoes.listmovies( links.link().rotten_dvdtop_rentals % (links.link().rotten_key, index)) elif url == 'dvdcurrent_releases': listdirs = rottentomatoes.listmovies( links.link().rotten_dvdcurrent_releases % (links.link().rotten_key, index)) elif url == 'dvdnew_releases': listdirs = rottentomatoes.listmovies( links.link().rotten_dvdnew_releases % (links.link().rotten_key, index)) #elif url == 'dvdupcoming': listdirs = rottentomatoes.listmovies(links.link().rotten_dvdupcoming % (links.link().rotten_key,index)) for j in listdirs: addDir(j['label'], j['imdbid'], 2, j['poster'], False, len(listdirs) + 1, j['info'], '', j['imdbid'], j['year'], j['originallabel'], j['fanart_image']) if url == 'theaters' or ('dvd' in url and url <> 'dvdtop_rentals'): addDir( language(30018) + '>>', url, 17, '', True, len(listdirs) + 1, '', int(index) + 1, '', '', '') movies_view()
def getyearbygenre(): genre = getgenre(links.link().imdb_genre) year = getyear(links.link().imdb_year) if genre and year: return genre, year