コード例 #1
0
def LIST_TVSHOWS(filter='',
                 value=False,
                 sortcol=False,
                 sortaz=True,
                 search=False,
                 cmmode=0):
    import tv as tvDB
    if 'year' in filter:
        value = value.replace('0 -', '')
    shows = tvDB.loadTVShowdb(filter=filter, value=value, sortcol=sortcol)
    count = 0
    for showdata in shows:
        count += 1
        ADD_SHOW_ITEM(showdata, cmmode=cmmode)
    if not search:
        if sortaz:
            if 'year' not in filter:
                xbmcplugin.addSortMethod(pluginhandle,
                                         xbmcplugin.SORT_METHOD_LABEL)
            xbmcplugin.addSortMethod(pluginhandle,
                                     xbmcplugin.SORT_METHOD_VIDEO_YEAR)
            xbmcplugin.addSortMethod(pluginhandle,
                                     xbmcplugin.SORT_METHOD_VIDEO_RATING)
            xbmcplugin.addSortMethod(pluginhandle,
                                     xbmcplugin.SORT_METHOD_STUDIO_IGNORE_THE)
        common.SetView('tvshows')
    return count
コード例 #2
0
ファイル: listtv.py プロジェクト: versable/xbmc
def LIST_TVSHOWS(filterobj='',
                 value=None,
                 sortcol=False,
                 sortaz=True,
                 search=False,
                 cmmode=0,
                 export=False):
    if 'year' in filterobj:
        value = value.replace('0 -', '')

    shows = tv.loadTVShowdb(filterobj, value, sortcol)
    count = 0
    for showdata in shows:
        count += 1
        ADD_SHOW_ITEM(showdata, cmmode=cmmode, export=export)
    if not search:
        if sortaz:
            if 'year' not in filterobj:
                xbmcplugin.addSortMethod(pluginhandle,
                                         xbmcplugin.SORT_METHOD_LABEL)

            xbmcplugin.addSortMethod(pluginhandle,
                                     xbmcplugin.SORT_METHOD_VIDEO_YEAR)
            xbmcplugin.addSortMethod(pluginhandle,
                                     xbmcplugin.SORT_METHOD_VIDEO_RATING)
            xbmcplugin.addSortMethod(pluginhandle,
                                     xbmcplugin.SORT_METHOD_STUDIO_IGNORE_THE)
        SetView('tvshows', 'showview')
    return count
コード例 #3
0
def LIST_TVSHOWS(HDonly=False,genrefilter=False,creatorfilter=False,networkfilter=False,yearfilter=False,favorfilter=False):
    xbmcplugin.setContent(pluginhandle, 'tvshows')
    import tv as tvDB
    shows = tvDB.loadTVShowdb(HDonly=HDonly,genrefilter=genrefilter,creatorfilter=creatorfilter,networkfilter=networkfilter,yearfilter=yearfilter,favorfilter=favorfilter)
    artOptions = ['Poster','Banner','Amazon']
    tvart=int(common.addon.getSetting("tvart"))
    option = artOptions[tvart]
    editenable=common.addon.getSetting("editenable")
    for seriestitle,plot,creator,network,genres,actors,year,stars,votes,episodetotal,watched,unwatched,isHD,isprime,favor,TVDBbanner,TVDBposter,TVDBfanart,TVDBseriesid in shows:
        infoLabels={'Title': seriestitle,'TVShowTitle':seriestitle}
        if plot:
            infoLabels['Plot'] = plot
        if actors:
            infoLabels['Cast'] = actors.split(',')
        if year:
            infoLabels['Year'] = year
            infoLabels['Premiered'] = str(year)
        if stars:
            infoLabels['Rating'] = stars           
        if votes:
            infoLabels['Votes'] = votes  
        if genres:
            infoLabels['Genre'] = genres 
        if episodetotal:
            infoLabels['Episode'] = episodetotal
        if network:
            infoLabels['Studio'] = network
        if creator:
            infoLabels['Credits'] = creator
        if HDonly==True: listmode = 'LIST_HDTV_SEASONS'
        else: listmode = 'LIST_TV_SEASONS'
        if TVDBposter and option == 'Poster':
            poster = TVDBposter
        elif TVDBbanner and option == 'Banner':
            poster = TVDBbanner
        else:
            poster = tvDB.getPoster(seriestitle)
        if TVDBfanart:
            fanart = TVDBfanart
        else:
            fanart = tvDB.getPoster(seriestitle)
        cm = []
        if favor: cm.append( ('Remove from Favorites', 'XBMC.RunPlugin(%s?mode="tv"&sitemode="unfavorShowdb"&title="%s")' % ( sys.argv[0], urllib.quote_plus(seriestitle) ) ) )
        else: cm.append( ('Add to Favorites', 'XBMC.RunPlugin(%s?mode="tv"&sitemode="favorShowdb"&title="%s")' % ( sys.argv[0], urllib.quote_plus(seriestitle) ) ) )
        if editenable == 'true':
            cm.append( ('Rename Show', 'XBMC.RunPlugin(%s?mode="tv"&sitemode="renameShowdb"&title="%s")' % ( sys.argv[0], urllib.quote_plus(seriestitle) ) ) )
            if TVDBseriesid:
                cm.append( ('Refresh TVDB Data', 'XBMC.RunPlugin(%s?mode="tv"&sitemode="refreshTVDBshow"&title="%s")' % ( sys.argv[0], urllib.quote_plus(seriestitle) ) ) )
            cm.append( ('Lookup Show in TVDB', 'XBMC.RunPlugin(%s?mode="tv"&sitemode="scanTVDBshow"&title="%s")' % ( sys.argv[0], urllib.quote_plus(seriestitle) ) ) )
            cm.append( ('Remove Show', 'XBMC.RunPlugin(%s?mode="tv"&sitemode="deleteShowdb"&title="%s")' % ( sys.argv[0], urllib.quote_plus(seriestitle) ) ) )
        common.addDir(seriestitle,'listtv',listmode,seriestitle,poster,fanart,infoLabels,cm=cm)
    xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL)
    xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_VIDEO_YEAR)
    xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_VIDEO_RATING)
    xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_STUDIO_IGNORE_THE)
    viewenable=common.addon.getSetting("viewenable")
    if viewenable == 'true':
        view=int(common.addon.getSetting("showview"))
        xbmc.executebuiltin("Container.SetViewMode("+str(confluence_views[view])+")")
    xbmcplugin.endOfDirectory(pluginhandle,updateListing=False)
コード例 #4
0
ファイル: listtv.py プロジェクト: sbeatz/xbmc
def LIST_TVSHOWS(filter=False,value=False,sortcol=False,sortaz=True,search=False,cmmode=0,export=False):
    import tv as tvDB
    shows = tvDB.loadTVShowdb(filter=filter,value=value,sortcol=sortcol)
    count = 0
    for showdata in shows:
        count += 1
        ADD_SHOW_ITEM(showdata,cmmode=cmmode,export=export)
    if not search:
        if sortaz:
            xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL)
            xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_VIDEO_YEAR)
            xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_VIDEO_RATING)
            xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_STUDIO_IGNORE_THE)
        common.SetView('tvshows', 'showview')
    return count
コード例 #5
0
def LIST_TVSHOWS(filter='', value=False, sortcol=False, sortaz=True, search=False, cmmode=0):
    import tv as tvDB
    if 'year' in filter:
        value = value.replace('0 -', '')
    shows = tvDB.loadTVShowdb(filter=filter, value=value, sortcol=sortcol)
    count = 0
    for showdata in shows:
        count += 1
        ADD_SHOW_ITEM(showdata, cmmode=cmmode)
    if not search:
        if sortaz:
            if 'year' not in filter:
                xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL)
            xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_VIDEO_YEAR)
            xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_VIDEO_RATING)
            xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_STUDIO_IGNORE_THE)
        common.SetView('tvshows')
    return count
コード例 #6
0
ファイル: listtv.py プロジェクト: AbsMate/bluecop-xbmc-repo
def LIST_TVSHOWS(export=False,HDonly=False,mpaafilter=False,genrefilter=False,creatorfilter=False,networkfilter=False,yearfilter=False,favorfilter=False):
    if export:
        xbmclibrary.SetupLibrary()
    import tv as tvDB
    shows = tvDB.loadTVShowdb(HDonly=HDonly,mpaafilter=mpaafilter,genrefilter=genrefilter,creatorfilter=creatorfilter,networkfilter=networkfilter,yearfilter=yearfilter,favorfilter=favorfilter)
    for showdata in shows:
        if export:
            xbmclibrary.EXPORT_SHOW(showdata[0])
        else:
            ADD_SHOW_ITEM(showdata,HDonly=HDonly)
    if not export:
        xbmcplugin.setContent(pluginhandle, 'tvshows')
        xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL)
        xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_VIDEO_YEAR)
        xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_VIDEO_RATING)
        xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_STUDIO_IGNORE_THE)
        xbmcplugin.endOfDirectory(pluginhandle,updateListing=False)
        viewenable=common.addon.getSetting("viewenable")
        if viewenable == 'true':
            view=int(common.addon.getSetting("showview"))
            xbmc.executebuiltin("Container.SetViewMode("+str(confluence_views[view])+")")
コード例 #7
0
def LIST_TVSHOWS(export=False,
                 HDonly=False,
                 mpaafilter=False,
                 genrefilter=False,
                 creatorfilter=False,
                 networkfilter=False,
                 yearfilter=False,
                 favorfilter=False):
    if export:
        xbmclibrary.SetupLibrary()
    import tv as tvDB
    shows = tvDB.loadTVShowdb(HDonly=HDonly,
                              mpaafilter=mpaafilter,
                              genrefilter=genrefilter,
                              creatorfilter=creatorfilter,
                              networkfilter=networkfilter,
                              yearfilter=yearfilter,
                              favorfilter=favorfilter)
    for showdata in shows:
        if export:
            xbmclibrary.EXPORT_SHOW(showdata[0])
        else:
            ADD_SHOW_ITEM(showdata, HDonly=HDonly)
    if not export:
        xbmcplugin.setContent(pluginhandle, 'tvshows')
        xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL)
        xbmcplugin.addSortMethod(pluginhandle,
                                 xbmcplugin.SORT_METHOD_VIDEO_YEAR)
        xbmcplugin.addSortMethod(pluginhandle,
                                 xbmcplugin.SORT_METHOD_VIDEO_RATING)
        xbmcplugin.addSortMethod(pluginhandle,
                                 xbmcplugin.SORT_METHOD_STUDIO_IGNORE_THE)
        xbmcplugin.endOfDirectory(pluginhandle, updateListing=False)
        viewenable = common.addon.getSetting("viewenable")
        if viewenable == 'true':
            view = int(common.addon.getSetting("showview"))
            xbmc.executebuiltin("Container.SetViewMode(" +
                                str(confluence_views[view]) + ")")
コード例 #8
0
def LIST_TVSHOWS(NFO=False):
    import tv as tvDB
    shows = tvDB.loadTVShowdb(favorfilter=True)
    if (common.addon.getSetting('enablelibraryfolder') == 'true'):
        SetupAmazonLibrary()
    elif (common.addon.getSetting('customlibraryfolder') <> ''):
        CreateDirectory(MOVIE_PATH)
        CreateDirectory(TV_SHOWS_PATH)
    for seriestitle, plot, creator, network, genres, actors, year, stars, votes, episodetotal, watched, unwatched, isHD, isprime, favor, TVDBbanner, TVDBposter, TVDBfanart, TVDBseriesid in shows:
        directorname = os.path.join(TV_SHOWS_PATH,
                                    seriestitle.replace(':', ''))
        CreateDirectory(directorname)
        if NFO:
            soup = BeautifulStoneSoup()
            tvshow = Tag(soup, "tvshow")
            soup.insert(0, tvshow)
            tvshow.insert(0, createElement('title', seriestitle))
            if year:
                tvshow.insert(1, createElement('year', str(year)))
            if plot:
                tvshow.insert(2, createElement('plot', plot))
            if votes:
                tvshow.insert(3, createElement('votes', str(votes)))
            if stars:
                tvshow.insert(4, createElement('rating', str(stars)))
            if creator:
                tvshow.insert(5, createElement('credits', creator))
            if network:
                tvshow.insert(6, createElement('studio', network))
            if TVDBseriesid:
                tvshow.insert(7, createElement('id', TVDBseriesid))
                episodeguide = createElement('episodeguide', '')
                url = createElement(
                    'url',
                    'http://www.thetvdb.com/api/03B8C17597ECBD64/series/' +
                    TVDBseriesid + '/all/en.zip')
                url['cache'] = TVDBseriesid + '.xml'
                episodeguide.insert(0, url)
                tvshow.insert(8, episodeguide)
            if TVDBfanart:
                fanart_tag = createElement('fanart', '')
                fanart_tag['url'] = 'http://thetvdb.com/banners/'
                fanart_tag.insert(
                    0,
                    createElement(
                        'thumb',
                        TVDBfanart.replace('http://thetvdb.com/banners/', '')))
                tvshow.insert(9, fanart_tag)
            if TVDBposter:
                tvshow.insert(10, createElement('thumb', TVDBposter))
            elif TVDBbanner:
                tvshow.insert(11, createElement('thumb', TVDBbanner))
            index = 11
            if genres:
                for genre in genres.split(','):
                    index += 1
                    tvshow.insert(index, createElement('genre', genre))
            if actors:
                for actor in actors.split(','):
                    if actor <> None:
                        index += 1
                        actortag = createElement('actor', '')
                        actorname = createElement('name', actor)
                        actortag.insert(0, actorname)
                        tvshow.insert(index, actortag)
        seasonTotal, episodeTotal, seasons = LIST_TV_SEASONS(seriestitle, isHD)
        for season, poster, hasHD in seasons:
            name = 'Season ' + str(season)
            if hasHD:
                name += ' HD'
            seasonpath = os.path.join(directorname, name)
            CreateDirectory(seasonpath)
            if NFO:
                postertag = createElement('thumb', poster)
                postertag['type'] = 'season'
                postertag['season'] = str(season)
                index += 1
                tvshow.insert(index, postertag)
            LIST_EPISODES_DB(seriestitle,
                             int(season),
                             poster,
                             HDonly=hasHD,
                             path=seasonpath)
        if NFO:
            index += 1
            tvshow.insert(index, createElement('season', seasonTotal))
            index += 1
            tvshow.insert(index, createElement('episode', episodeTotal))
            tvshowNFO = os.path.join(directorname, 'tvshow.nfo')
            data = str(soup)
            if TVDBseriesid:
                data = 'http://thetvdb.com/index.php?tab=series&id=' + TVDBseriesid
                file = open(tvshowNFO, 'w')
                file.write(data)
                file.close()
コード例 #9
0
def LIST_TVSHOWS(HDonly=False,
                 genrefilter=False,
                 creatorfilter=False,
                 networkfilter=False,
                 yearfilter=False,
                 favorfilter=False):
    xbmcplugin.setContent(pluginhandle, 'tvshows')
    import tv as tvDB
    shows = tvDB.loadTVShowdb(HDonly=HDonly,
                              genrefilter=genrefilter,
                              creatorfilter=creatorfilter,
                              networkfilter=networkfilter,
                              yearfilter=yearfilter,
                              favorfilter=favorfilter)
    artOptions = ['Poster', 'Banner', 'Amazon']
    tvart = int(common.addon.getSetting("tvart"))
    option = artOptions[tvart]
    editenable = common.addon.getSetting("editenable")
    for seriestitle, plot, creator, network, genres, actors, year, stars, votes, episodetotal, watched, unwatched, isHD, isprime, favor, TVDBbanner, TVDBposter, TVDBfanart, TVDBseriesid in shows:
        infoLabels = {'Title': seriestitle, 'TVShowTitle': seriestitle}
        if plot:
            infoLabels['Plot'] = plot
        if actors:
            infoLabels['Cast'] = actors.split(',')
        if year:
            infoLabels['Year'] = year
            infoLabels['Premiered'] = str(year)
        if stars:
            infoLabels['Rating'] = stars
        if votes:
            infoLabels['Votes'] = votes
        if genres:
            infoLabels['Genre'] = genres
        if episodetotal:
            infoLabels['Episode'] = episodetotal
        if network:
            infoLabels['Studio'] = network
        if creator:
            infoLabels['Credits'] = creator
        if HDonly == True: listmode = 'LIST_HDTV_SEASONS'
        else: listmode = 'LIST_TV_SEASONS'
        if TVDBposter and option == 'Poster':
            poster = TVDBposter
        elif TVDBbanner and option == 'Banner':
            poster = TVDBbanner
        else:
            poster = tvDB.getPoster(seriestitle)
        if TVDBfanart:
            fanart = TVDBfanart
        else:
            fanart = tvDB.getPoster(seriestitle)
        cm = []
        if favor:
            cm.append((
                'Remove from Favorites',
                'XBMC.RunPlugin(%s?mode="tv"&sitemode="unfavorShowdb"&title="%s")'
                % (sys.argv[0], urllib.quote_plus(seriestitle))))
        else:
            cm.append((
                'Add to Favorites',
                'XBMC.RunPlugin(%s?mode="tv"&sitemode="favorShowdb"&title="%s")'
                % (sys.argv[0], urllib.quote_plus(seriestitle))))
        if editenable == 'true':
            cm.append((
                'Rename Show',
                'XBMC.RunPlugin(%s?mode="tv"&sitemode="renameShowdb"&title="%s")'
                % (sys.argv[0], urllib.quote_plus(seriestitle))))
            if TVDBseriesid:
                cm.append((
                    'Refresh TVDB Data',
                    'XBMC.RunPlugin(%s?mode="tv"&sitemode="refreshTVDBshow"&title="%s")'
                    % (sys.argv[0], urllib.quote_plus(seriestitle))))
            cm.append((
                'Lookup Show in TVDB',
                'XBMC.RunPlugin(%s?mode="tv"&sitemode="scanTVDBshow"&title="%s")'
                % (sys.argv[0], urllib.quote_plus(seriestitle))))
            cm.append((
                'Remove Show',
                'XBMC.RunPlugin(%s?mode="tv"&sitemode="deleteShowdb"&title="%s")'
                % (sys.argv[0], urllib.quote_plus(seriestitle))))
        common.addDir(seriestitle,
                      'listtv',
                      listmode,
                      seriestitle,
                      poster,
                      fanart,
                      infoLabels,
                      cm=cm)
    xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL)
    xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_VIDEO_YEAR)
    xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_VIDEO_RATING)
    xbmcplugin.addSortMethod(pluginhandle,
                             xbmcplugin.SORT_METHOD_STUDIO_IGNORE_THE)
    viewenable = common.addon.getSetting("viewenable")
    if viewenable == 'true':
        view = int(common.addon.getSetting("showview"))
        xbmc.executebuiltin("Container.SetViewMode(" +
                            str(confluence_views[view]) + ")")
    xbmcplugin.endOfDirectory(pluginhandle, updateListing=False)
コード例 #10
0
def LIST_TVSHOWS(NFO=False):
    import tv as tvDB
    shows = tvDB.loadTVShowdb(favorfilter=True)
    if (common.addon.getSetting('enablelibraryfolder') == 'true'):
        SetupAmazonLibrary()
    elif (common.addon.getSetting('customlibraryfolder') <> ''):
        CreateDirectory(MOVIE_PATH)
        CreateDirectory(TV_SHOWS_PATH)                          
    for seriestitle,plot,creator,network,genres,actors,year,stars,votes,episodetotal,watched,unwatched,isHD,isprime,favor,TVDBbanner,TVDBposter,TVDBfanart,TVDBseriesid in shows:
        directorname = os.path.join(TV_SHOWS_PATH,seriestitle.replace(':',''))
    	CreateDirectory(directorname)
        if NFO:
            soup = BeautifulStoneSoup()
            tvshow = Tag(soup, "tvshow")
            soup.insert(0, tvshow)
            tvshow.insert(0, createElement('title',seriestitle))
            if year:
                tvshow.insert(1, createElement('year',str(year)))
            if plot:
                tvshow.insert(2, createElement('plot',plot))
            if votes:
                tvshow.insert(3, createElement('votes',str(votes)))
            if stars:
                tvshow.insert(4, createElement('rating',str(stars)))
            if creator:
                tvshow.insert(5, createElement('credits',creator))
            if network:
                tvshow.insert(6, createElement('studio',network))
            if TVDBseriesid:
                tvshow.insert(7, createElement('id',TVDBseriesid))
                episodeguide = createElement('episodeguide','')
                url = createElement('url','http://www.thetvdb.com/api/03B8C17597ECBD64/series/'+TVDBseriesid+'/all/en.zip')
                url['cache'] = TVDBseriesid+'.xml'
                episodeguide.insert(0,url)
                tvshow.insert(8, episodeguide)
            if TVDBfanart:
                fanart_tag = createElement('fanart','')
                fanart_tag['url'] = 'http://thetvdb.com/banners/' 
                fanart_tag.insert(0,createElement('thumb',TVDBfanart.replace('http://thetvdb.com/banners/','')))
                tvshow.insert(9,fanart_tag)
            if TVDBposter:
                tvshow.insert(10,createElement('thumb',TVDBposter))
            elif TVDBbanner:
                tvshow.insert(11,createElement('thumb',TVDBbanner))
            index = 11
            if genres:
                for genre in genres.split(','):
                    index += 1
                    tvshow.insert(index, createElement('genre',genre))
            if actors:
                for actor in actors.split(','):
                    if actor <> None:
                        index += 1
                        actortag = createElement('actor','')
                        actorname = createElement('name',actor)
                        actortag.insert(0,actorname)
                        tvshow.insert(index, actortag )
        seasonTotal,episodeTotal,seasons = LIST_TV_SEASONS(seriestitle,isHD)
        for season,poster,hasHD in seasons:
            name = 'Season '+str(season)
            if hasHD:
                name += ' HD'
            seasonpath = os.path.join(directorname,name)
            CreateDirectory(seasonpath)
            if NFO:
                postertag = createElement('thumb',poster)
                postertag['type'] = 'season'
                postertag['season'] = str(season)
                index += 1
                tvshow.insert(index,postertag)
            LIST_EPISODES_DB(seriestitle,int(season),poster,HDonly=hasHD,path=seasonpath)
        if NFO:
            index += 1
            tvshow.insert(index, createElement('season',seasonTotal))
            index += 1
            tvshow.insert(index, createElement('episode',episodeTotal))  
            tvshowNFO = os.path.join(directorname,'tvshow.nfo')
            data = str(soup)
            if TVDBseriesid:
                data = 'http://thetvdb.com/index.php?tab=series&id='+TVDBseriesid
                file = open(tvshowNFO, 'w')
                file.write(data)
                file.close()