예제 #1
0
파일: addon.py 프로젝트: yogi81/ru
def m3u(xml):
    m3u = xml
    regex = re.findall('#EXTINF.*,(.*\\s)\\s*(.*)', m3u)
    if not len(regex) > 0:
        regex = re.findall('((.*.+)(.*))', m3u)
    for text in regex:
        img_src = ''
        description = ''
        YaID = ''
        id = ''
        title = text[0].strip()
        id = VseTV.get_ch_id(title)        
        title = "[COLOR FFFFB77D00]" + title + "[/COLOR]"
        img_src = fanart
        if id != None:
            img_src = 'http://185.25.119.98/epg/logo/%s.png' % id   
        else:
            img_src = 'http://185.25.119.98/epg/logo/0.png'
        url = text[1].strip()
        listitem=xbmcgui.ListItem(title, iconImage = img_src, thumbnailImage = img_src)
        if Addon.getSetting('fanart') == '0':		
            listitem.setProperty('fanart_image', fanart)
        listitem.setInfo(type = 'video', infoLabels={'title': title, 'plot': description})
        uri = construct_request({
            'func': 'Play',
            'title': title,
            'img': img_src,
            'stream': url,
            'epgid': id
            })
        xbmcplugin.addDirectoryItem(hos, uri, listitem, True)
예제 #2
0
def Play(params):
    try:
        url = urllib.unquote(params['stream']).replace('&',
                                                       '&').replace(';', '')
    except:
        url = ''

    try:
        title = params['title']
    except:
        title = ''

    try:
        epgid = params['epgid']
    except:
        epgid = None

    try:
        img = params['img']
    except:
        img = None

    if epgid != '' and epgid != None:
        epg = VseTV.get_ch_epg(epgid)
        if epg != '' and epg != None:
            title = epg
    try:
        Parser = makemodule(url='http://185.25.119.98/xbmc/loadparsers.py',
                            modname='loadparsers')
    except:
        Parser = makemodule(url='http://91.211.245.49/xbmc/loadparsers.py',
                            modname='loadparsers')
    url = Parser.parse_play_url(url)

    if url == 'youtube':
        pass
    elif url != '' and url != None and url.find('.html') < 0 and url.find(
            'md5hash') < 0:
        i = xbmcgui.ListItem(title, url, img, img)
        xbmc.Player().play(url, i)
    else:
        showMessage('Not playable stream', url, 2000)
예제 #3
0
파일: addon.py 프로젝트: Yaser7440/ru
def Play(params):
    try:
        url = urllib.unquote(params['stream']).replace('&amp;', '&').replace(';', '')
    except:
        url = ''
        
    try:
        title = params['title']
    except:
        title = ''
    
    try:
        epgid = params['epgid']
    except:
        epgid = None
		
    try:
        img = params['img']
    except:
        img = None
		
    if epgid != '' and epgid != None:
        epg = VseTV.get_ch_epg(epgid)
        if epg != '' and epg != None:
            title = epg
    try:	
        Parser = makemodule(url = 'http://185.25.119.98/xbmc/loadparsers.py', modname = 'loadparsers')
    except:
        Parser = makemodule(url = 'http://91.211.245.49/xbmc/loadparsers.py', modname = 'loadparsers')
    url = Parser.parse_play_url(url)			
		
    if url == 'youtube':
        pass	
    elif url != '' and url != None and url.find('.html') < 0 and url.find('md5hash') < 0:
        i = xbmcgui.ListItem(title, url, img, img)
        xbmc.Player().play(url, i)
    else:
        showMessage('Not playable stram', url, 2000)
예제 #4
0
파일: addon.py 프로젝트: yogi81/ru
def playlist(xml):
    n = 0
    link = None
    stream = None
    prev_title = ''
    next_title = ''
    construkt = {}
    prev_page_element = xml.find('prev_page_url')
    if prev_page_element:
        prev_url = prev_page_element.text.encode('utf-8')
        prev_page_text = prev_page_element.get('text')
        if prev_page_text:
            prev_page_text = prev_page_text.encode('utf-8')
            prev_title =  "[COLOR FFFFFF00]<-" + prev_page_text +'[/COLOR]'
            uri = construct_request({
                 'func': 'Categories',
                 'link':prev_url
                 })
            listitem=xbmcgui.ListItem(prev_title, left, left)
            if Addon.getSetting('fanart') == '0':			
                listitem.setProperty('Fanart_Image', left)
            xbmcplugin.addDirectoryItem(hos, uri, listitem, True)
    next_page_element = xml.find('next_page_url')
    if next_page_element:
        next_url = next_page_element.text.encode('utf-8')
        next_page_text = next_page_element.get('text')
        if next_page_text:
            next_page_text = next_page_text.encode('utf-8')
            next_title =  "[COLOR FFFFFF00]->" + next_page_text +'[/COLOR]'
            uri = construct_request({
                'func': 'Categories',
                'link':next_url
                })
            listitem=xbmcgui.ListItem(next_title, right, right)
            if Addon.getSetting('fanart') == '0':			
                listitem.setProperty('fanart_image', right)
            xbmcplugin.addDirectoryItem(hos, uri, listitem, True)

    for channel in xml.findAll('channel'):
        img_src = ''
        img_logo = ''
        description = ''
        titl = ''
        YaID = ''
        title = channel.find('title').text.encode('utf-8')
        title = title.replace('&', ' and ')
        title = re.compile('<[\\/\\!]*?[^<>]*?>').sub('', title)
        description = channel.find('description')
        if description:
            description = description.text.encode('utf-8')
            img_src_list = re.findall('src="(.*?)"', description) or re.findall("src='(.*?)'", description)
            if len(img_src_list) > 0:
                img_src = img_src_list[0]
            if img_src == None or img_src == '' or img_src.find('http') < 0 :
                img_src = fanart
            description = description.replace('<br>', '\n')
            description = description.replace('<br/>', '\n')
            description = description.replace('</h1>', '</h1>\n')
            description = description.replace('</h2>', '</h2>\n')
            description = description.replace('&nbsp;', ' ')
            description = re.compile('<[\\/\\!]*?[^<>]*?>').sub('', description)
        else:
            description = title
        if description == '':
            description = title
        piconname = channel.find('logo_30x30') or channel.find('logo')
        if piconname:
            img_logo = piconname.text
            if img_src == None or img_src == '' or img_src == fanart :
                img_src = img_logo

        n = n+1

        searchon = channel.find('search_on')
        search = None
        if searchon:
            search = searchon.text.encode('utf-8')
            
        parser = channel.find('parser')
        stream_url = channel.find('stream_url')
        playlist_url = channel.find('playlist_url')
        
        if parser:
            parser = parser.text.encode('utf-8')
            if stream_url:
                strUrl = Pars(parser)
                if stream_url.find('md5hash') > -1 and strUrl:
                    stream_url = stream_url.replace('md5hash', strUrl)
        
        if playlist_url:
            link = playlist_url.text.encode('utf-8')
            titl = "[COLOR FFFFFFFF]" + title + "[/COLOR]"
            
            construkt = {
                'func': 'Categories',
                'link': link,
                'search': search,
                'parser': parser
                }
                    
        if stream_url:
            stream = stream_url.text.encode('utf-8')
            titl = "[COLOR FFB77D00]" + title + "[/COLOR]"
            
            id = VseTV.get_ch_id(title)
            if id != None:
                img_src = 'http://185.25.119.98/epg/logo/%s.png' % id				
			
            construkt = {
                'func': 'Play',
                'stream': stream,
                'img': img_src,
                'title': title,
                'epgid': id
                }
                
        listitem=xbmcgui.ListItem(titl, iconImage = img_src, thumbnailImage = img_src)
        if Addon.getSetting('fanart') == '0':  		
            listitem.setProperty('fanart_image', img_src)
        listitem.setInfo(type = 'video', infoLabels={'title': titl, 'plot': description})
        uri = construct_request(construkt)
        xbmcplugin.addDirectoryItem(hos, uri, listitem, True)