def addMovietoWatchlist(imdbid): response = traktlib.addMovietoWatchlist(imdbid) common.traktResponse(response) movies = traktlib.getWatchlistMoviesFromTrakt() for movie in movies: common.createMovieStrm(movie['title'],movie['year'],movie['imdb_id']) common.createMovieNfo(movie['title'],movie['year'],movie['imdb_id']) xbmc.executebuiltin('UpdateLibrary(video)')
def addToXbmcLib(fg=None): totalAdded = 0 if settings.getSetting("auto_addImdb") == 'true': url = settings.getSetting("imdb_watchlist") imdbmovies = imdb.watchlist_movies(url, 0) traktlib.addMoviestoWatchlist(imdbmovies) imdbshows = imdb.watchlist_shows(url, 0) traktlib.addShowstoWatchList(imdbshows) if settings.getSetting("add_trending") == 'true': if fg == 'True': common.Notification('Getting:', 'Trending') movies = traktlib.getTrendingMoviesFromTrakt() if movies: for movie in movies: if not movie['watched'] and movie['watchers'] > 1: totalAdded = totalAdded + common.createMovieStrm(movie['title'], movie['year'], movie['imdb_id']) common.createMovieNfo(movie['title'], movie['year'], movie['imdb_id']) if settings.getSetting("add_recommended") == True: if fg == 'True': common.Notification('Getting:', 'Recommended') movies = traktlib.getRecommendedMoviesFromTrakt() if movies: for movie in movies: totalAdded = totalAdded + common.createMovieStrm(movie['title'], movie['year'], movie['imdb_id']) common.createMovieNfo(movie['title'], movie['year'], movie['imdb_id']) if fg == 'True': common.Notification('Getting:', 'Watchlist Movies') if settings.getSetting("add_watchlistmovies") == 'true': if fg == 'True': common.Notification('Getting:', 'Watchlist Movies') movies = traktlib.getWatchlistMoviesFromTrakt() for movie in movies: totalAdded = totalAdded + common.createMovieStrm(movie['title'], movie['year'], movie['imdb_id']) common.createMovieNfo(movie['title'], movie['year'], movie['imdb_id']) if settings.getSetting("add_watchlistshows") == 'true': if fg == 'True': common.Notification('Getting:', 'Watchlist Shows') totalAdded = totalAdded + getWatchlistShows() if fg == 'True': common.Notification('Total:', str(totalAdded)) return totalAdded
def addToXbmcLib(fg = None): totalAdded=0 if fg == 'True': common.Notification('Getting:','Trending') movies = traktlib.getTrendingMoviesFromTrakt() if movies: for movie in movies: if not movie['watched'] and movie['watchers']>1: totalAdded = totalAdded + common.createMovieStrm(movie['title'],movie['year'],movie['imdb_id']) common.createMovieNfo(movie['title'],movie['year'],movie['imdb_id']) if fg == 'True': common.Notification('Getting:','Recommended') movies = traktlib.getRecommendedMoviesFromTrakt() if movies: for movie in movies: totalAdded = totalAdded + common.createMovieStrm(movie['title'],movie['year'],movie['imdb_id']) common.createMovieNfo(movie['title'],movie['year'],movie['imdb_id']) if fg == 'True': common.Notification('Getting:','Watchlist Movies') movies = traktlib.getWatchlistMoviesFromTrakt() for movie in movies: totalAdded = totalAdded + common.createMovieStrm(movie['title'],movie['year'],movie['imdb_id']) common.createMovieNfo(movie['title'],movie['year'],movie['imdb_id']) if fg == 'True': common.Notification('Getting:','Calendar Shows') d = datetime.date.today() + datetime.timedelta(days=-8) currentdate = d.strftime('%Y%m%d') series = traktlib.getShowsCalendarFromTrakt(currentdate) for show in series: episodes = show['episodes'] for episode in episodes: myepisode = episode['episode'] myshow = episode['show'] totalAdded = totalAdded + common.createShowStrm(myshow['title'],myepisode['season'],myepisode['number'],myshow['tvdb_id']) if fg == 'True': common.Notification('Getting:','Watchlist Shows') totalAdded = totalAdded + getWatchlistShows() if fg == 'True': common.Notification('Total:', str(totalAdded)) return totalAdded
def addImdbToLib(fg): if fg == 'True': common.Notification('Getting:','IMDB Top Rentals') totalAdded = 0 response = urllib2.urlopen('http://www.imdb.com/boxoffice/rentals') html = response.read() #entries = re.findall(r'<tr align=right><td><b>(\d{1,3})</b>\.</td><td align=center>(\d{1,3})</td><a href="/title/tt(\d{7})/">([^<]+)</a> \((\d{4})\)</b></td><td>(\d{1,3}(?:,\d{3})*)</td></tr>', html) entries = re.findall(r'<td align=left><b><a href="/title/tt(\d{7})/">([^<]+)</a> \((\d{4})\)</b></td>',html) for entry in entries: link_number,title,year = entry created = common.createMovieStrm(title,year,'tt'+link_number) totalAdded = totalAdded + created common.createMovieNfo(title,year,'tt'+link_number) return totalAdded
elif(params['action'] == 'vcdq'): url1 = "http://www.vcdq.com/browse/rss/1/0/0/10_9_11_3_2_6_4/0/0/0" xbmcplugin.setContent(int(sys.argv[1]), 'movies') vcdq.getVCDQ(url1) elif(params['action'] == 'torrentfreak'): xbmcplugin.setContent(int(sys.argv[1]), 'movies') url1 = "http://torrentfreak.com/category/dvdrip/feed/" torrentfreak.getpopular(url1) elif(params['action'] == 'scrapeMovie'): title = params['title'] year = params['year'] common.createMovieStrm(title,year,MOVIES_PATH) common.Notification ('Added to library:',title) xbmc.executebuiltin('Library(video)') elif(params['action'] == 'Trailers'): #xbmc.executebuiltin("XBMC.RunScript(special://home/addons/script.furktrailers/default.py)") xbmc.executebuiltin("XBMC.RunScript(special://home/addons/plugin.video.furklibraryx/trailers.py)") elif(params['action'] == 'SearchMe'): # Search type = params['type'] year= 0 season = 0 episode = 0 movie = None if type=='Show':
def musicAction(params): if (params['action'] == 'about'): # Play a file collector.Notification(__plugin__, __version__) elif (params['action'] == 'music_search'): # Search keyboard = xbmc.Keyboard('', 'Search') keyboard.doModal() if keyboard.isConfirmed(): query = keyboard.getText() searcher.SearchFromMenu(query) elif (params['action'] == 'music_myFiles'): searcher.getMyFiles() elif (params['action'] == 'listFiles'): id = params['id'] searcher.ListFiles(id) elif (params['action'] == 'movielens'): # Search movielens.displayMovieLensmenu() elif (params['action'] == 'movielensUrl'): # Search url = params['url'] xbmcplugin.setContent(int(sys.argv[1]), 'movies') movielens.getMovieLens(url) common.endofDir() elif (params['action'] == 'criticker'): # Search xbmcplugin.setContent(int(sys.argv[1]), 'movies') criticker.getCriticker() elif (params['action'] == 'vcdq'): url1 = "http://www.vcdq.com/browse/rss/1/0/0/10_9_11_3_2_6_4/0/0/0" xbmcplugin.setContent(int(sys.argv[1]), 'movies') vcdq.getVCDQ(url1) elif (params['action'] == 'torrentfreak'): xbmcplugin.setContent(int(sys.argv[1]), 'movies') url1 = "http://torrentfreak.com/category/dvdrip/feed/" torrentfreak.getpopular(url1) elif (params['action'] == 'scrapeMovie'): title = params['title'] year = params['year'] common.createMovieStrm(title, year, MOVIES_PATH) common.Notification('Added to library:', title) xbmc.executebuiltin('UpdateLibrary(video)') elif (params['action'] == 'SearchMe'): # Search type = params['type'] year = 0 season = 0 episode = 0 movie = None if type == 'Show': type = params['type'] season = params['season'] episode = params['episode'] title = params['title'] try: tvdbid = params['tvdbid'] except: tvdbid = None if tvdbid: episodedata = traktlib.getEpisodeInfo(tvdbid, season, episode) else: episodedata = None elif type == 'Movie': title = params['title'] year = params['year'] imdbid = params['imdbid'] movie = common.getMovieInfobyImdbid(imdbid) else: type = 'Movie' title = params['query'] try: go = params['go'] go = True except: go = False myname, myurl = searcher.SearchDialog(type, title, year, season, episode) if myurl: #common.Notification("Found"," and playing!") time.sleep(1) listitem = xbmcgui.ListItem(myname, path=myurl) listitem.setLabel(myname) listitem.setProperty("IsPlayable", "true") if movie: common.addMovieInfotoPlayListitem(listitem, movie) #common.Notification("Found"," Movie!") elif episodedata: common.addEpisodeInfotoListitem(listitem, episodedata) xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, listitem) print myname print myurl if go: xbmc.Player().play(myurl, listitem) else: xbmcplugin.setResolvedUrl(int(sys.argv[1]), False, xbmcgui.ListItem()) elif (params['action'].startswith('imdb_')): imdb.imdbAction(params) elif (params['action'].startswith('trakt_')): trakt.traktAction(params) elif (params['action'].startswith('rotten_')): rotten.rottenAction(params) elif (params['action'] == 'traktlib'): try: fg = params['fg'] except: fg = 'True' totalAdded = trakt.addToXbmcLib(fg) totalAdded += imdb.addImdbToLib(fg) if totalAdded > 0: common.Notification('Furk-Trakt', '{0} were added'.format(totalAdded)) xbmc.executebuiltin('UpdateLibrary(video)') if fg == 'False': settings.startTimer() elif (params['action'] == 'download'): url = params['url'] filename = params['filename'] common.download(url, filename) elif (params['action'] == 'setup'): settings.setSetting('first_time_startup', 'true') FIRST_TIME_STARTUP = settings.first_time_startup() setup() else: # torrents a root Directories xbmc.log('argv=%s' % sys.argv) if (MYCONTEXT == 'video'): common.createCachePath() setup() AddonMenu() else: music.MusicMenu() print 'Closing FurkLib'
def musicAction(params): if(params['action'] == 'about'): # Play a file collector.Notification(__plugin__,__version__) elif(params['action'] == 'music_search'): # Search keyboard = xbmc.Keyboard('', 'Search') keyboard.doModal() if keyboard.isConfirmed(): query = keyboard.getText() searcher.SearchFromMenu(query) elif(params['action'] == 'music_myFiles'): searcher.getMyFiles() elif(params['action'] == 'listFiles'): id = params['id'] searcher.ListFiles(id) elif(params['action'] == 'movielens'): # Search movielens.displayMovieLensmenu() elif(params['action'] == 'movielensUrl'): # Search url = params['url'] xbmcplugin.setContent(int(sys.argv[1]), 'movies') movielens.getMovieLens(url) common.endofDir() elif(params['action'] == 'criticker'): # Search xbmcplugin.setContent(int(sys.argv[1]), 'movies') criticker.getCriticker() elif(params['action'] == 'vcdq'): url1 = "http://www.vcdq.com/browse/rss/1/0/0/10_9_11_3_2_6_4/0/0/0" xbmcplugin.setContent(int(sys.argv[1]), 'movies') vcdq.getVCDQ(url1) elif(params['action'] == 'torrentfreak'): xbmcplugin.setContent(int(sys.argv[1]), 'movies') url1 = "http://torrentfreak.com/category/dvdrip/feed/" torrentfreak.getpopular(url1) elif(params['action'] == 'scrapeMovie'): title = params['title'] year = params['year'] common.createMovieStrm(title,year,MOVIES_PATH) common.Notification ('Added to library:',title) xbmc.executebuiltin('UpdateLibrary(video)') elif(params['action'] == 'SearchMe'): # Search type = params['type'] year= 0 season = 0 episode = 0 movie = None if type=='Show': type = params['type'] season = params['season'] episode = params['episode'] title = params['title'] try: tvdbid = params['tvdbid'] except: tvdbid = None if tvdbid: episodedata = traktlib.getEpisodeInfo(tvdbid,season,episode) else: episodedata = None elif type=='Movie': title = params['title'] year = params['year'] imdbid = params['imdbid'] movie = common.getMovieInfobyImdbid(imdbid) else: type = 'Movie' title = params['query'] try: go = params['go'] go = True except: go = False myname,myurl = searcher.SearchDialog(type,title,year,season,episode) if myurl: #common.Notification("Found"," and playing!") time.sleep(1) listitem = xbmcgui.ListItem(myname, path=myurl) listitem.setLabel(myname) listitem.setProperty("IsPlayable", "true") if movie: common.addMovieInfotoPlayListitem(listitem,movie) #common.Notification("Found"," Movie!") elif episodedata: common.addEpisodeInfotoListitem(listitem,episodedata) xbmcplugin.setResolvedUrl(int(sys.argv[ 1 ]),True,listitem) print myname print myurl if go: xbmc.Player().play(myurl, listitem) else: xbmcplugin.setResolvedUrl(int(sys.argv[ 1 ]),False,xbmcgui.ListItem()) elif(params['action'].startswith('imdb_')): imdb.imdbAction(params) elif(params['action'].startswith('trakt_')): trakt.traktAction(params) elif(params['action'].startswith('rotten_')): rotten.rottenAction(params) elif(params['action'] == 'traktlib'): try: fg = params['fg'] except: fg = 'True' totalAdded = trakt.addToXbmcLib(fg) totalAdded += imdb.addImdbToLib(fg) if totalAdded>0: common.Notification('Furk-Trakt', '{0} were added'.format(totalAdded)) xbmc.executebuiltin('UpdateLibrary(video)') if fg=='False': settings.startTimer() elif(params['action'] == 'download'): url = params['url'] filename = params['filename'] common.download(url,filename) elif(params['action'] == 'setup'): settings.setSetting('first_time_startup','true') FIRST_TIME_STARTUP = settings.first_time_startup() setup() else: # torrents a root Directories xbmc.log('argv=%s' % sys.argv) if (MYCONTEXT == 'video'): common.createCachePath() setup() AddonMenu() else: music.MusicMenu() print 'Closing FurkLib'
criticker.getCriticker() elif (params['action'] == 'vcdq'): url1 = "http://www.vcdq.com/browse/rss/1/0/0/10_9_11_3_2_6_4/0/0/0" xbmcplugin.setContent(int(sys.argv[1]), 'movies') vcdq.getVCDQ(url1) elif (params['action'] == 'torrentfreak'): xbmcplugin.setContent(int(sys.argv[1]), 'movies') url1 = "http://torrentfreak.com/category/dvdrip/feed/" torrentfreak.getpopular(url1) elif (params['action'] == 'scrapeMovie'): title = params['title'] year = params['year'] common.createMovieStrm(title, year, MOVIES_PATH) common.Notification('Added to library:', title) xbmc.executebuiltin('Library(video)') elif (params['action'] == 'Trailers'): #xbmc.executebuiltin("XBMC.RunScript(special://home/addons/script.furktrailers/default.py)") xbmc.executebuiltin( "XBMC.RunScript(special://home/addons/plugin.video.furklibraryx/trailers.py)" ) elif (params['action'] == 'SearchMe'): # Search type = params['type'] year = 0 season = 0 episode = 0