Example #1
0
    def __init__(self, updateFun = None, downloadNew = True):
        printDBG( "IconMenager.__init__" )
        self.DOWNLOADED_IMAGE_PATH_BASE = config.plugins.iptvplayer.SciezkaCache.value
        self.cm = common()

        # download queue
        self.queueDQ = []
        self.lockDQ = threading.Lock()
        self.workThread = None
        
        # already available
        self.queueAA = {}
        self.lockAA = threading.Lock()
        
        #this function will be called after a new icon will be available
        self.updateFun = None
        
        #new icons dir for each run
        self.currDownloadDir = self.DOWNLOADED_IMAGE_PATH_BASE + '/' + GetNewIconsDirName()
        if not os_path.exists(self.currDownloadDir):
            mkdirs(self.currDownloadDir)

        #load available icon from disk
        #will be runned in separeted thread to speed UP start plugin
        AsyncMethod(self.loadHistoryFromDisk)(self.currDownloadDir)

        # this is called to remove icons which are stored in old version
        AsyncMethod(RemoveAllFilesIconsFromPath)(self.DOWNLOADED_IMAGE_PATH_BASE)
        
        self.stopThread = False
        
        self.checkSpace = 0 # if 0 the left space on disk will be checked
        self.downloadNew = downloadNew
 def __init__(self):
     self.COOKIE_FILE = GetCookieDir('livespottingtv.cookie')
     self.cm = common()
     self.up = urlparser()
     self.http_params = {}
     self.http_params.update({'save_cookie': True, 'load_cookie': True, 'cookiefile': self.COOKIE_FILE})
     self.cache = {}
def getF4MLinksWithMeta(manifestUrl, checkExt=True):
    if checkExt and not manifestUrl.split("?")[0].endswith(".f4m"):
        return []

    cm = common()
    headerParams, postData = cm.getParamsFromUrlWithMeta(manifestUrl)

    retPlaylists = []
    sts, data = cm.getPage(manifestUrl, headerParams, postData)
    if sts:
        liveStreamDetected = False
        if "live" == CParsingHelper.getDataBeetwenMarkers("<streamType>", "</streamType>", False):
            liveStreamDetected = True
        bitrates = re.compile('bitrate="([0-9]+?)"').findall(data)
        for item in bitrates:
            link = strwithmeta(manifestUrl, {"iptv_proto": "f4m", "iptv_bitrate": item})
            if liveStreamDetected:
                link.meta["iptv_livestream"] = True
            retPlaylists.append({"name": "[f4m/hds] bitrate[%s]" % item, "url": link})

        if 0 == len(retPlaylists):
            link = strwithmeta(manifestUrl, {"iptv_proto": "f4m"})
            if liveStreamDetected:
                link.meta["iptv_livestream"] = True
            retPlaylists.append({"name": "[f4m/hds]", "url": link})
    return retPlaylists
 def __init__(self):
     self.COOKIE_FILE = GetCookieDir('telewizjadanet.cookie')
     self.cm = common()
     self.up = urlparser()
     self.http_params = {}
     self.http_params.update({'save_cookie': True, 'load_cookie': True, 'cookiefile': self.COOKIE_FILE})
     self.cacheList = {}
 def __init__(self):
     printDBG( 'Host __init__ begin' )
     self.cm = pCommon.common()
     self.currList = []
     self.Age = 6
     self.UkryjAge = False
     printDBG( 'Host __init__ begin' )
Example #6
0
 def __init__(self):
     self.up = urlparser.urlparser()
     self.cm = common()
     self.history = CSearchHistoryHelper('Wgrane')
     # temporary data
     self.currList = []
     self.currItem = {}
def getF4MLinksWithMeta(manifestUrl, checkExt=True):
    if checkExt and not manifestUrl.split('?')[0].endswith('.f4m'):
        return []
        
    cm = common()
    headerParams, postData = cm.getParamsFromUrlWithMeta(manifestUrl)
    
    retPlaylists = []
    sts, data = cm.getPage(manifestUrl, headerParams, postData)
    if sts:
        liveStreamDetected = False
        if 'live' == CParsingHelper.getDataBeetwenMarkers('<streamType>', '</streamType>', False):
            liveStreamDetected = True
        bitrates = re.compile('bitrate="([0-9]+?)"').findall(data)
        for item in bitrates:
            link = strwithmeta(manifestUrl, {'iptv_proto':'f4m', 'iptv_bitrate':item})
            if liveStreamDetected:
                link.meta['iptv_livestream'] = True
            retPlaylists.append({'name':'[f4m/hds] bitrate[%s]' % item, 'url':link})
        
        if 0 == len(retPlaylists):
            link = strwithmeta(manifestUrl, {'iptv_proto':'f4m'})
            if liveStreamDetected:
                link.meta['iptv_livestream'] = True
            retPlaylists.append({'name':'[f4m/hds]', 'url':link})
    return retPlaylists
 def __init__(self):
     self.COOKIE_FILE = GetCookieDir('showsporttvcom.cookie')
     self.sessionEx = MainSessionWrapper()
     self.cm = common()
     self.up = urlparser()
     self.http_params = {}
     self.http_params.update({'save_cookie': True, 'load_cookie': True, 'cookiefile': self.COOKIE_FILE})
     self.cacheList = {}
Example #9
0
 def __init__(self):
   porxyUrl = config.plugins.iptvplayer.proxyurl.value
   useProxy = config.plugins.iptvplayer.proxyOnet.value
   self.cm = pCommon.common(porxyUrl, useProxy)
   self.api = API()
   
   # SULGE
   self.currList = []
Example #10
0
 def __init__(self):
     self.cm = common()
     self.history = CSearchHistoryHelper('fighttube')
     self.ytp = YouTubeParser()
     self.ytformats = config.plugins.iptvplayer.ytformat.value
     
     # temporary data
     self.currList = []
     self.currItem = {}
    def __init__(self):
        self.cm = pCommon.common()
        self.api = drnuapi.DrNuApi(config.plugins.iptvplayer.NaszaTMP.value,60)
        
        self.valTab = None
        self.currList = []

        self.showStreamSelector = config.plugins.iptvplayer.drnuShowStreamSelector.value       
        self.warning = self.imInDenmark()
 def __init__(self):
     self.COOKIE_FILE = GetCookieDir('skylinewebcamscom.cookie')
     self.cm = common()
     self.up = urlparser()
     self.http_params = {}
     self.http_params.update({'save_cookie': True, 'load_cookie': True, 'cookiefile': self.COOKIE_FILE})
     self.cacheList = {}
     self.mainMenuCache = {}
     self.lang = config.plugins.iptvplayer.skylinewebcams_lang.value
Example #13
0
    def __init__(self, params={}):
        self.sessionEx = MainSessionWrapper() 
        self.up = urlparser()
        
        proxyURL = params.get('proxyURL', '')
        useProxy = params.get('useProxy', False)
        if 'MozillaCookieJar' == params.get('cookie_type', ''):
            self.cm = common(proxyURL, useProxy, True)
        else:
            self.cm = common(proxyURL, useProxy)

        self.currList = []
        self.currItem = {}
        if '' != params.get('history', ''):
            self.history = CSearchHistoryHelper(params['history'])
        if '' != params.get('cookie', ''):
            self.COOKIE_FILE = GetCookieDir(params['cookie'])
        self.moreMode = False
 def __init__(self):
     printDBG( 'Host __init__ begin' )
     self.exSession = MainSessionWrapper()
     self.COOKIEFILE = GetCookieDir('zalukajtv.cookie')
     self.cm = common()
     self.up = urlparser()
     self.history = CSearchHistoryHelper('wspolne')
     self.currList = []
     printDBG( 'Host __init__ end' )
Example #15
0
    def __init__(self):
        self.menuHTML = ''
        self.refresh = False
        self.cm = common()
        self.history = CSearchHistoryHelper('ninateka')

        # temporary data
        self.currList = []
        self.currItem = {}
Example #16
0
 def __init__(self):
     self.cm = common()
     self.up = urlparser()
     self.sessionEx = MainSessionWrapper()
     self.cookiePath = GetCookieDir('ustvnow.cookie')
     self.token = ''
     
     HTTP_HEADER= dict(self.HTTP_HEADER)
     HTTP_HEADER.update( {'Content-Type':'application/x-www-form-urlencoded'} )
     self.defParams = {'header':HTTP_HEADER, 'cookiefile': self.cookiePath, 'use_cookie': True, 'load_cookie':True, 'save_cookie':True}
Example #17
0
 def __init__(self):
     self.MAIN_URL   = 'https://edem.tv/'
     self.HTTP_HEADER  = { 'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:12.0) Gecko/20100101 Firefox/12.0', 'Referer': self.MAIN_URL }
     self.COOKIE_FILE = GetCookieDir('edemtv.cookie')
     self.cm = common()
     self.up = urlparser()
     self.http_params = {}
     self.http_params.update({'save_cookie': True, 'load_cookie': True, 'cookiefile': self.COOKIE_FILE})
     self.cacheChannels = {}
     self.sessionEx = MainSessionWrapper()
Example #18
0
 def __init__(self):
     self.up = urlparser.urlparser()
     self.cm = pCommon.common()
     self.history = CSearchHistoryHelper('iptak')
     # temporary data
     self.currList = []
     self.currItem = {}
     
     # for cache to speedUp
     self.menuData = None
def getDirectM3U8Playlist(M3U8Url, checkExt=True, variantCheck=True, cookieParams={}):
    if checkExt and not M3U8Url.split("?")[0].endswith(".m3u8"):
        return []

    cm = common()
    meta = strwithmeta(M3U8Url).meta
    params, postData = cm.getParamsFromUrlWithMeta(M3U8Url)
    params.update(cookieParams)

    retPlaylists = []
    try:
        finallM3U8Url = meta.get("iptv_m3u8_custom_base_link", "")
        if "" == finallM3U8Url:
            params["return_data"] = False
            sts, response = cm.getPage(M3U8Url, params, postData)
            finallM3U8Url = response.geturl()
            data = response.read().strip()
            response.close()
        else:
            sts, data = cm.getPage(M3U8Url, params, postData)
            data = data.strip()

        m3u8Obj = m3u8.inits(data, finallM3U8Url)
        if m3u8Obj.is_variant:
            for playlist in m3u8Obj.playlists:
                item = {}
                if not variantCheck or playlist.absolute_uri.split("?")[-1].endswith(".m3u8"):
                    meta.update({"iptv_proto": "m3u8", "iptv_bitrate": playlist.stream_info.bandwidth})
                    item["url"] = strwithmeta(playlist.absolute_uri, meta)
                else:
                    meta.pop("iptv_proto", None)
                    item["url"] = decorateUrl(playlist.absolute_uri, meta)

                item["bitrate"] = playlist.stream_info.bandwidth
                if None != playlist.stream_info.resolution:
                    item["with"] = playlist.stream_info.resolution[0]
                    item["heigth"] = playlist.stream_info.resolution[1]
                else:
                    item["with"] = 0
                    item["heigth"] = 0
                item["codec"] = playlist.stream_info.codecs
                item["name"] = "bitrate: %s res: %dx%d kodek: %s" % (
                    item["bitrate"],
                    item["with"],
                    item["heigth"],
                    item["codec"],
                )
                retPlaylists.append(item)
        else:
            item = {"name": "m3u8", "url": M3U8Url, "codec": "unknown", "with": 0, "heigth": 0, "bitrate": "unknown"}
            retPlaylists.append(item)
    except:
        printExc()
    return retPlaylists
 def __init__(self):
     printDBG("Starting TVP.INFO")
     self.cm = pCommon.common()
     
     self.currList = []
     
     self.name = "None"
     self.title = "title"
     self.category = "category"
     self.url = "url"
     self.page = "0"
Example #21
0
 def __init__(self):
     self.COOKIE_FILE = GetCookieDir('pierwszatv.cookie')
     self.COOKIE_FILE2 = GetCookieDir('pierwszatv2.cookie')
     self.COOKIE_FILE3 = GetCookieDir('pierwszatv3.cookie')
     self.sessionEx = MainSessionWrapper()
     self.cm = common()
     self.up = urlparser()
     self.http_params = {'header': dict(self.HTTP_HEADER), 'save_cookie': True, 'load_cookie': True, 'cookiefile': self.COOKIE_FILE}
     self.http_params2 = {'header': dict(self.HTTP_HEADER), 'save_cookie': True, 'load_cookie': True, 'cookiefile': self.COOKIE_FILE2}
     self.http_params3 = {'header': dict(self.HTTP_HEADER), 'save_cookie': True, 'load_cookie': True, 'cookiefile': self.COOKIE_FILE3}
     self.cacheList = {}
    def __init__(self):
        self.cm = common()
        self.cm.HOST = FilmOnComApi.HTTP_USER_AGENT

        self.middleware  = 'http://la.api.filmon.com'
        self.session_key = None
        self.comscore    = {}
        self.jsonData = {'channels' : [], 'groups' : []}
        self.streamprotocol  = config.plugins.iptvplayer.filmontvcom_streamprotocol.value
        self.PREMIUM         = config.plugins.iptvplayer.filmontvcom_premium.value
        self.LOGIN           = config.plugins.iptvplayer.filmontvcom_login.value
        self.PASSWORD        = config.plugins.iptvplayer.filmontvcom_password.value
def getDirectM3U8Playlist(M3U8Url, checkExt=True, variantCheck=True, cookieParams={}):
    if checkExt and not M3U8Url.split('?')[0].endswith('.m3u8'):
        return []
        
    cm = common()
    meta = strwithmeta(M3U8Url).meta
    params, postData = cm.getParamsFromUrlWithMeta(M3U8Url)
    params.update(cookieParams)
    
    retPlaylists = []
    try:
        finallM3U8Url = meta.get('iptv_m3u8_custom_base_link', '') 
        if '' == finallM3U8Url:
            params['return_data'] = False
            sts, response = cm.getPage(M3U8Url, params, postData)
            finallM3U8Url = response.geturl()
            data = response.read().strip()
            response.close()
        else:
            sts, data = cm.getPage(M3U8Url, params, postData)
            data = data.strip()
            
        m3u8Obj = m3u8.inits(data, finallM3U8Url)
        if m3u8Obj.is_variant:
            for playlist in m3u8Obj.playlists:
                item = {}
                if not variantCheck or playlist.absolute_uri.split('?')[-1].endswith('.m3u8'):
                    meta.update({'iptv_proto':'m3u8', 'iptv_bitrate':playlist.stream_info.bandwidth})
                    item['url'] = strwithmeta(playlist.absolute_uri, meta)
                else:
                    meta.pop('iptv_proto', None)
                    item['url'] = decorateUrl(playlist.absolute_uri, meta)
                
                item['bitrate'] = playlist.stream_info.bandwidth
                if None != playlist.stream_info.resolution:
                    item['with'] = playlist.stream_info.resolution[0]
                    item['heigth'] = playlist.stream_info.resolution[1]
                else:
                    item['with'] = 0
                    item['heigth'] = 0
                item['codec'] = playlist.stream_info.codecs
                item['name']  = "bitrate: %s res: %dx%d kodek: %s" % ( item['bitrate'], \
                                                                        item['with'],    \
                                                                        item['heigth'],  \
                                                                        item['codec'] )
                retPlaylists.append(item)
        else:
            item = {'name':'m3u8', 'url':M3U8Url, 'codec':'unknown', 'with':0, 'heigth':0, 'bitrate':'unknown'}
            retPlaylists.append(item)
    except:
        printExc()
    return retPlaylists
    def __init__(self):

        
        printDBG('Loading ' + serialeo.SERVICE)
        

        self.cm = common()
        self.up = urlparser.urlparser()
        self.history = CSearchHistoryHelper('serialeo')
        

        self.tabMenu = []
        self.currList = []
 def __init__(self):
     self.up = urlparser.urlparser()
     self.cm = pCommon.common()
     self.sessionEx = MainSessionWrapper()
     self.ytp = YouTubeParser()
     self.ytformats = config.plugins.iptvplayer.ytformat.value
     # Temporary data
     self.currList = []
     self.currItem = {}
     # Login data
     self.COOKIEFILE = GetCookieDir('Diff-anime.cookie')
     self.usePremiumAccount = config.plugins.iptvplayer.diffanime_premium.value
     self.username = config.plugins.iptvplayer.diffanime_login.value
     self.password = config.plugins.iptvplayer.diffanime_password.value
    def getRemoteContentInfoByUrllib(url, addParams = {}):
        remoteContentInfo = {}
        addParams = DMHelper.downloaderParams2UrllibParams(addParams)
        addParams['return_data'] = False
        
        cm = common()
        # only request
        sts,response = cm.getPage(url, addParams)
        if sts:
            tmpInfo = response.info()
            remoteContentInfo = {'Content-Length': tmpInfo.get('Content-Length', -1), 'Content-Type': tmpInfo.get('Content-Type', '')}
        if response:
            try: response.close()
            except: pass

        printDBG("getRemoteContentInfoByUrllib: [%r]" % remoteContentInfo)
        return sts,remoteContentInfo
 def __init__(self):
     printDBG("GroovesharkApi.__init__")
     self.cm = common()
     self.cm.HEADER   = GroovesharkApi.JSON_HTTP_HEADER
     self.headerParams = {'use_cookie': True, 'save_cookie': True, 'load_cookie': True, 'cookiefile': GetCookieDir('Grooveshark.com'), 'raw_post_data': True}
     
     self.requestMacro = {}
     self.config = {}
     self.locales = {}
     self.loginData = {}
     self.secretKey = ""
     self.revToken = 'gooeyFlubber'
     self.currentToken   = ''
     self.lastRandomizer = ''
     self.tokenExpires = 0
     self.lastApiError = {'code':0, 'message':''}
     
     self.cache = {}
 def __init__(self):
     self.up = urlparser()
     self.cm = common()
     # temporary data
     self.currList = []
     self.currItem = {}
     
     #Login data
     self.sort = config.plugins.iptvplayer.SortowanieWebstream.value
     self.sessionEx = MainSessionWrapper()
     self.filmOnApi    = None
     self.videoStarApi = None
     self.satLiveApi   = None
     self.vidTvApi     = None
     self.looknijTvApi = None
     self.tvSportCdaApi= None
     self.nettvpwApi   = None
     self.weebTvApi    = None
     self.teamCastTab  = {}
    def __init__(self, session):
        printDBG("UpdateMainAppImpl.__init__ -------------------------------")
        self.session = session
        IUpdateObjectInterface.__init__(self, session)
        self.cm = common()

        self.setup_title = _("IPTVPlayer - update")
        self.tmpDir = GetTmpDir('iptv_update')
        self.ExtensionPath = resolveFilename(SCOPE_PLUGINS, 'Extensions/')
        self.ExtensionTmpPath = None
        
        self.terminating = False
        self.status      = 'none'
        self.downloader  = None
        self.cmd         = None
        self.serversList = []
        self.currServIdx = 0
        
        self.sourceArchive      = None
        self.destinationArchive = None
        self.serverIdx          = 0
Example #30
0
 def __init__(self):
     self.cm = common()
     self.up = urlparser()
Example #31
0
 def __init__(self, forYouyube=False):
     self.cm = common()
     self.forYouyube = forYouyube
Example #32
0
 def __init__(self, lang='en'):
     self.cm = common()
     self.sessionEx = MainSessionWrapper()
     self.MAIN_URL = 'https://www.9kw.eu/'
 def __init__(self, lang='en'):
     self.cm = common()
     self.sessionEx = MainSessionWrapper()
     self.MAIN_URL = 'https://2captcha.com/'
Example #34
0
 def __init__(self):
     self.cm = common()
     self.channlesTree = []
Example #35
0
 def __init__(self):
     self.cm = common()
     self.cm.HEADER = {
         'User-Agent': self.cm.getDefaultHeader()['User-Agent'],
         'X-Requested-With': 'XMLHttpRequest'
     }
Example #36
0
def getDirectM3U8Playlist(M3U8Url, checkExt=True, variantCheck=True, cookieParams={}, checkContent=False, sortWithMaxBitrate=-1, mergeAltAudio=True):
    if checkExt and not M3U8Url.split('?', 1)[0].endswith('.m3u8'):
        return []
        
    cm = common()
    meta = strwithmeta(M3U8Url).meta
    params, postData = cm.getParamsFromUrlWithMeta(M3U8Url)
    params.update(cookieParams)
    
    retPlaylists = []
    try:
        finallM3U8Url = meta.get('iptv_m3u8_custom_base_link', '') 
        if '' == finallM3U8Url:
            params['with_metadata'] = True
            sts, data = cm.getPage(M3U8Url, params, postData)
            finallM3U8Url = data.meta['url']
        else:
            sts, data = cm.getPage(M3U8Url, params, postData)
            data = data.strip()
            
        m3u8Obj = m3u8.inits(data, finallM3U8Url)
        if m3u8Obj.is_variant:
            for playlist in m3u8Obj.playlists:
                item = {}
                if not variantCheck or playlist.absolute_uri.split('?')[-1].endswith('.m3u8'):
                    meta.update({'iptv_proto':'m3u8', 'iptv_bitrate':playlist.stream_info.bandwidth})
                    item['url'] = strwithmeta(playlist.absolute_uri, meta)
                else:
                    meta.pop('iptv_proto', None)
                    item['url'] = decorateUrl(playlist.absolute_uri, meta)
                
                item['bitrate'] = playlist.stream_info.bandwidth
                if None != playlist.stream_info.resolution:
                    item['with'] = playlist.stream_info.resolution[0]
                    item['heigth'] = playlist.stream_info.resolution[1]
                else:
                    item['with'] = 0
                    item['heigth'] = 0
                
                item['width'] = item['with']
                item['height'] = item['heigth']
                try:
                    tmpCodecs =  playlist.stream_info.codecs.split(',')
                    codecs = []
                    for c in tmpCodecs[::-1]:
                        codecs.append(c.split('.')[0].strip())
                        item['codecs'] = ','.join(codecs)
                except Exception:
                    item['codecs'] = None
                    
                item['name']  = "bitrate: %s res: %dx%d %s" % (item['bitrate'], \
                                                               item['width'], \
                                                               item['height'], \
                                                               item['codecs'] )
                if mergeAltAudio and playlist.alt_audio_streams and item['url'].meta.get('iptv_proto') == 'm3u8':
                    for audio_stream in playlist.alt_audio_streams:
                        audioUrl = strwithmeta(audio_stream.absolute_uri, item['url'].meta)
                        altItem = dict(item)
                        altItem['name'] = '[%s] %s' % (audio_stream.name, altItem['name'])
                        altItem['url'] = decorateUrl("merge://audio_url|video_url", {'audio_url':audioUrl, 'video_url':altItem['url'], 'ff_out_container':'mpegts', 'prefered_merger':'hlsdl'})
                        retPlaylists.append(altItem)
                else:
                    item['alt_audio_streams'] = playlist.alt_audio_streams
                    retPlaylists.append(item)
        
            if sortWithMaxBitrate > -1:
                def __getLinkQuality( itemLink ):
                    try:
                        return int(itemLink['bitrate'])
                    except Exception:
                        printExc()
                        return 0
                retPlaylists = CSelOneLink(retPlaylists, __getLinkQuality, sortWithMaxBitrate).getSortedLinks()
        else:
            if checkContent and 0 == len(m3u8Obj.segments):
                return []
            item = {'name':'m3u8', 'url':M3U8Url, 'codec':'unknown', 'with':0, 'heigth':0, 'width':0, 'height':0, 'bitrate':'unknown'}
            retPlaylists.append(item)
    except Exception:
        printExc()
    return retPlaylists
Example #37
0
 def __init__(self):
     self.cm = common()
     self.COOKIE_FILE = GetCookieDir('teledunet.cookie')
Example #38
0
 def __init__(self):
     self.up = urlparser()
     self.cm = common()
     self.HTTP_HEADER = {'User-Agent': self.USER_AGENT, 'Referer': ''}
     self.COOKIEFILE = GetCookieDir("hdgocc.cookie")
     self.defaultParams = {'header': self.HTTP_HEADER, 'use_cookie': True, 'save_cookie': True, 'load_cookie': False, 'cookiefile': self.COOKIEFILE}
Example #39
0
 def __init__(self):
   porxyUrl = config.plugins.iptvplayer.proxyurl.value
   useProxy = config.plugins.iptvplayer.proxyOnet.value
   self.cm = pCommon.common(porxyUrl, useProxy)
Example #40
0
 def __init__(self):
     self.cm = common()
     self.sessionEx = MainSessionWrapper()
     self._reInit()
     self.channelsList = []
Example #41
0
 def __init__(self):
     self.cm = common()
     self.up = urlparser()
     self.defaultParams = {'header':{'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0'}, 'use_cookie': True, 'load_cookie': True, 'save_cookie': True, 'cookiefile': AnyFilesVideoUrlExtractor.COOKIEFILE}
     self.logged = False
def getDirectM3U8Playlist(M3U8Url,
                          checkExt=True,
                          variantCheck=True,
                          cookieParams={}):
    if checkExt and not M3U8Url.split('?')[0].endswith('.m3u8'):
        return []

    cm = common()
    meta = strwithmeta(M3U8Url).meta
    params, postData = cm.getParamsFromUrlWithMeta(M3U8Url)
    params.update(cookieParams)

    retPlaylists = []
    try:
        finallM3U8Url = meta.get('iptv_m3u8_custom_base_link', '')
        if '' == finallM3U8Url:
            params['return_data'] = False
            sts, response = cm.getPage(M3U8Url, params, postData)
            finallM3U8Url = response.geturl()
            data = response.read().strip()
            response.close()
        else:
            sts, data = cm.getPage(M3U8Url, params, postData)
            data = data.strip()

        m3u8Obj = m3u8.inits(data, finallM3U8Url)
        if m3u8Obj.is_variant:
            for playlist in m3u8Obj.playlists:
                item = {}
                if not variantCheck or playlist.absolute_uri.split(
                        '?')[-1].endswith('.m3u8'):
                    meta.update({
                        'iptv_proto': 'm3u8',
                        'iptv_bitrate': playlist.stream_info.bandwidth
                    })
                    item['url'] = strwithmeta(playlist.absolute_uri, meta)
                else:
                    meta.pop('iptv_proto', None)
                    item['url'] = decorateUrl(playlist.absolute_uri, meta)

                item['bitrate'] = playlist.stream_info.bandwidth
                if None != playlist.stream_info.resolution:
                    item['with'] = playlist.stream_info.resolution[0]
                    item['heigth'] = playlist.stream_info.resolution[1]
                else:
                    item['with'] = 0
                    item['heigth'] = 0
                item['codec'] = playlist.stream_info.codecs
                item['name']  = "bitrate: %s res: %dx%d kodek: %s" % ( item['bitrate'], \
                                                                        item['with'],    \
                                                                        item['heigth'],  \
                                                                        item['codec'] )
                retPlaylists.append(item)
        else:
            item = {
                'name': 'm3u8',
                'url': M3U8Url,
                'codec': 'unknown',
                'with': 0,
                'heigth': 0,
                'bitrate': 'unknown'
            }
            retPlaylists.append(item)
    except:
        printExc()
    return retPlaylists
Example #43
0
def getMPDLinksWithMeta(manifestUrl, checkExt=True, cookieParams={}, sortWithMaxBandwidth=-1):
    if checkExt and not manifestUrl.split('?')[0].endswith('.mpd'):
        return []
        
    cm = common()
    
    def _getNumAttrib(data, name, default=0):
        try: return int(cm.ph.getSearchGroups(data, '[\s]' + name + '''=['"]([^'^"]+?)['"]''')[0])
        except Exception: return default
    
    headerParams, postData = cm.getParamsFromUrlWithMeta(manifestUrl)
    headerParams.update(cookieParams)
    
    retPlaylists = []
    sts, data = cm.getPage(manifestUrl, headerParams, postData)
    if sts:
        liveStreamDetected = False
        if 'type="dynamic"' in data:
            liveStreamDetected = True
        
        representation = {'audio':[], 'video':[]}
        tmp = cm.ph.getAllItemsBeetwenMarkers(data, "<Period", '</Period>', withMarkers=True)
        if len(tmp): data = tmp[-1]
        # TODO!!! select period based on duration
        data = cm.ph.getAllItemsBeetwenMarkers(data, "<AdaptationSet", '</AdaptationSet>', withMarkers=True)
        for item in data:
            type = ''
            if re.compile('''=['"]audio['"/]''').search(item):
                type = 'audio'
            elif re.compile('''=['"]video['"/]''').search(item):
                type = 'video'
            else:
                continue
            tmp = cm.ph.getAllItemsBeetwenMarkers(item, '<Representation', '>', withMarkers=True)
            for rep in tmp:
                repParam = {}
                repParam['bandwidth'] = _getNumAttrib(rep, 'bandwidth')
                
                repParam['codecs']  = cm.ph.getSearchGroups(rep, '''codecs=['"]([^'^"]+?)['"]''')[0]
                if '' == repParam['codecs']: repParam['codecs'] = cm.ph.getSearchGroups(item, '''codecs=['"]([^'^"]+?)['"]''')[0]
                
                repParam['codecs'] = repParam['codecs'].split('.')[0]
                if 'vp9' in repParam['codecs']:
                    continue
                
                if type == 'video':
                    repParam['width']  = _getNumAttrib(rep, 'width')
                    if 0 == repParam['width']: repParam['width']  = _getNumAttrib(item, 'width')
                    
                    repParam['height']  = _getNumAttrib(rep, 'height')
                    if 0 == repParam['height']: repParam['height']  = _getNumAttrib(item, 'height')
                    
                    repParam['frame_rate']  = cm.ph.getSearchGroups(rep, '''frameRate=['"]([^'^"]+?)['"]''')[0]
                    if '' == repParam['frame_rate']: repParam['frame_rate'] = cm.ph.getSearchGroups(item, '''frameRate=['"]([^'^"]+?)['"]''')[0]
                else:
                    repParam['lang'] = cm.ph.getSearchGroups(rep, '''lang=['"]([^'^"]+?)['"]''')[0]
                    if '' == repParam['lang']: repParam['lang'] = cm.ph.getSearchGroups(item, '''lang=['"]([^'^"]+?)['"]''')[0]
                    
                representation[type].append(repParam)
        
        audioIdx = 0
        for audio in representation['audio']:
            audioItem = {}
            audioItem['livestream'] = liveStreamDetected
            audioItem['codecs']     = audio['codecs']
            audioItem['bandwidth']  = audio['bandwidth']
            audioItem['lang']       = audio['lang']
            audioItem['audio_rep_idx'] = audioIdx
            
            if len(representation['video']):
                videoIdx = 0
                for video in representation['video']:
                    videoItem = dict(audioItem)
                    videoItem['codecs'] += ',' + video['codecs']
                    videoItem['bandwidth'] += video['bandwidth']
                    videoItem['width']      = video['width']
                    videoItem['height']     = video['height']
                    videoItem['frame_rate'] = video['frame_rate']
                    
                    videoItem['name']  = "[%s] bitrate: %s %dx%d %s %sfps" % ( videoItem['lang'],      \
                                                                               videoItem['bandwidth'], \
                                                                               videoItem['width'],     \
                                                                               videoItem['height'],    \
                                                                               videoItem['codecs'],    \
                                                                               videoItem['frame_rate'])
                    videoItem['url'] = strwithmeta(manifestUrl, {'iptv_proto':'mpd', 'iptv_audio_rep_idx':audioIdx, 'iptv_video_rep_idx':videoIdx, 'iptv_livestream':videoItem['livestream']})
                    retPlaylists.append(videoItem)
                    videoIdx += 1
            else:
                audioItem['name']  = "[%s] bandwidth: %s %s" % ( audioItem['lang'],      \
                                                                 audioItem['bandwidth'], \
                                                                 audioItem['codecs'])
                audioItem['url'] = strwithmeta(manifestUrl, {'iptv_proto':'mpd', 'iptv_audio_rep_idx':audioIdx, 'iptv_livestream':audioItem['livestream']})
                retPlaylists.append(audioItem)
            
            audioIdx += 1
            
    if sortWithMaxBandwidth > -1:
        def __getLinkQuality( itemLink ):
            try:
                return int(itemLink['bandwidth'])
            except Exception:
                printExc()
                return 0
        retPlaylists = CSelOneLink(retPlaylists, __getLinkQuality, sortWithMaxBandwidth).getSortedLinks()
    
    return retPlaylists
Example #44
0
 def __init__(self):
     self.cm = common()
Example #45
0
 def __init__(self):
     self.cm = common()
     self.HTTP_HEADER = {'User-Agent':self.cm.getDefaultHeader(browser='chrome')['User-Agent'], 'X-Requested-With':'XMLHttpRequest'}
     self.defaultParams = {'header':self.HTTP_HEADER, 'use_cookie': True, 'load_cookie': True, 'cookiefile': self.COOKIE_FILE}
 def __init__(self):
     self.COOKIEFILE = GetCookieDir('spryciarze.cookie')
     self.cm = pCommon.common()
     self.up = urlparser.urlparser()
     self.catTree = []
     self.currList = []
 def __init__(self):
     printDBG("OpenSubOrgProvider.__init__")
     self.cm = common()
     self.doInit()
Example #48
0
 def __init__(self):
     self.cm = common()  #proxyURL= '', useProxy = True)
     self.up = urlparser()
     self.sessionEx = MainSessionWrapper()
Example #49
0
 def __init__(self):
     self.cm = pCommon.common()
     self.currList = []
     self.ytp = YouTubeParser()
     self.ytformats = config.plugins.iptvplayer.ytformat.value
Example #50
0
 def __init__(self):
     self.COOKIE_FILE = GetCookieDir('satlivetv.cookie')
     self.cm = common()
     self.sessionEx = MainSessionWrapper()
     self.loggedIn = True
     self.http_params = {}
Example #51
0
 def __init__(self):
     self.cm = common()
     # temporary data
     self.currList = []
     self.currItem = {}
Example #52
0
 def __init__(self, params={}):
     proxyURL = params.get('proxyURL', '')
     useProxy = params.get('useProxy', False)
     self.cm = common(proxyURL, useProxy)
     self.cm.HOST = 'Mozilla/5.0 (X11; Linux x86_64; rv:59.0) Gecko/20100101 Firefox/59.0' #'Mpython-urllib/2.7'
Example #53
0
 def __init__(self):
     self.cm = common()
     self.up = urlparser()
     self.sessionEx = MainSessionWrapper()
     self.defParams = {'header': self.HTTP_HEADER}
     self.warned = False
Example #54
0
 def __init__(self):
     printDBG( 'Host __init__ begin' )
     self.cm = pCommon.common()
     self.currList = []
     printDBG( 'Host __init__ begin' )