Example #1
0
def PlayVideo(name, url, thumb, res):
    media = util.Media()
    res_limit = int(__addon__.getSetting("movie_res"))
    if res > res_limit:
        res = res_limit
    link = GetHttpData("http://www.flvcd.com/parse.php?kw=" + url + "&format=" + RES_LIST[res])
    match = re.compile('"(http://f.youku.com/player/getFlvPath/.+?)" target="_blank"').findall(link)
    if len(match) > 0:
        playlist = util.PlayList(1)
        playlist.clear()
        for i in range(0, len(match)):
            listitem = util.MenuItem(name, thumbnailImage=__addonicon__)
            media.setMediaInfo("Title", name)
            listitem.setInfo(
                type="Video", infoLabels={"Title": name + " 第" + str(i + 1) + "/" + str(len(match)) + " 节"}
            )
            playlist.add(match[i], listitem)
            # Test
            # util.Player().play(playlist)
            # end
        media.setPlayList(playlist)
    else:
        if link.find("该视频为加密视频") > 0:
            raise MediaInvalid, "无法播放:该视频为加密视频"
        elif link.find("解析失败,请确认视频是否被删除") > 0:
            raise MediaInvalid, "无法播放:该视频或为收费节目"

    return media
Example #2
0
def listA(name,url,thumb):
	t = util.Menu()
	print name
	print url
	link = GetHttpData(url)
	#media = util.Media()
	#电视剧
	# get TV Media Info
	media = showMediaInfo(link)
	if link.find('sv=""') > 0 :
		match = re.compile('</i><a target="_self".+?id="(.+?)"  title="(.+?)"', re.DOTALL).findall(link)
		totalItems=len(match)
		for p_url,p_name  in match:
			li = util.MenuItem(p_name, iconImage = '', thumbnailImage = thumb)
			media.setMediaInfo('Title', p_name)
			li.bindMedia(media)
			u = argv[0] + "?mode=10&name="+urllib.quote_plus(p_name)+"&type=3&url="+urllib.quote_plus(p_url)+"&thumb="+urllib.quote_plus(thumb)
			t.addDirectoryItem(int(argv[1]), u, li, False, totalItems)
	else:
		match = re.compile('</i><a target="_self".+?title="(.+?)".+?sv="(.+?)"', re.DOTALL).findall(link)
		totalItems=len(match)
		for p_name,p_url  in match:
			li = util.MenuItem(p_name, iconImage = '', thumbnailImage = thumb)
			media.setMediaInfo('Title', p_name)
			li.bindMedia(media)
			u = argv[0] + "?mode=10&name="+urllib.quote_plus(p_name)+"&type=3&url="+urllib.quote_plus(p_url)+"&thumb="+urllib.quote_plus(thumb)
			t.addDirectoryItem(int(argv[1]), u, li, False, totalItems)
	t.setContent(int(argv[1]), 'movies')
	# For Test
	#media.printMediaInfo()
	#decode(t.endOfDirectory(int(argv[1])))
	#end
	return t