default.py 文件源码

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

项目:catchup4kodi 作者: catchup4kodi 项目源码 文件源码
def playall(name,url):
    dp = xbmcgui.DialogProgress()
    dp.create("Disney Junior",'Creating Your Playlist')
    dp.update(0)
    pl = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
    pl.clear()

    response=OPEN_URL(url)
    link=response.split('"title":"')
    test=re.compile('"embedURL":"(.+?)"').findall(response)

    playlist = []
    nItem    = len(test)
    try:
        for p in link:
          try:
            title=p.split('"')[0]            
            newurl=re.compile('"embedURL":"(.+?)"').findall(p)[0]            
            iconimage=re.compile('"thumb":"(.+?)"').findall(p)[0]            
            description=re.compile('"description":"(.+?)"').findall(p)[0]
            SHOWME=re.compile('"ptitle":"(.+?)"').findall(p)[0]       
            if name in SHOWME:        
                liz = xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=iconimage)
                liz.setInfo( type="Video", infoLabels={ "Title": title} )
                liz.setProperty("IsPlayable","true")

                r='"mp4".+?".+?"url":"(.+?)"}'
                html=OPEN_URL(newurl)
                match = re.compile(r).findall(html)
                amount = len(match)-1
                URL=match[amount]
                playlist.append((URL ,liz))

                progress = len(playlist) / float(nItem) * 100  
                dp.update(int(progress), 'Adding to Your Playlist',title)

                if dp.iscanceled():
                    return
          except:pass
        dp.close()

        print 'THIS IS PLAYLIST====   '+str(playlist)

        for blob ,liz in playlist:
            try:
                if blob:
                    print blob
                    pl.add(blob,liz)
            except:
                pass

        if not xbmc.Player().isPlayingVideo():
        xbmc.Player(xbmc.PLAYER_CORE_MPLAYER).play(pl)
    except:
        raise
        dialog = xbmcgui.Dialog()
        dialog.ok("Disney Junior", "Sorry Get All Valid Urls", "Why Not Try A Singular Video")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号