Ejemplo n.º 1
0
def GetFullLink(url, mode):
	#xbmc.log('player   ======>> url: {0},  mode: {1}'.format(url, mode), 2)
	if mode != 0 and mode != 3:
		url = myResolver.Resolve(url, mode, isLiveTV=True)
	if '.f4m' in url:
		url = "hds://{0}".format(url)
	return url
Ejemplo n.º 2
0
def resolveUrl(url):
    try:
        if '.f4m' in url:
            url = url.replace('&mode=3', '').replace('?mode=3', '')
            if 'keshet' in url:
                ticket = myResolver.GetMinus2Ticket()
                url = "{0}?{1}&hdcore=3.0.3".format(url, ticket)
            from F4mProxy import f4mProxyHelper
            url = f4mProxyHelper().playF4mLink(urllib.unquote_plus(url))
        elif "mode=" in url:
            matches = re.compile('^(.*?)[\?|&]mode=(\-?[0-9]+)(.*?)$',
                                 re.I + re.M + re.U + re.S).findall(url)
            if len(matches) > 0:
                url = matches[0][0]
                mode = matches[0][1]
                if len(matches[0]) > 2:
                    url += matches[0][2]
                if mode == '0':
                    mode = '-3'
                    url = url[url.rfind(';') + 1:]
                url = myResolver.Resolve(url, mode)
        if url is None or url == "down":
            return None
        return url
    except Exception as ex:
        xbmc.log("{0}".format(ex), 3)
        return None
Ejemplo n.º 3
0
def makeIPTVlist(iptvFile):
    first21 = True
    iptvList = '#EXTM3U\n'

    channelsList = GetIptvChannels()
    portNum = common.GetLivestreamerPort()

    for item in channelsList:
        try:
            url = item['url']
            tvg_id = item['name']
            view_name = item['name']
            if url.find('plugin.video.f4mTester') > 0:
                url = "http://localhost:{0}/{1}".format(
                    portNum, url[url.find('?'):])
            elif url.find('www.youtube.com') > 0 or url == "BB":
                url = "http://localhost:{0}/?url={1}".format(portNum, url)
            else:
                matches = re.compile('^(.*?)[\?|&]mode=(\-?[0-9]+)(.*?)$',
                                     re.I + re.M + re.U + re.S).findall(url)
                if len(matches) > 0:
                    url = matches[0][0]
                    mode = matches[0][1]
                    if len(matches[0]) > 2:
                        url += matches[0][2]
                    if mode == '1':
                        url = "http://localhost:{0}/{1}&mode={2}".format(
                            portNum, url[url.find('?'):], mode)
                    elif mode == '3':
                        url = "http://localhost:{0}/?url={1}".format(
                            portNum, url)
                    elif mode == '-3' or mode == '0' or mode == '7' or mode == '16' or mode == '20' or mode == '21' or mode == '22' or mode == '23' or mode == '24' or mode == '25':
                        if mode == '21':
                            if first21:
                                first21 = False
                            else:
                                url += ";s"
                        url = myResolver.Resolve(url, mode)
                        if url is None or url == "down":
                            continue
                    elif mode == '10' or mode == '13':
                        continue
                    else:
                        url = "http://localhost:{0}/?url={1}&mode={2}".format(
                            portNum, url.replace('?', '&'), mode)

            tvg_name = item['name'].replace(' ', '_')
            tvg_logo = common.GetLogoFileName(item)
            radio = ' radio="true"' if item['type'].lower() == "audio" else ''
            group = ' group-title="{0}"'.format(
                item['group']) if item.has_key('group') else ''
            iptvList += '\n#EXTINF:-1 tvg-id="{0}" tvg-name="{1}"{2} tvg-logo="{3}"{4},{5}\n{6}\n'.format(
                tvg_id, tvg_name, group, tvg_logo, radio, view_name, url)
        except Exception as e:
            print e

    f = open(iptvFile, 'w')
    f.write(iptvList)
    f.close()
Ejemplo n.º 4
0
def makeIPTVlist(iptvFile):
    iptvType = GetIptvType()
    iptvList = '#EXTM3U\n'

    channelsList = GetIptvChannels()
    portNum = common.GetLivestreamerPort()
    hostName = '127.0.0.1'

    for item in channelsList:
        try:
            tvg_id = item['name']
            view_name = item['name']
            tvg_name = item['name'].replace(' ', '_')
            tvg_logo = item[
                'image'] if iptvType > 1 else common.GetLogoFileName(item)
            if iptvType == 0:
                tvg_logo = tvg_logo[:tvg_logo.rfind('.')]
            radio = ' radio="true"' if item['type'].lower() == "audio" else ''
            group = ' group-title="{0}"'.format(
                item['group']) if item.has_key('group') else ''

            url = item['url']
            if "mode=" in url:
                if KodiPlayer:
                    url = "http://{0}:{1}/?url=plugin://plugin.video.israelive/&channelid={2}".format(
                        hostName, portNum, item['id'])
                    if item.get('catid') == 'Favourites':
                        url += '&mode=11'
                    else:
                        url += '&mode=10'
                else:
                    regex = re.compile('[\?|&]mode=(\-?[0-9]+)',
                                       re.I + re.M + re.U + re.S)
                    matches = regex.findall(url)
                    if len(matches) > 0:
                        url = regex.sub('', url).strip()
                        mode = matches[0]
                        if myResolver is not None and (mode == '-3' or mode
                                                       == '0' or mode == '16'
                                                       or mode == '34'):
                            url = myResolver.Resolve(url, mode)
                            if url is None:
                                continue
                        elif mode == '13':
                            continue
                        else:
                            url = "http://{0}:{1}/?url={2}&mode={3}".format(
                                hostName, portNum,
                                urllib.quote(url.replace('?', '&')), mode)
            iptvList += '\n#EXTINF:-1 tvg-id="{0}" tvg-name="{1}"{2} tvg-logo="{3}"{4},{5}\n{6}\n'.format(
                tvg_id, tvg_name, group, tvg_logo, radio, view_name, url)
        except Exception as ex:
            xbmc.log("{0}".format(ex), 3)

    with open(iptvFile, 'w') as f:
        f.write(iptvList)
Ejemplo n.º 5
0
def GetFullLink(url, mode):
    if mode != 0 and mode != -3:
        url = myResolver.Resolve(url, mode)
    if mode == -2 or mode == -3:
        url = "hds://{0}".format(url)
    elif mode == 1 or mode == 4 or mode == 5 or mode == 12 or mode == 15:
        url = "hls://{0}".format(url)
    elif mode != 0:
        url = "hlsvariant://{0}".format(url)
    return url
Ejemplo n.º 6
0
def makeIPTVlist(iptvFile):
    iptvType = GetIptvType()
    iptvList = '#EXTM3U\n'

    channelsList = GetIptvChannels()
    portNum = common.GetLivestreamerPort()

    for item in channelsList:
        try:
            url = item['url']
            tvg_id = item['name']
            view_name = item['name']

            matches = re.compile('^(.*?)[\?|&]mode=(\-?[0-9]+)(.*?)$',
                                 re.I + re.M + re.U + re.S).findall(url)
            if len(matches) > 0:
                url = matches[0][0]
                mode = matches[0][1]
                if len(matches[0]) > 2:
                    url += matches[0][2]
                if mode == '-3' or mode == '0' or mode == '16' or mode == '34':
                    url = myResolver.Resolve(url, mode)
                    if url is None or url == "down":
                        continue
                elif mode == '13':
                    continue
                else:
                    url = "http://localhost:{0}/?url={1}&mode={2}".format(
                        portNum, urllib.quote(url.replace('?', '&')), mode)

            tvg_name = item['name'].replace(' ', '_')
            tvg_logo = item[
                'image'] if iptvType > 1 else common.GetLogoFileName(item)
            if iptvType == 0:
                tvg_logo = tvg_logo[:tvg_logo.rfind('.')]

            radio = ' radio="true"' if item['type'].lower() == "audio" else ''
            group = ' group-title="{0}"'.format(
                item['group']) if item.has_key('group') else ''
            iptvList += '\n#EXTINF:-1 tvg-id="{0}" tvg-name="{1}"{2} tvg-logo="{3}"{4},{5}\n{6}\n'.format(
                tvg_id, tvg_name, group, tvg_logo, radio, view_name, url)
        except Exception as ex:
            xbmc.log("{0}".format(ex), 3)

    with open(iptvFile, 'w') as f:
        f.write(iptvList)
Ejemplo n.º 7
0
def PlayChannel(url, name, iconimage, description, categoryName):
    try:
        if url.find('www.youtube.com') > 0:
            url = myResolver.GetYoutubeFullLink(url)
        elif url == "BB":
            url = myResolver.Resolve(url, -1)
        elif '.f4m' in url:
            url = url[url.find('http://'):]
            if 'keshet' in url:
                ticket = myResolver.GetMinus2Ticket()
                url = "{0}?{1}&hdcore=3.0.3".format(url, ticket)
            from F4mProxy import f4mProxyHelper
            url = f4mProxyHelper().playF4mLink(urllib.unquote_plus(url))
        elif "mode=" in url:
            matches = re.compile('^(.*?)[\?|&]mode=(\-?[0-9]+)(.*?)$',
                                 re.I + re.M + re.U + re.S).findall(url)
            if len(matches) > 0:
                url = matches[0][0]
                mode = matches[0][1]
                if len(matches[0]) > 2:
                    url += matches[0][2]
                if mode == '3':
                    if useIPTV:
                        url = GetLivestreamerLink(url)
                    else:
                        return False
                else:
                    if mode == '0':
                        mode = '-3'
                        url = url[url.rfind(';') + 1:]
                    url = myResolver.Resolve(url, mode, useRtmp=useRtmp)
        if url is None or url == "down":
            return False
    except Exception as ex:
        print ex
        print "Cannot resolve stream URL for channel '{0}'".format(
            urllib.unquote_plus(name))
        xbmc.executebuiltin(
            "Notification({0}, Cannot resolve stream URL for channel '[COLOR {1}][B]{2}[/B][/COLOR]', {3}, {4})"
            .format(AddonName, Addon.getSetting("chColor"),
                    urllib.unquote_plus(name), 5000, __icon2__))
        return False

    channelName, programmeName = GetPlayingDetails(urllib.unquote_plus(name),
                                                   categoryName)

    listItem = xbmcgui.ListItem(path=url)
    listItem.setInfo(type="Video", infoLabels={"title": programmeName})
    #listItem.setInfo(type="Video", infoLabels={ "studio": channelName})
    listItem.setInfo(type="Video",
                     infoLabels={
                         "tvshowtitle": channelName,
                         "episode": "0",
                         "season": "0"
                     })
    listItem.setInfo(type="Video", infoLabels={"plot": description})
    if iconimage is not None:
        listItem.setThumbnailImage(iconimage)
    xbmcplugin.setResolvedUrl(handle=int(sys.argv[1]),
                              succeeded=True,
                              listitem=listItem)
    return True
Ejemplo n.º 8
0
# -*- coding: utf-8 -*-
import xbmcplugin, xbmcgui
import sys, urlparse, re
import myResolver

params = dict(urlparse.parse_qsl(sys.argv[2].replace('?','')))
mode = params.get('mode')
regex = re.compile('[\?|&]mode=(\-?[0-9]+)', re.I+re.M+re.U+re.S)
url = regex.sub('', sys.argv[2][5:]).strip()
url = myResolver.Resolve(url, mode)
listItem = xbmcgui.ListItem(path=url)
xbmcplugin.setResolvedUrl(handle=int(sys.argv[1]), succeeded=True, listitem=listItem)