コード例 #1
0
 def parseLive(self, data, service):
     data = data.replace('\\/', '/').replace('\\"', '"')
     urls = re.findall('hlsManifestUrl":"(http.*?\.m3u8)"(?:}|,)', data,
                       re.S)
     if urls:
         uri = urls[-1]
         try:
             if not service.ptrValid():
                 Log.w("Service became invalid!")
                 return
             if uri:
                 if "hls_variant" in uri:
                     getPage(uri).addCallback(self.parseData, service)
                 else:
                     uri = uri.replace('%252F', '%2F').replace(
                         '%253D',
                         '%3D').replace('%252B',
                                        '%2B').replace('%253B', '%3B')
                     service.setResolvedUri(uri,
                                            eServiceReference.idDVB)
             else:
                 service.failedToResolveUri()
         except:
             service.failedToResolveUri()
     else:
         service.failedToResolveUri()
        def resolve(self, service, uri):
            Log.i(uri)
            uri = uri.replace('mp_euronews://', '').lower().strip()
            if uri == 'en':
                uri = 'www'
            uri = "http://%s.euronews.com/api/watchlive.json" % uri

            def onUrlReady(uri):
                try:
                    if not service.ptrValid():
                        Log.w("Service became invalid!")
                        return
                    if uri:
                        service.setResolvedUri(uri, eServiceReference.idGST)
                    else:
                        service.failedToResolveUri()
                except:
                    service.failedToResolveUri()

            if uri:
                getPage(uri).addCallback(self.parseLive, service)
            else:
                service.failedToResolveUri()

            return True
コード例 #3
0
        def resolve(self, service, uri):
            Log.i(uri)
            liveurl = None
            try:
                uri = uri.split("://")[1]
                uri = uri.split("/")
                if uri[0] == "live":
                    liveurl = "https://youtube.com/user/%s/live" % uri[1]
                    video_id = None
                else:
                    video_id = uri[0]
            except:
                pass

            def onUrlReady(uri):
                try:
                    if not service.ptrValid():
                        Log.w("Service became invalid!")
                        return
                    if uri:
                        if ".m3u8" in uri:
                            if "hls_variant" in uri:
                                getPage(uri).addCallback(
                                    self.parseData, service)
                            else:
                                uri = uri.replace('%252F', '%2F').replace(
                                    '%253D', '%3D').replace('%252B',
                                                            '%2B').replace(
                                                                '%253B', '%3B')
                                service.setResolvedUri(uri,
                                                       eServiceReference.idDVB)
                        else:
                            service.setResolvedUri(uri,
                                                   eServiceReference.idGST)
                    else:
                        service.failedToResolveUri()
                except:
                    service.failedToResolveUri()

            if video_id:
                y = youtubeUrl(self)
                y.addCallback(onUrlReady)
                y.getVideoUrl(video_id, 2, dash=None, fmt_map=None)
            elif liveurl:
                getPage(liveurl).addCallback(self.parseLive, service)
            else:
                service.failedToResolveUri()

            return True
 def parseLive(self, data, service):
     data = data.replace('\/', '/')
     urls = re.findall('url":"(.*?)"', data, re.S)
     if urls:
         uri = urls[-1]
     try:
         if not service.ptrValid():
             Log.w("Service became invalid!")
             return
         if uri:
             getPage(uri).addCallback(self.parseData, service)
         else:
             service.failedToResolveUri()
     except:
         service.failedToResolveUri()
コード例 #5
0
 def onUrlReady(uri):
     try:
         if not service.ptrValid():
             Log.w("Service became invalid!")
             return
         if uri:
             if ".m3u8" in uri:
                 if "hls_variant" in uri:
                     getPage(uri).addCallback(
                         self.parseData, service)
                 else:
                     uri = uri.replace('%252F', '%2F').replace(
                         '%253D', '%3D').replace('%252B',
                                                 '%2B').replace(
                                                     '%253B', '%3B')
                     service.setResolvedUri(uri,
                                            eServiceReference.idDVB)
             else:
                 service.setResolvedUri(uri,
                                        eServiceReference.idGST)
         else:
             service.failedToResolveUri()
     except:
         service.failedToResolveUri()
コード例 #6
0
 def retry(err):
     return getPage(url.replace('https:', 'http:'), *args, **kwargs)
コード例 #7
0
            def bg_cb(sess, resp):
                c = resp.content
                d.callback(c)

            if method == "GET":
                session.get(url, background_callback=bg_cb, *args, **kwargs)
            elif method == "POST":
                kwargs["data"] = kwargs.pop("postdata")
                session.post(url, background_callback=bg_cb, *args, **kwargs)
            return d
        except Exception, err:
            printl("Error: " + str(err), None, "E")
            d.errback(failure.Failure())
    else:
        return getPage(url.replace("https:", "http:"), *args, **kwargs)


import mp_globals
from mp_globals import std_headers
from streams import isSupportedHoster, get_stream_link
from mpscreen import MPScreen, SearchHelper
from simpleplayer import SimplePlayer
from coverhelper import CoverHelper
from showAsThumb import ThumbsHelper
from messageboxext import MessageBoxExt


def registerFont(file, name, scale, replacement):
    try:
        addFont(file, name, scale, replacement)