navigation.py 文件源码

python
阅读 35 收藏 0 点赞 0 评论 0

项目:plugin.video.skygo 作者: trummerjo 项目源码 文件源码
def listAssets(asset_list, isWatchlist=False):
    for item in asset_list:
        isPlayable = False
        li = xbmcgui.ListItem(label=item['label'], iconImage=icon_file)
        if item['type'] in ['Film', 'Episode', 'Sport', 'Clip', 'Series', 'live', 'searchresult']:
            isPlayable = True
            #Check Altersfreigabe / Jugendschutzeinstellungen
            if 'parental_rating' in item['data']:
                if js_showall == 'false':
                    if not skygo.parentalCheck(item['data']['parental_rating']['value'], play=False):   
                        continue
            info, item['data'] = getInfoLabel(item['type'], item['data'])
            # xbmc.log( "Debug_Info Current item Element: %s" % (item) ) 
            li.setInfo('video', info)
            li.setLabel(info['title'])         
            li.setArt({'poster': getPoster(item['data']), 'fanart': getHeroImage(item['data'])})           
        if item['type'] in ['Film']:
            xbmcplugin.setContent(addon_handle, 'movies')
            if xbmcaddon.Addon().getSetting('lookup_tmdb_data') == 'true' and 'TMDb_poster_path' in item['data']:
                poster_path = item['data']['TMDb_poster_path'] 
            else:
                poster_path = getPoster(item['data'])
            # xbmc.log('Debug-Info: Current Poster in item: %s' % getPoster(item['data']) ) 
            # xbmc.log('Debug-Info: Current Poster in info: %s' % item['data']['TMDb_poster_path'] )    
            li.setArt({'poster': poster_path})
        elif item['type'] in ['Series']:
            xbmcplugin.setContent(addon_handle, 'tvshows')
            isPlayable = False
        elif item['type'] in ['Episode']:
            xbmcplugin.setContent(addon_handle, 'episodes')
        elif item['type'] in ['Sport', 'Clip']:
            xbmcplugin.setContent(addon_handle, 'files')
            li.setArt({'thumb': getHeroImage(item['data'])})
        elif item['type'] == 'searchresult':          
            xbmcplugin.setContent(addon_handle, 'movies')
        elif item['type'] == ('live'):
            xbmcplugin.setContent(addon_handle, 'files')
            if 'TMDb_poster_path' in item['data']:
                poster = item['data']['TMDb_poster_path']
            elif 'mediainfo' in item['data']:
                poster = getPoster(item['data']['mediainfo'])
            else:
                poster = getPoster(item['data']['channel'])
            fanart = skygo.baseUrl + item['data']['event']['image'] if item['data']['channel']['name'].find('News') == -1 else skygo.baseUrl + '/bin/Picture/817/C_1_Picture_7179_content_4.jpg'
            thumb = skygo.baseUrl + item['data']['event']['image'] if item['data']['channel']['name'].find('News') == -1 else getChannelLogo(item['data']['channel'])
            li.setArt({'poster': poster, 'fanart': fanart, 'thumb': thumb})

        #add contextmenu item for watchlist to playable content - not for live and clip content
        if isPlayable and not item['type'] in ['live', 'Clip']:
            li.addContextMenuItems(getWatchlistContextItem(item, isWatchlist), replaceItems=False)
        li.setProperty('IsPlayable', str(isPlayable).lower())
        xbmcplugin.addDirectoryItem(handle=addon_handle, url=item['url'],
                                    listitem=li, isFolder=(not isPlayable))

    xbmcplugin.addSortMethod(handle=addon_handle, sortMethod=xbmcplugin.SORT_METHOD_NONE)
    xbmcplugin.addSortMethod(handle=addon_handle, sortMethod=xbmcplugin.SORT_METHOD_LABEL)
    xbmcplugin.addSortMethod(handle=addon_handle, sortMethod=xbmcplugin.SORT_METHOD_TITLE)
    xbmcplugin.addSortMethod(handle=addon_handle, sortMethod=xbmcplugin.SORT_METHOD_VIDEO_YEAR)
    xbmcplugin.addSortMethod(handle=addon_handle, sortMethod=xbmcplugin.SORT_METHOD_DURATION)
    xbmcplugin.endOfDirectory(addon_handle, cacheToDisc=True)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号