def _updateEM3U8Finished(self, code=0): printDBG('EM3U8Downloader._updateEM3U8Finished update code[%d]--- ' % (code)) if not self.em3u8Started: self.status = DMHelper.STS.ERROR HLSDownloader._terminate(self) self.onFinish()
def DownloaderCreator(url): printDBG("DownloaderCreator url[%r]" % url) downloader = None url = urlparser.decorateUrl(url) iptv_proto = url.meta.get('iptv_proto', '') if 'm3u8' == iptv_proto: if config.plugins.iptvplayer.hlsdl_download.value: downloader = HLSDownloader() else: downloader = M3U8Downloader() elif 'em3u8' == iptv_proto: if config.plugins.iptvplayer.hlsdl_download.value: downloader = EHLSDownloader() else: downloader = EM3U8Downloader() elif 'f4m' == iptv_proto: downloader = F4mDownloader() elif 'rtmp' == iptv_proto: downloader = RtmpDownloader() elif iptv_proto in ['https', 'http']: downloader = WgetDownloader() elif 'merge' == iptv_proto: if url.meta.get('prefered_merger') == 'hlsdl' and config.plugins.iptvplayer.hlsdl_download.value and config.plugins.iptvplayer.prefer_hlsdl_for_pls_with_alt_media.value: downloader = HLSDownloader() elif IsExecutable('ffmpeg'): downloader = FFMPEGDownloader() else: downloader = MergeDownloader() elif 'mpd' == iptv_proto and IsExecutable('ffmpeg'): downloader = FFMPEGDownloader() return downloader
def DownloaderCreator(url): printDBG("DownloaderCreator url[%r]" % url) downloader = None url = urlparser.decorateUrl(url) iptv_proto = url.meta.get('iptv_proto', '') if 'm3u8' == iptv_proto: if config.plugins.iptvplayer.hlsdlpath.value != '': downloader = HLSDownloader() else: downloader = M3U8Downloader() elif 'em3u8' == iptv_proto: if config.plugins.iptvplayer.hlsdlpath.value != '': downloader = EHLSDownloader() else: downloader = EM3U8Downloader() elif 'f4m' == iptv_proto: downloader = F4mDownloader() elif 'rtmp' == iptv_proto: downloader = RtmpDownloader() elif iptv_proto in ['https', 'http']: downloader = WgetDownloader() elif 'merge' == iptv_proto: if IsExecutable('ffmpeg') and config.plugins.iptvplayer.cmdwrappath.value != '': downloader = FFMPEGDownloader() else: downloader = MergeDownloader() elif 'mpd' == iptv_proto and IsExecutable('ffmpeg') and config.plugins.iptvplayer.cmdwrappath.value != '': downloader = FFMPEGDownloader() return downloader
def __init__(self): printDBG('EM3U8Downloader.__init__ ----------------------------------') HLSDownloader.__init__(self) # M3U8list link provider self.EM3U8linkProv = eConsoleAppContainer() self.EM3U8linkProv_appClosed_conn = eConnectCallback(self.EM3U8linkProv.appClosed, self._updateEM3U8Finished) #self.EM3U8linkProv_stdoutAvail_conn = eConnectCallback(self.EM3U8linkProv.stdoutAvail, self._updateEM3U8DataAvail) self.EM3U8linkProv_stderrAvail_conn = eConnectCallback(self.EM3U8linkProv.stderrAvail, self._updateEM3U8DataAvail ) self.EM3U8ListData = '' self.em3u8Started = False self.em3u8_url = '' self.em3u8_filePath = '' self.em3i8_params = {}
def DownloaderCreator(url): printDBG("DownloaderCreator url[%r]" % url) downloader = None url = urlparser.decorateUrl(url) iptv_proto = url.meta.get('iptv_proto', '') if 'm3u8' == iptv_proto: if config.plugins.iptvplayer.hlsdlpath.value != '': downloader = HLSDownloader() else: downloader = M3U8Downloader() elif 'em3u8' == iptv_proto: if config.plugins.iptvplayer.hlsdlpath.value != '': downloader = EHLSDownloader() else: downloader = EM3U8Downloader() elif 'f4m' == iptv_proto: downloader = F4mDownloader() elif 'rtmp' == iptv_proto: downloader = RtmpDownloader() elif 'https' == iptv_proto: downloader = WgetDownloader() elif 'http' == iptv_proto: downloader = WgetDownloader() elif 'merge' == iptv_proto: downloader = MergeDownloader() return downloader
def _terminate(self): printDBG("HLSDownloader._terminate") if self.EM3U8linkProv: self.EM3U8linkProv_appClosed_conn = None #self.EM3U8linkProv_stdoutAvail_conn = None self.EM3U8linkProv_stderrAvail_conn = None self.EM3U8linkProv.sendCtrlC() self.EM3U8linkProv = None return HLSDownloader._terminate(self)
def _updateEM3U8DataAvail(self, data): if None != data and 0 < len(data): self.EM3U8ListData += data if self.EM3U8ListData.endswith('\n'): printDBG(self.EM3U8ListData) data = self.EM3U8ListData.split('\n') url = '' for item in data: if item.startswith('http'): url = item.strip() if url.startswith('http'): if not self.em3u8Started: url = strwithmeta(url, self.em3u8_url.meta) HLSDownloader.start(self, url, self.em3u8_filePath, self.em3i8_params) self.em3u8Started = True else: self.m3u8Url = url self.EM3U8ListData = ''