def ADD_MOVIE_ITEM(moviedata, onlyinfo=False, cmmode=0, export=False): asin, movietitle, trailer, poster, plot, director, writer, runtime, year, premiered, studio, mpaa, actors,\ genres, stars, votes, fanart, isprime, isHD, isAdult, popularity, recent, audio = moviedata infoLabels = {'Title': movietitle, 'Plot': plot, 'mediatype': 'movie', 'Cast': actors.split(',') if actors else [], 'Director': director, 'Year': year, 'Premiered': premiered, 'Rating': stars, 'Votes': votes, 'Genre': genres, 'MPAA': mpaa if mpaa else getString(30171), 'Studio': studio, 'Duration': runtime, 'AudioChannels': audio, 'Thumb': poster, 'Fanart': fanart, 'isHD': isHD, 'isAdult': isAdult} asin = asin.split(',')[0] if export: xbmclibrary.EXPORT_MOVIE(asin) return cm = [(getString(30180 + cmmode) % getString(30154), 'RunPlugin(%s?mode=common&sitemode=toogleWatchlist&asin=%s&remove=%s)' % (sys.argv[0], asin, cmmode)), (getString(30185) % getString(30154), 'RunPlugin(%s?mode=xbmclibrary&sitemode=EXPORT_MOVIE&asin=%s)' % (sys.argv[0], asin)), (getString(30183), 'Container.Update(%s?mode=appfeed&sitemode=getSimilarities&asin=%s)' % (sys.argv[0], asin)), (getString(30186), 'RunPlugin(%s?mode=xbmclibrary&sitemode=UpdateLibrary)' % sys.argv[0])] if onlyinfo: return infoLabels else: addVideo(movietitle, asin, poster, fanart, infoLabels=infoLabels, cm=cm, trailer=trailer, isAdult=isAdult, isHD=isHD)
def WATCHLIST_LIST_MOVIES(export=False): if export: xbmclibrary.SetupLibrary() url = 'https://www.amazon.com/gp/video/watchlist/movie?show=all&sort=DATE_ADDED' 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': 'innerItem', 'id': True}) totalItems = len(videos) for video in videos: asin = video['id'] if export: xbmclibrary.EXPORT_MOVIE(asin) else: appfeed.ADD_MOVIE(asin, isPrime=True, inWatchlist=True) if not export: xbmcplugin.setContent(int(sys.argv[1]), 'Movies') xbmcplugin.endOfDirectory(pluginhandle) viewenable = common.addon.getSetting("viewenable") if viewenable == 'true': view = int(common.addon.getSetting("movieview")) xbmc.executebuiltin("Container.SetViewMode(" + str(confluence_views[view]) + ")")
def ADD_MOVIE(addASIN, isPrime=True, inWatchlist=False, export=False): movies = moviesDB.lookupMoviedb(addASIN, isPrime=True) for moviedata in movies: if export: xbmclibrary.EXPORT_MOVIE(moviedata[0]) else: righturl = 'http://www.amazon.com/gp/product/' + addASIN listmovie.ADD_MOVIE_ITEM(moviedata, righturl, inWatchlist=inWatchlist)
def LIST_MOVIES(export=False, genrefilter=False, actorfilter=False, directorfilter=False, studiofilter=False, yearfilter=False, mpaafilter=False, watchedfilter=False, favorfilter=False, alphafilter=False): if export: xbmclibrary.SetupLibrary() import movies as moviesDB movies = moviesDB.loadMoviedb(genrefilter=genrefilter, actorfilter=actorfilter, directorfilter=directorfilter, studiofilter=studiofilter, yearfilter=yearfilter, mpaafilter=mpaafilter, watchedfilter=watchedfilter, favorfilter=favorfilter, alphafilter=alphafilter) for moviedata in movies: if export: xbmclibrary.EXPORT_MOVIE(moviedata[0]) else: ADD_MOVIE_ITEM(moviedata) if not export: xbmcplugin.setContent(pluginhandle, 'Movies') 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) viewenable = common.addon.getSetting("viewenable") if viewenable == 'true': view = int(common.addon.getSetting("movieview")) xbmc.executebuiltin("Container.SetViewMode(" + str(confluence_views[view]) + ")") xbmcplugin.endOfDirectory(pluginhandle, updateListing=False)
def ADD_MOVIE_ITEM(moviedata, onlyinfo=False, cmmode=0, export=False): asin, hd_asin, movietitle, trailer, poster, plot, director, writer, runtime, year, premiered, studio, mpaa, actors, genres, stars, votes, fanart, isprime, isHD, isAdult, popularity, recent, audio = moviedata infoLabels = {'Title': movietitle} if plot: infoLabels['Plot'] = plot if actors: infoLabels['Cast'] = actors.split(',') if director: infoLabels['Director'] = director 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 mpaa: infoLabels['mpaa'] = mpaa if studio: infoLabels['Studio'] = studio if runtime: infoLabels['Duration'] = int(runtime) * 60 if audio: infoLabels['AudioChannels'] = audio if poster: infoLabels['Thumb'] = poster if fanart: infoLabels['Fanart'] = fanart infoLabels['isHD'] = isHD infoLabels['isAdult'] = isAdult asin = asin.split(',')[0] if export: xbmclibrary.EXPORT_MOVIE(asin) return cm = [] cm.append(( common.getString(30180 + cmmode) % common.getString(30154), 'XBMC.RunPlugin(%s?mode=<common>&sitemode=<toogleWatchlist>&asin=<%s>&remove=<%s>)' % (sys.argv[0], asin, cmmode))) cm.append(( common.getString(30185) % common.getString(30154), 'XBMC.RunPlugin(%s?mode=<xbmclibrary>&sitemode=<EXPORT_MOVIE>&asin=<%s>)' % (sys.argv[0], asin))) cm.append((common.getString( 30183 ), 'Container.Update(%s?mode=<appfeed>&sitemode=<getSimilarities>&asin=<%s>)' % (sys.argv[0], asin))) cm.append( (common.getString(30186), 'XBMC.RunPlugin(%s?mode=<xbmclibrary>&sitemode=<UpdateLibrary>)' % sys.argv[0])) if onlyinfo: return infoLabels else: common.addVideo(movietitle, asin, poster, fanart, infoLabels=infoLabels, cm=cm, trailer=trailer, isAdult=isAdult, isHD=isHD)