def LIBRARY_LIST_MOVIES():
    xbmcplugin.setContent(int(sys.argv[1]), 'Movies')
    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:
        asin = video['asin']
        movietitle = video.find('',attrs={'class':'title'}).a.string
        url = common.BASE_URL+video.find('div',attrs={'class':'title'}).a['href']
        thumb = video.find('img')['src'].replace('._SS160_','')
        fanart = thumb.replace('.jpg','._BO354,0,0,0_CR177,354,708,500_.jpg')       
        #if xbmcplugin.getSetting(pluginhandle,'enablelibrarymeta') == 'true':
        #    asin2,movietitle,url,poster,plot,director,runtime,year,premiered,studio,mpaa,actors,genres,stars,votes,TMDBbanner,TMDBposter,TMDBfanart,isprime,watched,favor = getMovieInfo(asin,movietitle,url,poster,isPrime=False)
        #    actors = actors.split(',')
        #    infoLabels = { 'Title':movietitle,'Plot':plot,'Year':year,'premiered':premiered,
        #                   'rating':stars,'votes':votes,'Genre':genres,'director':director,
        #                   'studio':studio,'duration':runtime,'mpaa':mpaa,'cast':actors}
        #else:
        infoLabels = { 'Title':movietitle}
        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)
Esempio n. 2
0
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_MOVIES(genrefilter=False,actorfilter=False,directorfilter=False,studiofilter=False,yearfilter=False,mpaafilter=False,watchedfilter=False,favorfilter=False,alphafilter=False):
    xbmcplugin.setContent(pluginhandle, 'Movies')
    editenable=common.addon.getSetting("editenable")
    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 asin,movietitle,url,poster,plot,director,writer,runtime,year,premiered,studio,mpaa,actors,genres,stars,votes,TMDBbanner,TMDBposter,TMDBfanart,isprime,watched,favor,TMDB_ID in movies:
        fanart = poster.replace('.jpg','._BO354,0,0,0_CR177,354,708,500_.jpg')
        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'] = runtime
        cm = []
        if watched:
            infoLabels['overlay']=7
            cm.append( ('Unwatch', 'XBMC.RunPlugin(%s?mode="movies"&sitemode="unwatchMoviedb"&url="%s")' % ( sys.argv[0], urllib.quote_plus(asin) ) ) )
        else: cm.append( ('Mark Watched', 'XBMC.RunPlugin(%s?mode="movies"&sitemode="watchMoviedb"&url="%s")' % ( sys.argv[0], urllib.quote_plus(asin) ) ) )
        if favor: cm.append( ('Remove from Favorites', 'XBMC.RunPlugin(%s?mode="movies"&sitemode="unfavorMoviedb"&url="%s")' % ( sys.argv[0], urllib.quote_plus(asin) ) ) )
        else: cm.append( ('Add to Favorites', 'XBMC.RunPlugin(%s?mode="movies"&sitemode="favorMoviedb"&url="%s")' % ( sys.argv[0], urllib.quote_plus(asin) ) ) )
        if editenable == 'true':
            cm.append( ('Remove from Movies', 'XBMC.RunPlugin(%s?mode="movies"&sitemode="deleteMoviedb"&url="%s")' % ( sys.argv[0], urllib.quote_plus(asin) ) ) )
        common.addVideo(movietitle,url,poster,fanart,infoLabels=infoLabels,cm=cm)
    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)
Esempio n. 4
0
def ADD_MOVIE_ITEM(moviedata,override_url=False,inWatchlist=False):
    asin,hd_asin,movietitle,url,poster,plot,director,writer,runtime,year,premiered,studio,mpaa,actors,genres,stars,votes,TMDBbanner,TMDBposter,TMDBfanart,isprime,isHD,watched,favor,TMDB_ID = moviedata
    if override_url:
        url=override_url
    if poster == None or poster == 'None':
        fanart = ''
        poster =''
    else:
        fanart = poster.replace('.jpg','._BO354,0,0,0_CR177,354,708,500_.jpg')
    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'] = runtime
    cm = []
    if inWatchlist:
        cm.append( ('Remove from Watchlist', 'XBMC.RunPlugin(%s?mode="common"&sitemode="removeMovieWatchlist"&asin="%s")' % ( sys.argv[0], urllib.quote_plus(asin) ) ) )
    else:
        cm.append( ('Add to Watchlist', 'XBMC.RunPlugin(%s?mode="common"&sitemode="addMovieWatchlist"&asin="%s")' % ( sys.argv[0], urllib.quote_plus(asin) ) ) )
    if favor: cm.append( ('Remove from Favorites', 'XBMC.RunPlugin(%s?mode="movies"&sitemode="unfavorMoviedb"&url="%s")' % ( sys.argv[0], urllib.quote_plus(asin) ) ) )
    else: cm.append( ('Add to Favorites', 'XBMC.RunPlugin(%s?mode="movies"&sitemode="favorMoviedb"&url="%s")' % ( sys.argv[0], urllib.quote_plus(asin) ) ) )
    cm.append( ('Export to Library', 'XBMC.RunPlugin(plugin://plugin.video.amazon?mode="xbmclibrary"&sitemode="EXPORT_MOVIE"&asin="%s")' % ( urllib.quote_plus(asin) ) ) )
    if watched:
        infoLabels['overlay']=7
        cm.append( ('Unwatch', 'XBMC.RunPlugin(%s?mode="movies"&sitemode="unwatchMoviedb"&url="%s")' % ( sys.argv[0], urllib.quote_plus(asin) ) ) )
    else: cm.append( ('Mark Watched', 'XBMC.RunPlugin(%s?mode="movies"&sitemode="watchMoviedb"&url="%s")' % ( sys.argv[0], urllib.quote_plus(asin) ) ) )
    if common.addon.getSetting("editenable") == 'true':
        cm.append( ('Remove from Movies', 'XBMC.RunPlugin(%s?mode="movies"&sitemode="deleteMoviedb"&url="%s")' % ( sys.argv[0], urllib.quote_plus(asin) ) ) )
    common.addVideo(movietitle,url,poster,fanart,infoLabels=infoLabels,cm=cm)
Esempio n. 5
0
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)
Esempio n. 6
0
def ADD_EPISODE_ITEM(episodedata,seriesTitle=False):
   #asin,seriestitle,season,episode,poster,mpaa,actors,genres,episodetitle,studio,stars,votes,url,plot,airdate,year,runtime,isHD,isprime,watched
    asin,seasonASIN,seriesASIN,seriestitle,season,episode,poster,mpaa,actors,genres,episodetitle,network,stars,votes,url,plot,airdate,year,runtime,isHD,isprime,watched = episodedata
    infoLabels={'Title': episodetitle,'TVShowTitle':seriestitle,
                'Episode': episode,'Season':season}
    if plot:
        infoLabels['Plot'] = plot
    if airdate:
        infoLabels['Premiered'] = airdate 
    if year:
        infoLabels['Year'] = year
    if runtime:
        infoLabels['Duration'] = runtime
    if mpaa:
        infoLabels['MPAA'] = mpaa
    if actors:
        infoLabels['Cast'] = actors.split(',')
    if stars:
        infoLabels['Rating'] = stars           
    if votes:
        infoLabels['Votes'] = votes  
    if genres:
        infoLabels['Genre'] = genres 
    if network:
        infoLabels['Studio'] = network
    if seriesTitle:
        displayname=seriestitle+' - '
    else:
        displayname=''
    if season == 0: displayname +=  str(episode)+'. '+episodetitle
    else: displayname +=  str(season)+'x'+str(episode)+' - '+episodetitle
    #if isHD: displayname += ' [COLOR FFE47911][HD][/COLOR]'
    displayname = displayname.replace('"','')
    try:
        if common.args.thumb and poster == None: poster = common.args.thumb
        if common.args.fanart and common.args.fanart <>'': fanart = common.args.fanart
        else: fanart=poster
    except: fanart=poster

    cm = []
    if watched:
        infoLabels['overlay']=7
        cm.append( ('Unwatch', 'XBMC.RunPlugin(%s?mode="tv"&sitemode="unwatchEpisodedb"&url="%s")' % ( sys.argv[0], urllib.quote_plus(asin) ) ) )
    else: cm.append( ('Mark Watched', 'XBMC.RunPlugin(%s?mode="tv"&sitemode="watchEpisodedb"&url="%s")' % ( sys.argv[0], urllib.quote_plus(asin) ) ) )
    cm.append( ('Export to Library', 'XBMC.RunPlugin(plugin://plugin.video.amazon?mode="xbmclibrary"&sitemode="EXPORT_EPISODE"&asin="%s")' % ( urllib.quote_plus(asin) ) ) )
    common.addVideo(displayname,url,poster,fanart,infoLabels=infoLabels,cm=cm,HD=isHD)
Esempio n. 7
0
def MOVIE_EXTRAS():
    data = common.getURL(common.args.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 = ''
    for item in tree.findAll('div',attrs={'class':re.compile('more-videos ')}):
        name = item.find('h5').string
        if name == common.args.name:
            for extra in item.findAll('a'):
                print extra.string
                if extra.string == None or extra.string == 'more' or extra.string == 'less':
                    continue
                thumb = re.compile('"src", "(.*?)"\)').findall(extra['onmouseover'])[0].replace('thumbs/','') 
                common.addVideo(extra.string.strip(),BASE+extra['href'],thumb,fanart,extra=True)
    xbmcplugin.endOfDirectory(pluginhandle)
def LIST_EPISODES(owned=False):
    episode_url = common.args.url
    showname = common.args.name
    thumbnail = common.args.thumb
    xbmcplugin.setContent(int(sys.argv[1]), 'Episodes') 
    data = common.getURL(episode_url,useCookie=owned)
    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)
    episodebox = tree.find('div',attrs={'id':'avod-ep-list-rows'})
    episodes = episodebox.findAll('tr',attrs={'asin':True})
    try:season = int(tree.find('div',attrs={'class':'unbox_season_selected'}).string)
    except:
        try:season = int(tree.find('div',attrs={'style':'font-size: 120%;font-weight:bold; margin-top:15px;margin-bottom:10px;'}).contents[0].split('Season')[1].strip())
        except:season = 0
    del tree
    del episodebox
    for episode in episodes:
        if owned:
            purchasecheckbox = episode.find('input',attrs={'type':'checkbox'})
            if purchasecheckbox:
                continue
        asin = episode['asin']
        name = episode.find(attrs={'title':True})['title'].encode('utf-8')
        airDate = episode.find(attrs={'style':'width: 150px; overflow: hidden'}).string.strip()
        try: plot =  episode.findAll('div')[1].string.strip()
        except: plot = ''
        try:episodeNum = int(episode.find('div',attrs={'style':'width: 185px;'}).string.split('.')[0].strip())
        except:episodeNum =0
        if season == 0: displayname =  str(episodeNum)+'. '+name
        else: displayname =  str(season)+'x'+str(episodeNum)+' - '+name
        url = common.BASE_URL+'/gp/product/'+asin
        infoLabels={'Title': name.replace('[HD]',''),'TVShowTitle':showname,
                    'Plot':plot,'Premiered':airDate,
                    'Season':season,'Episode':episodeNum}
        common.addVideo(displayname,url,thumbnail,thumbnail,infoLabels=infoLabels)
    viewenable=xbmcplugin.getSetting(pluginhandle,"viewenable")
    if viewenable == 'true':
        view=int(xbmcplugin.getSetting(pluginhandle,"episodeview"))
        xbmc.executebuiltin("Container.SetViewMode("+str(confluence_views[view])+")")
    xbmcplugin.endOfDirectory(pluginhandle,updateListing=False)
def LIST_EPISODES_DB(HDonly=False,owned=False,url=False):
    if not url:
        url = common.args.url
    split = url.split('<split>')
    seriestitle = split[0]
    try:
        season = int(split[1])
    except:
        season = 0
    import tv as tvDB
    episodes = tvDB.loadTVEpisodesdb(seriestitle,season,HDonly)
    #asin,seriestitle,season,episode,episodetitle,url,plot,airdate,runtime,isHD,isprime,watched
    for asin,seriestitle,season,episode,episodetitle,url,plot,airdate,runtime,isHD,isprime,watched in episodes:
        infoLabels={'Title': episodetitle,'TVShowTitle':seriestitle,
                    'Episode': episode,'Season':season}
        if plot:
            infoLabels['Plot'] = plot
        if airdate:
            infoLabels['Premiered'] = airdate 
        if runtime:
            infoLabels['Duration'] = runtime
        if season == 0: displayname =  str(episode)+'. '+episodetitle
        else: displayname =  str(season)+'x'+str(episode)+' - '+episodetitle

        if common.args.thumb: poster = common.args.thumb
        if common.args.fanart and common.args.fanart <>'': fanart = common.args.fanart
        else: fanart=poster

        cm = []
        if watched:
            infoLabels['overlay']=7
            cm.append( ('Unwatch', 'XBMC.RunPlugin(%s?mode="tv"&sitemode="unwatchEpisodedb"&url="%s")' % ( sys.argv[0], urllib.quote_plus(asin) ) ) )
        else: cm.append( ('Mark Watched', 'XBMC.RunPlugin(%s?mode="tv"&sitemode="watchEpisodedb"&url="%s")' % ( sys.argv[0], urllib.quote_plus(asin) ) ) )
        common.addVideo(displayname,url,poster,fanart,infoLabels=infoLabels,cm=cm)
    #xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL)
    xbmcplugin.setContent(pluginhandle, 'Episodes')
    viewenable=common.addon.getSetting("viewenable")
    if viewenable == 'true':
        view=int(common.addon.getSetting("episodeview"))
        xbmc.executebuiltin("Container.SetViewMode("+str(confluence_views[view])+")")  
    xbmcplugin.endOfDirectory(pluginhandle,updateListing=False)
Esempio n. 10
0
def LIBRARY_LIST_MOVIES():
    xbmcplugin.setContent(int(sys.argv[1]), 'Movies')
    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:
        asin = video['asin']
        movietitle = video.find('', attrs={'class': 'title'}).a.string
        url = common.BASE_URL + video.find('div', attrs={
            'class': 'title'
        }).a['href']
        thumb = video.find('img')['src'].replace('._SS160_', '')
        fanart = thumb.replace('.jpg', '._BO354,0,0,0_CR177,354,708,500_.jpg')
        #if xbmcplugin.getSetting(pluginhandle,'enablelibrarymeta') == 'true':
        #    asin2,movietitle,url,poster,plot,director,runtime,year,premiered,studio,mpaa,actors,genres,stars,votes,TMDBbanner,TMDBposter,TMDBfanart,isprime,watched,favor = getMovieInfo(asin,movietitle,url,poster,isPrime=False)
        #    actors = actors.split(',')
        #    infoLabels = { 'Title':movietitle,'Plot':plot,'Year':year,'premiered':premiered,
        #                   'rating':stars,'votes':votes,'Genre':genres,'director':director,
        #                   'studio':studio,'duration':runtime,'mpaa':mpaa,'cast':actors}
        #else:
        infoLabels = {'Title': movietitle}
        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)
Esempio n. 11
0
def ADD_EPISODE_ITEM(episodedata, seriesTitle=False):
    # asin,seriestitle,season,episode,poster,mpaa,actors,genres,episodetitle,studio,stars,votes,url,plot,airdate,year,runtime,isHD,isprime,watched
    asin, seasonASIN, seriesASIN, seriestitle, season, episode, poster, mpaa, actors, genres, episodetitle, network, stars, votes, url, plot, airdate, year, runtime, isHD, isprime, watched = (
        episodedata
    )
    infoLabels = {"Title": episodetitle, "TVShowTitle": seriestitle, "Episode": episode, "Season": season}
    if plot:
        infoLabels["Plot"] = plot
    if airdate:
        infoLabels["Premiered"] = airdate
    if year:
        infoLabels["Year"] = year
    if runtime:
        infoLabels["Duration"] = runtime
    if mpaa:
        infoLabels["MPAA"] = mpaa
    if actors:
        infoLabels["Cast"] = actors.split(",")
    if stars:
        infoLabels["Rating"] = stars
    if votes:
        infoLabels["Votes"] = votes
    if genres:
        infoLabels["Genre"] = genres
    if network:
        infoLabels["Studio"] = network
    if seriesTitle:
        displayname = seriestitle + " - "
    else:
        displayname = ""
    if season == 0:
        displayname += str(episode) + ". " + episodetitle
    else:
        displayname += str(season) + "x" + str(episode) + " - " + episodetitle
    # if isHD: displayname += ' [COLOR FFE47911][HD][/COLOR]'
    displayname = displayname.replace('"', "")
    try:
        if common.args.thumb and poster == None:
            poster = common.args.thumb
        if common.args.fanart and common.args.fanart <> "":
            fanart = common.args.fanart
        else:
            fanart = poster
    except:
        fanart = poster

    cm = []
    if watched:
        infoLabels["overlay"] = 7
        cm.append(
            (
                "Unwatch",
                'XBMC.RunPlugin(%s?mode="tv"&sitemode="unwatchEpisodedb"&url="%s")'
                % (sys.argv[0], urllib.quote_plus(asin)),
            )
        )
    else:
        cm.append(
            (
                "Mark Watched",
                'XBMC.RunPlugin(%s?mode="tv"&sitemode="watchEpisodedb"&url="%s")'
                % (sys.argv[0], urllib.quote_plus(asin)),
            )
        )
    cm.append(
        (
            "Export to Library",
            'XBMC.RunPlugin(plugin://plugin.video.amazon?mode="xbmclibrary"&sitemode="EXPORT_EPISODE"&asin="%s")'
            % (urllib.quote_plus(asin)),
        )
    )
    common.addVideo(displayname, url, poster, fanart, infoLabels=infoLabels, cm=cm, HD=isHD)
Esempio n. 12
0
def LIST_EPISODES_DB(HDonly=False, owned=False, url=False):
    if not url:
        url = common.args.url
    split = url.split('<split>')
    seriestitle = split[0]
    try:
        season = int(split[1])
    except:
        season = 0
    import tv as tvDB
    episodes = tvDB.loadTVEpisodesdb(seriestitle, season, HDonly)
    #asin,seriestitle,season,episode,episodetitle,url,plot,airdate,runtime,isHD,isprime,watched
    for asin, seriestitle, season, episode, episodetitle, url, plot, airdate, runtime, isHD, isprime, watched in episodes:
        infoLabels = {
            'Title': episodetitle,
            'TVShowTitle': seriestitle,
            'Episode': episode,
            'Season': season
        }
        if plot:
            infoLabels['Plot'] = plot
        if airdate:
            infoLabels['Premiered'] = airdate
        if runtime:
            infoLabels['Duration'] = runtime
        if season == 0: displayname = str(episode) + '. ' + episodetitle
        else:
            displayname = str(season) + 'x' + str(
                episode) + ' - ' + episodetitle

        if common.args.thumb: poster = common.args.thumb
        if common.args.fanart and common.args.fanart <> '':
            fanart = common.args.fanart
        else:
            fanart = poster

        cm = []
        if watched:
            infoLabels['overlay'] = 7
            cm.append((
                'Unwatch',
                'XBMC.RunPlugin(%s?mode="tv"&sitemode="unwatchEpisodedb"&url="%s")'
                % (sys.argv[0], urllib.quote_plus(asin))))
        else:
            cm.append((
                'Mark Watched',
                'XBMC.RunPlugin(%s?mode="tv"&sitemode="watchEpisodedb"&url="%s")'
                % (sys.argv[0], urllib.quote_plus(asin))))
        common.addVideo(displayname,
                        url,
                        poster,
                        fanart,
                        infoLabels=infoLabels,
                        cm=cm)
    #xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL)
    xbmcplugin.setContent(pluginhandle, 'Episodes')
    viewenable = common.addon.getSetting("viewenable")
    if viewenable == 'true':
        view = int(common.addon.getSetting("episodeview"))
        xbmc.executebuiltin("Container.SetViewMode(" +
                            str(confluence_views[view]) + ")")
    xbmcplugin.endOfDirectory(pluginhandle, updateListing=False)
Esempio n. 13
0
def LIST_EPISODES(owned=False):
    episode_url = common.args.url
    showname = common.args.name
    thumbnail = common.args.thumb
    xbmcplugin.setContent(int(sys.argv[1]), 'Episodes')
    data = common.getURL(episode_url, useCookie=owned)
    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)
    episodebox = tree.find('div', attrs={'id': 'avod-ep-list-rows'})
    episodes = episodebox.findAll('tr', attrs={'asin': True})
    try:
        season = int(
            tree.find('div', attrs={
                'class': 'unbox_season_selected'
            }).string)
    except:
        try:
            season = int(
                tree.find(
                    'div',
                    attrs={
                        'style':
                        'font-size: 120%;font-weight:bold; margin-top:15px;margin-bottom:10px;'
                    }).contents[0].split('Season')[1].strip())
        except:
            season = 0
    del tree
    del episodebox
    for episode in episodes:
        if owned:
            purchasecheckbox = episode.find('input',
                                            attrs={'type': 'checkbox'})
            if purchasecheckbox:
                continue
        asin = episode['asin']
        name = episode.find(attrs={'title': True})['title'].encode('utf-8')
        airDate = episode.find(attrs={
            'style': 'width: 150px; overflow: hidden'
        }).string.strip()
        try:
            plot = episode.findAll('div')[1].string.strip()
        except:
            plot = ''
        try:
            episodeNum = int(
                episode.find('div', attrs={
                    'style': 'width: 185px;'
                }).string.split('.')[0].strip())
        except:
            episodeNum = 0
        if season == 0: displayname = str(episodeNum) + '. ' + name
        else: displayname = str(season) + 'x' + str(episodeNum) + ' - ' + name
        url = common.BASE_URL + '/gp/product/' + asin
        infoLabels = {
            'Title': name.replace('[HD]', ''),
            'TVShowTitle': showname,
            'Plot': plot,
            'Premiered': airDate,
            'Season': season,
            'Episode': episodeNum
        }
        common.addVideo(displayname,
                        url,
                        thumbnail,
                        thumbnail,
                        infoLabels=infoLabels)
    viewenable = xbmcplugin.getSetting(pluginhandle, "viewenable")
    if viewenable == 'true':
        view = int(xbmcplugin.getSetting(pluginhandle, "episodeview"))
        xbmc.executebuiltin("Container.SetViewMode(" +
                            str(confluence_views[view]) + ")")
    xbmcplugin.endOfDirectory(pluginhandle, updateListing=False)
Esempio n. 14
0
def ADD_EPISODE_ITEM(episodedata, seriesTitle=False):
    #asin,seriestitle,season,episode,poster,mpaa,actors,genres,episodetitle,studio,stars,votes,url,plot,airdate,year,runtime,isHD,isprime,watched
    asin, seasonASIN, seriesASIN, seriestitle, season, episode, poster, mpaa, actors, genres, episodetitle, network, stars, votes, url, plot, airdate, year, runtime, isHD, isprime, watched = episodedata
    infoLabels = {
        'Title': episodetitle,
        'TVShowTitle': seriestitle,
        'Episode': episode,
        'Season': season
    }
    if plot:
        infoLabels['Plot'] = plot
    if airdate:
        infoLabels['Premiered'] = airdate
    if year:
        infoLabels['Year'] = year
    if runtime:
        infoLabels['Duration'] = runtime
    if mpaa:
        infoLabels['MPAA'] = mpaa
    if actors:
        infoLabels['Cast'] = actors.split(',')
    if stars:
        infoLabels['Rating'] = stars
    if votes:
        infoLabels['Votes'] = votes
    if genres:
        infoLabels['Genre'] = genres
    if network:
        infoLabels['Studio'] = network
    if seriesTitle:
        displayname = seriestitle + ' - '
    else:
        displayname = ''
    if season == 0: displayname += str(episode) + '. ' + episodetitle
    else:
        displayname += str(season) + 'x' + str(episode) + ' - ' + episodetitle
    #if isHD: displayname += ' [COLOR FFE47911][HD][/COLOR]'
    displayname = displayname.replace('"', '')
    try:
        if common.args.thumb and poster == None: poster = common.args.thumb
        if common.args.fanart and common.args.fanart <> '':
            fanart = common.args.fanart
        else:
            fanart = poster
    except:
        fanart = poster

    cm = []
    if watched:
        infoLabels['overlay'] = 7
        cm.append((
            'Unwatch',
            'XBMC.RunPlugin(%s?mode="tv"&sitemode="unwatchEpisodedb"&url="%s")'
            % (sys.argv[0], urllib.quote_plus(asin))))
    else:
        cm.append((
            'Mark Watched',
            'XBMC.RunPlugin(%s?mode="tv"&sitemode="watchEpisodedb"&url="%s")' %
            (sys.argv[0], urllib.quote_plus(asin))))
    cm.append((
        'Export to Library',
        'XBMC.RunPlugin(plugin://plugin.video.amazon?mode="xbmclibrary"&sitemode="EXPORT_EPISODE"&asin="%s")'
        % (urllib.quote_plus(asin))))
    common.addVideo(displayname,
                    url,
                    poster,
                    fanart,
                    infoLabels=infoLabels,
                    cm=cm,
                    HD=isHD)
def LIST_MOVIES(genrefilter=False,
                actorfilter=False,
                directorfilter=False,
                studiofilter=False,
                yearfilter=False,
                mpaafilter=False,
                watchedfilter=False,
                favorfilter=False,
                alphafilter=False):
    xbmcplugin.setContent(pluginhandle, 'Movies')
    editenable = common.addon.getSetting("editenable")
    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 asin, movietitle, url, poster, plot, director, writer, runtime, year, premiered, studio, mpaa, actors, genres, stars, votes, TMDBbanner, TMDBposter, TMDBfanart, isprime, watched, favor, TMDB_ID in movies:
        fanart = poster.replace('.jpg', '._BO354,0,0,0_CR177,354,708,500_.jpg')
        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'] = runtime
        cm = []
        if watched:
            infoLabels['overlay'] = 7
            cm.append((
                'Unwatch',
                'XBMC.RunPlugin(%s?mode="movies"&sitemode="unwatchMoviedb"&url="%s")'
                % (sys.argv[0], urllib.quote_plus(asin))))
        else:
            cm.append((
                'Mark Watched',
                'XBMC.RunPlugin(%s?mode="movies"&sitemode="watchMoviedb"&url="%s")'
                % (sys.argv[0], urllib.quote_plus(asin))))
        if favor:
            cm.append((
                'Remove from Favorites',
                'XBMC.RunPlugin(%s?mode="movies"&sitemode="unfavorMoviedb"&url="%s")'
                % (sys.argv[0], urllib.quote_plus(asin))))
        else:
            cm.append((
                'Add to Favorites',
                'XBMC.RunPlugin(%s?mode="movies"&sitemode="favorMoviedb"&url="%s")'
                % (sys.argv[0], urllib.quote_plus(asin))))
        if editenable == 'true':
            cm.append((
                'Remove from Movies',
                'XBMC.RunPlugin(%s?mode="movies"&sitemode="deleteMoviedb"&url="%s")'
                % (sys.argv[0], urllib.quote_plus(asin))))
        common.addVideo(movietitle,
                        url,
                        poster,
                        fanart,
                        infoLabels=infoLabels,
                        cm=cm)
    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)
Esempio n. 16
0
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)
        try:
            btf = tree.find(attrs={
                'id': 'btfResults'
            }).findAll('div', recursive=False)
            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': 'title'}).a.string
            url = video.find('div', attrs={'class': 'title'}).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)