def ADD_SEASON(addASIN, mode='appfeed', submode='BROWSE_EPISODES', isPrime=True, seriesTitle=True, inWatchlist=False, export=False, addSeries=False, seriesfilter=False): seasons = tvDB.lookupSeasondb(addASIN, isPrime, addSeries=addSeries) for seasondata in seasons: if export: xbmclibrary.EXPORT_SEASON(seasondata[0]) else: if not seriesfilter: listtv.ADD_SEASON_ITEM(seasondata, mode=mode, submode=submode, seriesTitle=seriesTitle, inWatchlist=inWatchlist) elif seriesfilter == seasondata[5]: listtv.ADD_SEASON_ITEM(seasondata, mode=mode, submode=submode, seriesTitle=seriesTitle, inWatchlist=inWatchlist)
def ADD_SEASON_ITEM(seasondata, mode='listtv', submode='LIST_EPISODES_DB', disptitle=False, cmmode=0, onlyinfo=False, export=False): asin, seriesASIN, season, seriestitle, plot, actors, network, mpaa, genres, premiered, year, stars, votes, \ episodetotal, audio, empty, empty, isHD, isprime, empty, poster, banner, fanart, forceupd = seasondata tvfanart, tvposter = getFanart(seriesASIN) fanart = tvfanart if var.showfanart else fanart infoLabels = {'Title': seriestitle, 'TVShowTitle': seriestitle, 'Plot': plot, 'mediatype': 'season', 'MPAA': mpaa, 'Cast': actors.split(',') if actors else [], 'Year': year, 'Premiered': premiered, 'Rating': stars, 'Votes': votes, 'Genre': genres, 'Episode': episodetotal, 'Season': season, 'Studio': network, 'AudioChannels': audio, 'TotalSeasons': 1, 'Thumb': poster, 'Fanart': fanart, 'Asins': asin } asin = asin.split(',')[0] displayname = seriestitle + ' - ' if disptitle else '' if season != 0 and season < 99: displayname += getString(30167) + ' ' + str(season) elif season > 1900: displayname += getString(30168) + str(season) elif season > 99: displayname += getString(30167) + ' ' + str(season).replace('0', '.') else: displayname += getString(30169) if export: xbmclibrary.EXPORT_SEASON(asin) return cm = [(getString(30180 + cmmode) % getString(30167), 'RunPlugin(%s?mode=common&sitemode=toogleWatchlist&asin=%s&remove=%s)' % (sys.argv[0], asin, cmmode)), (getString(30185) % getString(30167), 'RunPlugin(%s?mode=xbmclibrary&sitemode=EXPORT_SEASON&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]), (getString(30155) % getString(30167), 'RunPlugin(%s?mode=tv&sitemode=delfromTVdb&asins=%s&table=seasons&title=%s)' % ( sys.argv[0], urllib.quote_plus(infoLabels['Asins']), urllib.quote_plus(displayname.encode('utf-8'))))] if onlyinfo: return infoLabels else: addDir(displayname, mode, submode, infoLabels['Asins'], poster, fanart, infoLabels, cm=cm)
def WATCHLIST_LIST_TV(export=False): if export: xbmclibrary.SetupLibrary() url = 'https://www.amazon.com/gp/video/watchlist/tv?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) ASINS = '' for video in videos: asin = video['id'] if export: xbmclibrary.EXPORT_SEASON(asin) else: if common.addon.getSetting("watchlist_tv_view") == '0': appfeed.ADD_SEASON(asin, isPrime=True, inWatchlist=True, addSeries=True) elif common.addon.getSetting("watchlist_tv_view") == '1': asin1, asin2 = appfeed.ADD_SEASON_SERIES( asin, 'library', 'WATCHLIST_LIST_SEASONS', isPrime=True, checklist=ASINS) if asin1: ASINS += asin1 if asin2: ASINS += asin2 if not export: xbmcplugin.setContent(int(sys.argv[1]), 'tvshows') xbmcplugin.endOfDirectory(pluginhandle) viewenable = common.addon.getSetting("viewenable") if viewenable == 'true': view = int(common.addon.getSetting("showview")) xbmc.executebuiltin("Container.SetViewMode(" + str(confluence_views[view]) + ")")
def ADD_SEASON_ITEM(seasondata, mode='listtv', submode='LIST_EPISODES_DB', disptitle=False, cmmode=0, onlyinfo=False, export=False): asin, seriesASIN, season, seriestitle, plot, actors, network, mpaa, genres, premiered, year, stars, votes, episodetotal, audio, empty, empty, isHD, isprime, empty, poster, banner, fanart = 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 audio: infoLabels['AudioChannels'] = audio displayname = '' if disptitle: displayname = seriestitle + ' - ' if season != 0 and len(str(season)) < 3: displayname += common.getString(30167, True) + ' ' + str(season) elif len(str(season)) > 2: displayname += common.getString(30168, True) + str(season) else: displayname += common.getString(30169, True) if showfanart == 'true': fanart, cover = getFanart(seriesASIN) infoLabels['TotalSeasons'] = 1 infoLabels['Thumb'] = poster infoLabels['Fanart'] = fanart infoLabels['Asins'] = asin asin = asin.split(',')[0] if export: xbmclibrary.EXPORT_SEASON(asin) return cm = [] cm.append(( common.getString(30180 + cmmode) % common.getString(30167), 'XBMC.RunPlugin(%s?mode=<common>&sitemode=<toogleWatchlist>&asin=<%s>&remove=<%s>)' % (sys.argv[0], asin, cmmode))) cm.append(( common.getString(30185) % common.getString(30167), 'XBMC.RunPlugin(%s?mode=<xbmclibrary>&sitemode=<EXPORT_SEASON>&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])) cm.append(( common.getString(30155) % common.getString(30167), 'XBMC.RunPlugin(%s?mode=<tv>&sitemode=<delfromTVdb>&asins=<%s>&table=<seasons>&title=<%s>)' % (sys.argv[0], urllib.quote_plus( infoLabels['Asins']), urllib.quote_plus(displayname)))) if onlyinfo: return infoLabels else: common.addDir(displayname, mode, submode, infoLabels['Asins'], poster, fanart, infoLabels, isHD=isHD, cm=cm)