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 self.outData = '' self.contentType = 'unknown' cmd = "python " + DMHelper.GET_PWGET_PATH( ) + ' "' + self.url + '" "' + 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
def SetupDownloaderCmdCreator(url, file): printDBG("SetupDownloaderCreator url[%s]" % url) if url.startswith('https'): if IsExecutable(DMHelper.GET_WGET_PATH()): printDBG("SetupDownloaderCreator WgetDownloader") return '%s "%s" -O "%s" ' % (DMHelper.GET_WGET_PATH(), url, file) elif IsExecutable('python'): printDBG("SetupDownloaderCreator PwgetDownloader") return 'python "%s" "%s" "%s" ' % (DMHelper.GET_PWGET_PATH(), url, file) else: if IsExecutable('wget'): printDBG("SetupDownloaderCreator BuxyboxWgetDownloader") return 'wget "%s" -O "%s" ' % (url, file) elif IsExecutable(DMHelper.GET_WGET_PATH()): printDBG("SetupDownloaderCreator WgetDownloader") return '%s "%s" -O "%s" ' % (DMHelper.GET_WGET_PATH(), url, file) elif IsExecutable('python'): printDBG("SetupDownloaderCreator PwgetDownloader") return 'python "%s" "%s" "%s" ' % (DMHelper.GET_PWGET_PATH(), url, file) printDBG("SetupDownloaderCreator downloader not available") return 'python "%s" "%s" "%s" ' % (DMHelper.GET_PWGET_PATH(), url, file)
def isWorkingCorrectly(self, callBackFun): self.iptv_sys = iptv_system( "python " + DMHelper.GET_PWGET_PATH() + " 2>&1", boundFunction(self._checkWorkingCallBack, callBackFun))