当前位置: 首页>>代码示例>>Python>>正文


Python iptvdh.DMHelper类代码示例

本文整理汇总了Python中Plugins.Extensions.IPTVPlayer.iptvdm.iptvdh.DMHelper的典型用法代码示例。如果您正苦于以下问题:Python DMHelper类的具体用法?Python DMHelper怎么用?Python DMHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DMHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: doDowanloadSubtitle

    def doDowanloadSubtitle(self, callback, subItem, tmpDir, subDir):
        self.outerCallback = callback
        self.tmpData = {"subItem": subItem, "tmpDir": tmpDir, "subDir": subDir}
        # subItem === private_data

        tmpFile = tmpDir + OpenSubOrgProvider.TMP_FILE_NAME
        self.filesToRemove.append(tmpFile)
        self.tmpData["tmpFile"] = tmpFile
        tmpFile = " '{0}' ".format(tmpFile)

        if not subItem.get("napisy_24", False):
            params = {"User-Agent": OpenSubOrgProvider.USER_AGENT}
            url = " '{0}' ".format(subItem["SubDownloadLink"])
            cmd = DMHelper.getBaseWgetCmd(params) + url + " -O " + tmpFile + " > /dev/null 2>&1 "
            printDBG("doDowanloadSubtitle cmd[%s]" % cmd)
            self.iptv_sys = iptv_system(cmd, self._doDowanloadSubtitleCallback)
        else:
            tmpFileZip = self.tmpData["tmpFile"] + ".zip"
            self.tmpData["tmpFileZip"] = tmpFileZip
            self.filesToRemove.append(tmpFileZip)
            tmpFileZip = " '{0}' ".format(tmpFileZip)
            params = {"User-Agent": self.NAPISY24_USER_AGENT, "Referer": "http://napisy24.pl/"}
            url = "'http://napisy24.pl/run/pages/download.php?napisId={0}&typ=sr'".format(subItem["id"])
            cmd = DMHelper.getBaseWgetCmd(params) + url + " -O " + tmpFileZip + " > /dev/null 2>&1 "
            printDBG("_doSearchSubtitleNapisy24Callback cmd[%s]" % cmd)
            self.iptv_sys = iptv_system(cmd, self._doDowanloadSubtitle24Callback)
开发者ID:a4tech,项目名称:iptvplayer-for-e2,代码行数:26,代码来源:opensubtitlesorg.py

示例2: doDowanloadSubtitle

 def doDowanloadSubtitle(self, callback, subItem, tmpDir, subDir):
     self.outerCallback = callback
     self.tmpData = {'subItem':subItem, 'tmpDir':tmpDir, 'subDir':subDir}
     # subItem === private_data
     
     tmpFile = tmpDir + OpenSubOrgProvider.TMP_FILE_NAME
     self.filesToRemove.append(tmpFile)
     self.tmpData['tmpFile'] = tmpFile
     tmpFile = " '{0}' ".format(tmpFile)
     
     if not subItem.get('napisy_24', False):
         params = {'User-Agent': OpenSubOrgProvider.USER_AGENT}
         url     = " '{0}' ".format(subItem['SubDownloadLink'])
         cmd = DMHelper.getBaseWgetCmd(params) + url + ' -O ' + tmpFile + ' > /dev/null 2>&1 '
         printDBG('doDowanloadSubtitle cmd[%s]' % cmd)
         self.iptv_sys = iptv_system(cmd, self._doDowanloadSubtitleCallback)
     else:
         tmpFileZip = self.tmpData['tmpFile'] + '.zip'
         self.tmpData['tmpFileZip'] = tmpFileZip
         self.filesToRemove.append(tmpFileZip)
         tmpFileZip = " '{0}' ".format(tmpFileZip)
         params = {'User-Agent': self.NAPISY24_USER_AGENT, 'Referer':'http://napisy24.pl/'}
         url     = "'http://napisy24.pl/run/pages/download.php?napisId={0}&typ=sr'".format(subItem['id'])
         cmd = DMHelper.getBaseWgetCmd(params) + url + ' -O ' + tmpFileZip + ' > /dev/null 2>&1 '
         printDBG('_doSearchSubtitleNapisy24Callback cmd[%s]' % cmd)
         self.iptv_sys = iptv_system(cmd, self._doDowanloadSubtitle24Callback)
开发者ID:c0ns0le,项目名称:iptvplayer-for-e2-fork,代码行数:26,代码来源:opensubtitlesorg.py

示例3: start

    def start(self, url, filePath, params = {}, info_from=None, retries=0):
        '''
            Owervrite start from BaseDownloader
        '''
        self.url              = url
        self.filePath         = filePath
        self.downloaderParams = params
        self.fileExtension    = '' # should be implemented in future
        
        self.outData = ''
        self.contentType = 'unknown'
        if None == info_from:
            info_from = WgetDownloader.INFO.FROM_FILE
        self.infoFrom    = info_from
        
        if self.infoFrom == WgetDownloader.INFO.FROM_DOTS:
            info = "--progress=dot:default"
        else: info = ""
        
        cmd = DMHelper.getBaseWgetCmd(self.downloaderParams) + (' %s -t %d ' % (info, retries)) + '"' + self.url + '" -O "' + self.filePath + '" > /dev/null'
        printDBG("Download cmd[%s]" % cmd)
        
        self.console = eConsoleAppContainer()
        self.console_appClosed_conn  = eConnectCallback(self.console.appClosed, self._cmdFinished)
        self.console_stderrAvail_conn = eConnectCallback(self.console.stderrAvail, self._dataAvail)
        self.console.execute( E2PrioFix( cmd ) )

        self.wgetStatus = self.WGET_STS.CONNECTING
        self.status     = DMHelper.STS.DOWNLOADING
        
        self.onStart()
        return BaseDownloader.CODE_OK
开发者ID:a4tech,项目名称:iptvplayer-for-e2,代码行数:32,代码来源:wgetdownloader.py

示例4: _startDownloader

 def _startDownloader(self, sts, reason):
     if sts:
         self.downloader.subscribeFor_Finish(self.downloadFinished)
         url,downloaderParams = DMHelper.getDownloaderParamFromUrl(self.currItem.get('url', ''))
         self.downloader.start(url, GetTmpDir(self._TMP_FILE_NAME), downloaderParams)
     else:
         self["console"].setText(_("Download can not be started.\nDownloader %s not working correctly.\nStatus[%s]"))
开发者ID:c0ns0le,项目名称:iptvplayer-for-e2-fork,代码行数:7,代码来源:iptvsubsimpledownloader.py

示例5: start

    def start(self, url, filePath, params = {}):
        '''
            Owervrite start from BaseDownloader
        '''
        self.url              = url
        self.filePath         = filePath
        self.downloaderParams = params
        self.fileExtension    = '' # should be implemented in future
        if 'ustream.tv' in url:
            self.streamSelector = strwithmeta(url).meta.get('iptv_chank_url', '')
        else:
            self.streamSelector = strwithmeta(url).meta.get('iptv_bitrate', 0)
        
        self.outData = ''
        self.contentType = 'unknown'
        
        baseWgetCmd = DMHelper.getBaseWgetCmd(self.downloaderParams) 
        
        cmd = DMHelper.GET_F4M_PATH() + (" '%s'" % baseWgetCmd) + (' "%s"' % self.url) + (' "%s"' % self.filePath) + (' %s' % self.streamSelector) + ' > /dev/null'

        printDBG("F4mDownloader::start cmd[%s]" % cmd)
        
        self.console = eConsoleAppContainer()
        self.console_appClosed_conn = eConnectCallback(self.console.appClosed, self._cmdFinished)
        self.console_stderrAvail_conn = eConnectCallback(self.console.stderrAvail, self._dataAvail)
        self.console.execute( cmd )
        
        self.status     = DMHelper.STS.DOWNLOADING
        
        self.onStart()
        return BaseDownloader.CODE_OK
开发者ID:samsamsam-iptvplayer,项目名称:iptvplayer-for-e2,代码行数:31,代码来源:f4mdownloader.py

示例6: getResolvedURL

 def getResolvedURL(self, url):
     printDBG("LocalMedia.getResolvedURL [%s]" % url)
     videoUrls = []
     
     if url.startswith('/') and fileExists(url):
         url = 'file://'+url
     
     uri, params   = DMHelper.getDownloaderParamFromUrl(url)
     printDBG(params)
     uri = urlparser.decorateUrl(uri, params)
     
     if uri.meta.get('iptv_proto', '') in ['http', 'https']:
         urlSupport = self.up.checkHostSupport( uri )
     else:
         urlSupport = 0
     if 1 == urlSupport:
         retTab = self.up.getVideoLinkExt( uri )
         videoUrls.extend(retTab)
     elif 0 == urlSupport and self._uriIsValid(uri):
         if uri.split('?')[0].endswith('.m3u8'):
             retTab = getDirectM3U8Playlist(uri)
             videoUrls.extend(retTab)
         elif uri.split('?')[0].endswith('.f4m'):
             retTab = getF4MLinksWithMeta(uri)
             videoUrls.extend(retTab)
         else:
             videoUrls.append({'name':'direct link', 'url':uri})
     return videoUrls
开发者ID:c0ns0le,项目名称:iptvplayer-for-e2-fork,代码行数:28,代码来源:hostlocalmedia.py

示例7: _startFragment

    def _startFragment(self, tryAgain=False):
        printDBG("_startFragment tryAgain[%r]" % tryAgain)
        self.outData = ''
        self.remoteFragmentSize = -1
        self.remoteFragmentType = 'unknown'
                            
        if 0 > self.localFileSize:
            self.m3u8_prevLocalFileSize = 0
        else:
            self.m3u8_prevLocalFileSize = self.localFileSize
        ##############################################################################
        # frist download nextFragment conntent
        ##############################################################################
        self.downloadType = self.DOWNLOAD_TYPE.SEGMENT
 
        if None != self.console:
            self.console_appClosed_conn = None
            self.console_stderrAvail_conn = None
        #self.console = eConsoleAppContainer()
        self.console_appClosed_conn = eConnectCallback(self.console.appClosed,  self._cmdFinished )
        self.console_stderrAvail_conn = eConnectCallback(self.console.stderrAvail, self._dataAvail )
        
        if tryAgain and self.tries >= self.MAX_RETRIES:
            if not self.liveStream:
                return DMHelper.STS.INTERRUPTED
            else:
                # even if fragment is lost this is not big problem, download next one, 
                # this is a live stream this can happen :)
                tryAgain = False
            
        currentFragment = None
        if False == tryAgain:
            self.tries = 0
            if (self.currentFragment + 1) < len(self.fragmentList):
                self.currentFragment += 1
                currentFragment = self.fragmentList[self.currentFragment]  
        else:
            self.tries += 1
            currentFragment = self.fragmentList[self.currentFragment]        
        
        if None != currentFragment:
            self.wgetStatus = self.WGET_STS.CONNECTING
            cmd = DMHelper.getBaseWgetCmd(self.downloaderParams) + (' --tries=1 --timeout=%d ' % self._getTimeout()) + '"' + currentFragment + '" -O - >> "' + self.filePath + '"'
            printDBG("Download cmd[%s]" % cmd)
            self.console.execute( E2PrioFix( cmd ) )
            
            #with open("/home/sulge/tmp/m3u8.txt", "a") as myfile:
            #with open("/hdd/dbg_m3u8.txt", "a") as myfile:
            #    myfile.write(currentFragment+"\n")
                
            return DMHelper.STS.DOWNLOADING
        else:
            if self.liveStream:
                # we are in live so wait for new fragments
                printDBG("m3u8 downloader - wait for new fragments ----------------------------------------------------------------")
                self.downloadType = self.DOWNLOAD_TYPE.WAITTING
                self.console.execute( E2PrioFix( "sleep 2" ) )
                return DMHelper.STS.DOWNLOADING 
            else:
                return DMHelper.STS.DOWNLOADED
开发者ID:c0ns0le,项目名称:iptvplayer-for-e2-fork,代码行数:60,代码来源:m3u8downloader.py

示例8: onStart

 def onStart(self):
     self.onLayoutFinish.remove(self.onStart)
     self['progressBar'].value = 0
     self['bufferingBar'].range = (0, 100000)
     self['bufferingBar'].value = 0
     self.initGuiComponentsPos()
     if 'gstplayer' == self.player:
         gstplayerPath = config.plugins.iptvplayer.gstplayerpath.value
         #'export GST_DEBUG="*:6" &&' + 
         cmd = gstplayerPath  + ' "%s"' % self.fileSRC
         if "://" in self.fileSRC: 
             cmd += ' "%s" "%s"  "%s"  "%s" ' % (self.gstAdditionalParams['download-buffer-path'], self.gstAdditionalParams['ring-buffer-max-size'], self.gstAdditionalParams['buffer-duration'], self.gstAdditionalParams['buffer-size'])
             tmp = strwithmeta(self.fileSRC)
             url,httpParams = DMHelper.getDownloaderParamFromUrl(tmp)
             for key in httpParams: cmd += (' "%s=%s" ' % (key, httpParams[key]) )
             if 'http_proxy' in tmp.meta:
                 tmp = tmp.meta['http_proxy']
                 if '://' in tmp:
                     if '@' in tmp:
                         tmp = re.search('([^:]+?://)([^:]+?):([^@]+?)@(.+?)$', tmp)
                         if tmp: cmd += (' "proxy=%s" "proxy-id=%s" "proxy-pw=%s" ' % (tmp.group(1)+tmp.group(4), tmp.group(2), tmp.group(3)) )
                     else: cmd += (' "proxy=%s" ' % tmp)
     else:
         cmd = 'exteplayer3 "%s"' % self.fileSRC + " > /dev/null"
     
     self.console = eConsoleAppContainer()
     self.console_appClosed_conn = eConnectCallback(self.console.appClosed, self.eplayer3Finished)
     self.console_stderrAvail_conn = eConnectCallback(self.console.stderrAvail, self.eplayer3DataAvailable)
     #if 'gstplayer' == self.player: 
     #    self.console_stdoutAvail_conn = eConnectCallback(self.console.stdoutAvail, self.eplayer3DataAvailable2 ) # work around to catch EOF event after seeking, pause .etc
     printDBG("onStart cmd[%s]" % cmd)
     self.console.execute( cmd )
     self['statusIcon'].setPixmap( self.playback['statusIcons']['Play'] ) # sulge for test
开发者ID:samsamsam-iptvplayer,项目名称:iptvplayer-for-e2,代码行数:33,代码来源:iptvextmovieplayer.py

示例9: startDownloader

 def startDownloader(self, sts, reason):
     if sts:
         url,downloaderParams = DMHelper.getDownloaderParamFromUrl( self.cover['src'] )
         self.cover['downloader'] .subscribeFor_Finish(self.downloaderEnd)
         self.cover['downloader'] .start(url, self._getDownloadFilePath(), downloaderParams)
         self.showSpinner()
     else: self.session.openWithCallback(self.close, MessageBox, _("Downloading cannot be started.\n Downloader [%s] not working properly.\n Status[%s]") % (self.cover['downloader'].getName(), reason.strip()), type = MessageBox.TYPE_ERROR, timeout = 10 )        
开发者ID:a4tech,项目名称:iptvplayer-for-e2,代码行数:7,代码来源:iptvarticlerichvisualizer.py

示例10: _doSearchMovieNapisy24

 def _doSearchMovieNapisy24(self):
     params = {'User-Agent': self.NAPISY24_USER_AGENT, 'Referer':'http://napisy24.pl/'}
     query = 'title={0}'.format(urllib.quote(self.tmpData['title']))
     url     = "'http://napisy24.pl/libs/webapi.php?{0}'".format(query)
     cmd = DMHelper.getBaseWgetCmd(params) + url + ' -O - 2> /dev/null '
     printDBG('_doSearchMovieNapisy24 cmd[%s]' % cmd)
     self.iptv_sys = iptv_system(cmd, self._doSearchMovieNapisy24Callback)
开发者ID:c0ns0le,项目名称:iptvplayer-for-e2-fork,代码行数:7,代码来源:opensubtitlesorg.py

示例11: _cmdFinished

    def _cmdFinished(self, code, terminated=False):
        printDBG("MergeDownloader._cmdFinished code[%r] terminated[%r]" % (code, terminated))
        
        # break circular references
        if None != self.console:
            self.console_appClosed_conn = None
            self.console_stderrAvail_conn = None
            self.console = None

        if terminated:
            self.status = DMHelper.STS.INTERRUPTED
            self._cleanUp()
            return
        
        if self.status == DMHelper.STS.POSTPROCESSING:
            self.localFileSize = DMHelper.getFileSize(self.filePath)
            printDBG("POSTPROCESSING_cmdFinished localFileSize[%r] code[%r]" % (self.localFileSize, code))
            if self.localFileSize > 0 and code == 0:
                self.remoteFileSize = self.localFileSize
                self.status = DMHelper.STS.DOWNLOADED
            else:
                self.status = DMHelper.STS.INTERRUPTED
        elif code == 0:
            if (self.currIdx + 1) < len(self.multi['urls']):
                self.currIdx += 1
                self.doStartDownload()
                return
            else:
                self.status = DMHelper.STS.POSTPROCESSING
                self.doStartPostProcess()
                return
        if not terminated:
            self.onFinish()
        self._cleanUp()
开发者ID:c0ns0le,项目名称:iptvplayer-for-e2-fork,代码行数:34,代码来源:mergedownloader.py

示例12: _doSearchMovieNapisy24

 def _doSearchMovieNapisy24(self):
     params = {"User-Agent": self.NAPISY24_USER_AGENT, "Referer": "http://napisy24.pl/"}
     query = "title={0}".format(urllib.quote(self.tmpData["title"]))
     url = "'http://napisy24.pl/libs/webapi.php?{0}'".format(query)
     cmd = DMHelper.getBaseWgetCmd(params) + url + " -O - 2> /dev/null "
     printDBG("_doSearchMovieNapisy24 cmd[%s]" % cmd)
     self.iptv_sys = iptv_system(cmd, self._doSearchMovieNapisy24Callback)
开发者ID:a4tech,项目名称:iptvplayer-for-e2,代码行数:7,代码来源:opensubtitlesorg.py

示例13: start

 def start(self, uri, mode='loop'):
     self.uri = uri
     self.playMode = mode
     
     gstplayerPath = config.plugins.iptvplayer.gstplayerpath.value
     #'export GST_DEBUG="*:6" &&' + 
     cmd = gstplayerPath  + ' "%s"' % self.uri
     if "://" in self.uri: 
         cmd += ' "%s" "%s"  "%s"  "%s" ' % (self.gstAdditionalParams['download-buffer-path'], self.gstAdditionalParams['ring-buffer-max-size'], self.gstAdditionalParams['buffer-duration'], self.gstAdditionalParams['buffer-size'])
         tmp = strwithmeta(self.uri)
         url,httpParams = DMHelper.getDownloaderParamFromUrl(tmp)
         for key in httpParams: cmd += (' "%s=%s" ' % (key, httpParams[key]) )
         if 'http_proxy' in tmp.meta:
             tmp = tmp.meta['http_proxy']
             if '://' in tmp:
                 if '@' in tmp:
                     tmp = re.search('([^:]+?://)([^:]+?):([^@]+?)@(.+?)$', tmp)
                     if tmp: cmd += (' "proxy=%s" "proxy-id=%s" "proxy-pw=%s" ' % (tmp.group(1)+tmp.group(4), tmp.group(2), tmp.group(3)) )
                 else: cmd += (' "proxy=%s" ' % tmp)
     else:
         cmd = 'exteplayer3 "%s"' % self.uri + " > /dev/null"
     self.console = eConsoleAppContainer()
     self.console_appClosed_conn = eConnectCallback(self.console.appClosed, self._playerFinished)
     printDBG("IPTVSimpleAudioPlayer.start cmd[%s]" % cmd)
     self.console.execute( cmd )
     self.stopped = False
开发者ID:samsamsam-iptvplayer,项目名称:iptvplayer-for-e2,代码行数:26,代码来源:iptvpictureplayer.py

示例14: goGetEpisodeType

 def goGetEpisodeType(self, privateData):
     url  = "'http://www.imdb.com/title/tt{0}/episodes/_ajax?season={1}'".format(privateData['id'], privateData['season'])
     grep =  '?ref_=ttep_ep{0}"'.format(privateData['episode'])
     grep = " | grep '{0}'".format(grep)
     cmd  = DMHelper.getBaseWgetCmd({}) + url + ' -O - 2>/dev/null ' + grep
     printDBG('doGetEpisodes cmd[%s]' % cmd)
     self.iptv_sys = iptv_system(cmd, self._goGetEpisodeTypeCallback)
开发者ID:c0ns0le,项目名称:iptvplayer-for-e2-fork,代码行数:7,代码来源:opensubtitlesorg.py

示例15: doGetItemType

 def doGetItemType(self, callback, privateData):
     self.outerCallback = callback
     self.tmpData = {'imdbid':privateData['id'], 'title':privateData['title']}
     self.itemTypeCache = {'type':'movie'}        
     url     = "'https://api.themoviedb.org/3/find/tt{0}?api_key={1}&external_source=imdb_id'".format(privateData['id'], base64.b64decode('NjMxMWY4MmQ1MjAxNDI2NWQ3NjVkMzk4MDJhYWZhYTc='))
     #printDBG(url)
     cmd = DMHelper.getBaseWgetCmd({}) + url + ' -O - 2> /dev/null '
     self.iptv_sys = iptv_system(cmd, self._doGetItemTypeCallback)
开发者ID:c0ns0le,项目名称:iptvplayer-for-e2-fork,代码行数:8,代码来源:opensubtitlesorg.py


注:本文中的Plugins.Extensions.IPTVPlayer.iptvdm.iptvdh.DMHelper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。