コード例 #1
0
ファイル: iptvsetupimpl.py プロジェクト: trunca/video
    def subparserStep(self, ret=None):
        printDBG("IPTVSetupImpl.subparserStep")

        def _detectCmdBuilder(path):
            cmd = GetPyScriptCmd(
                'subparserversion') + ' "%s" ' % resolveFilename(
                    SCOPE_PLUGINS, 'Extensions/IPTVPlayer/libs/')
            return cmd

        def _detectValidator(code, data):
            if 0 == code:
                try:
                    if float(data.strip()) >= self.subparserVersion:
                        return True, False
                except Exception:
                    pass
            return False, True

        def _deprecatedHandler(paths, stsTab, dataTab):
            try:
                ver = float(dataTab[0].strip())
                return True, self.subparserPaths[0]
            except Exception:
                pass
            return False, ""

        def _downloadCmdBuilder(binName, platform, openSSLVersion, server,
                                tmpPath):
            url = server + 'bin/' + platform + ('/%s' % binName)
            if 'mipsel' == self.platform and IsFPUAvailable():
                url += '.fpu'
            tmpFile = tmpPath + binName
            cmd = SetupDownloaderCmdCreator(url, tmpFile) + ' > /dev/null 2>&1'
            return cmd

        self.stepHelper = CBinaryStepHelper("_subparser.so", self.platform,
                                            self.openSSLVersion, None)
        msg1 = _("C subtitle parser")
        msg2 = _("\nFor more info please ask the author [email protected]")
        msg3 = _('It improves subtitles parsing.\n')
        self.stepHelper.updateMessage('detection', msg1, 0)
        self.stepHelper.updateMessage('detection', msg2, 1)
        self.stepHelper.updateMessage(
            'not_detected_2',
            msg1 + _(' has not been detected. \nDo you want to install it? ') +
            msg3 + msg2, 1)
        self.stepHelper.updateMessage(
            'deprecated_2',
            msg1 + _(' is deprecated. \nDo you want to install new one? ') +
            msg3 + msg2, 1)

        self.stepHelper.setInstallChoiseList([('_subparser.so',
                                               self.subparserPaths[0])])
        self.stepHelper.setPaths(self.subparserPaths)
        self.stepHelper.setDetectCmdBuilder(_detectCmdBuilder)
        self.stepHelper.setDetectValidator(_detectValidator)
        self.stepHelper.setDownloadCmdBuilder(_downloadCmdBuilder)
        self.stepHelper.setDeprecatedHandler(_deprecatedHandler)
        self.stepHelper.setFinishHandler(self.subparserStepFinished)
        self.binaryDetect()
コード例 #2
0
ファイル: iptvsetupimpl.py プロジェクト: trunca/video
    def uchardetStep(self, ret=None):
        printDBG("IPTVSetupImpl.uchardetStep")
        self.binaryInstalledSuccessfully = False

        def _detectValidator(code, data):
            if self.binaryInstalledSuccessfully:
                self.stepHelper.setInstallChoiseList(
                    self._uchardetInstallChoiseList2)
            else:
                self.stepHelper.setInstallChoiseList(
                    self._uchardetInstallChoiseList)
            try:
                rawVer = re.search("Version\s([0-9])\.([0-9])\.([0-9])", data)
                UCHARDET_VERSION_MAJOR = int(rawVer.group(1))
                UCHARDET_VERSION_MINOR = int(rawVer.group(2))
                UCHARDET_VERSION_REVISION = int(rawVer.group(3))
                if (UCHARDET_VERSION_MAJOR > self.uchardetVersion[0]) or \
                   (UCHARDET_VERSION_MAJOR == self.uchardetVersion[0] and UCHARDET_VERSION_MINOR > self.uchardetVersion[1]) or \
                   (UCHARDET_VERSION_MAJOR == self.uchardetVersion[0] and UCHARDET_VERSION_MINOR == self.uchardetVersion[1] and UCHARDET_VERSION_REVISION >= self.uchardetVersion[2]):
                    return True, False
            except Exception:
                printExc()
            return False, True

        def _deprecatedHandler(paths, stsTab, dataTab):
            sts, retPath = False, ""
            for idx in range(len(dataTab)):
                if 'Author: BYVoid' in dataTab[idx]:
                    sts, retPath = True, paths[idx]
            return sts, retPath

        def _downloadCmdBuilder(binName, platform, openSSLVersion, server,
                                tmpPath):
            if self.binaryInstalledSuccessfully:
                url = server + 'bin/' + platform + (
                    '/%s' % binName) + '_static_libstdc++'
                self.binaryInstalledSuccessfully = False
            else:
                url = server + 'bin/' + platform + ('/%s' % binName)

            tmpFile = tmpPath + binName
            cmd = SetupDownloaderCmdCreator(url, tmpFile) + ' > /dev/null 2>&1'
            return cmd

        self.stepHelper = CBinaryStepHelper(
            "uchardet", self.platform, self.openSSLVersion,
            config.plugins.iptvplayer.uchardetpath)
        self.stepHelper.updateMessage(
            'detection',
            _('The "%s" utility is used by the IPTVPlayer to determine the encoding of the text.'
              ) % 'uchardet', 1)
        self.stepHelper.setInstallChoiseList(self._uchardetInstallChoiseList)
        self.stepHelper.setPaths(self.uchardetpaths)
        self.stepHelper.setDetectCmdBuilder(
            lambda path: path + " --version 2>&1 ")
        self.stepHelper.setDetectValidator(_detectValidator)
        self.stepHelper.setDownloadCmdBuilder(_downloadCmdBuilder)
        self.stepHelper.setDeprecatedHandler(_deprecatedHandler)
        self.stepHelper.setFinishHandler(self.uchardetStepFinished)
        self.binaryDetect()
コード例 #3
0
ファイル: iptvsetupimpl.py プロジェクト: trunca/video
    def wgetStep(self, ret=None):
        printDBG("IPTVSetupImpl.wgetStep")

        def _detectValidator(code, data):
            if 'BusyBox' not in data and '+https' in data:
                try:
                    ver = int(
                        re.search("GNU Wget 1\.([0-9]+?)[^0-9]",
                                  data).group(1))
                except Exception:
                    ver = 0
                if ver >= self.wgetVersion: return True, False
            return False, True

        def _deprecatedHandler(paths, stsTab, dataTab):
            sts, retPath = False, ""
            for idx in range(len(dataTab)):
                if 'BusyBox' not in dataTab[idx] and '+https' in dataTab[idx]:
                    sts, retPath = True, paths[idx]
            return sts, retPath

        self.stepHelper = CBinaryStepHelper("wget", self.platform,
                                            self.openSSLVersion,
                                            config.plugins.iptvplayer.wgetpath)
        self.stepHelper.updateMessage('detection', (_(
            'The "%s" utility is used by the IPTVPlayer to buffering and downloading [%s] links.'
        ) % ('wget', 'http, https, f4m, uds, hls')), 1)
        self.stepHelper.setInstallChoiseList(self._wgetInstallChoiseList)
        self.stepHelper.setPaths(self.wgetpaths)
        self.stepHelper.setDetectCmdBuilder(lambda path: path + " -V 2>&1 ")
        self.stepHelper.setDetectValidator(_detectValidator)
        self.stepHelper.setDeprecatedHandler(_deprecatedHandler)
        self.stepHelper.setFinishHandler(self.wgetStepFinished)
        self.binaryDetect()
コード例 #4
0
ファイル: iptvsetupimpl.py プロジェクト: trunca/video
    def f4mdumpStep(self, ret=None):
        printDBG("IPTVSetupImpl.f4mdumpStep")
        self.binaryInstalledSuccessfully = False

        def _detectValidator(code, data):
            if self.binaryInstalledSuccessfully:
                self.stepHelper.setInstallChoiseList(
                    self._f4mdumpInstallChoiseList2)
            else:
                self.stepHelper.setInstallChoiseList(
                    self._f4mdumpInstallChoiseList)
            if 'F4MDump v' in data:
                try:
                    tmp = re.search("F4MDump v([0-9.]+?)[^0-9^.]",
                                    data).group(1)
                    if float(tmp) >= self.f4mdumpVersion:
                        return True, False
                except Exception:
                    printExc()
            return False, True

        def _deprecatedHandler(paths, stsTab, dataTab):
            sts, retPath = False, ""
            for idx in range(len(dataTab)):
                if 'F4MDump v' in dataTab[idx]: sts, retPath = True, paths[idx]
            return sts, retPath

        def _downloadCmdBuilder(binName, platform, openSSLVersion, server,
                                tmpPath):
            if self.binaryInstalledSuccessfully:
                url = server + 'bin/' + platform + (
                    '/%s_openssl' %
                    binName) + openSSLVersion + '_static_libstdc++'
                self.binaryInstalledSuccessfully = False
            else:
                url = server + 'bin/' + platform + ('/%s_openssl' %
                                                    binName) + openSSLVersion

            tmpFile = tmpPath + binName
            cmd = SetupDownloaderCmdCreator(url, tmpFile) + ' > /dev/null 2>&1'
            return cmd

        self.stepHelper = CBinaryStepHelper(
            "f4mdump", self.platform, self.openSSLVersion,
            config.plugins.iptvplayer.f4mdumppath)
        self.stepHelper.updateMessage('detection', (_(
            'The "%s" utility is used by the IPTVPlayer to buffering and downloading [%s] links.'
        ) % ('f4mdump', 'f4m, uds')), 1)
        self.stepHelper.setInstallChoiseList(self._f4mdumpInstallChoiseList)
        self.stepHelper.setPaths(self.f4mdumppaths)
        self.stepHelper.setDetectCmdBuilder(lambda path: path + " 2>&1 ")
        self.stepHelper.setDetectValidator(_detectValidator)
        self.stepHelper.setDownloadCmdBuilder(_downloadCmdBuilder)
        self.stepHelper.setDeprecatedHandler(_deprecatedHandler)
        self.stepHelper.setFinishHandler(self.f4mdumpStepFinished)
        self.binaryDetect()
コード例 #5
0
ファイル: iptvsetupimpl.py プロジェクト: trunca/video
    def gstplayerStep(self, ret=None):
        printDBG("IPTVSetupImpl.gstplayerStep")
        if self.gstreamerVersion == "0.10" and self.platform in ['armv5t']:
            printDBG(
                'Skip gstplayer 0.10 step installation - no binary for armv5t platform'
            )
            self.gstplayerStepFinished(False)
        else:

            def _detectValidator(code, data):
                if '{"GSTPLAYER_EXTENDED":{"version":' in data:
                    try:
                        ver = int(
                            re.search('"version":([0-9]+?)[^0-9]',
                                      data).group(1))
                    except Exception:
                        ver = 0
                    if '0.10' != self.gstreamerVersion or ver < 10000:
                        if ver >= self.gstplayerVersion.get(
                                self.gstreamerVersion, 0):
                            return True, False
                return False, True

            def _deprecatedHandler(paths, stsTab, dataTab):
                sts, retPath = False, ""
                for idx in range(len(dataTab)):
                    if '{"GSTPLAYER_EXTENDED":{"version":' in dataTab[idx]:
                        sts, retPath = True, paths[idx]
                return sts, retPath

            def _downloadCmdBuilder(binName, platform, openSSLVersion, server,
                                    tmpPath):
                url = server + 'bin/' + platform + (
                    '/%s_gstreamer' % binName) + self.gstreamerVersion
                tmpFile = tmpPath + binName
                cmd = SetupDownloaderCmdCreator(url,
                                                tmpFile) + ' > /dev/null 2>&1'
                return cmd

            self.stepHelper = CBinaryStepHelper(
                "gstplayer", self.platform, self.openSSLVersion,
                config.plugins.iptvplayer.gstplayerpath)
            self.stepHelper.updateMessage(
                'detection',
                _('The "%s" utility is used by the IPTVPlayer as external movie player.'
                  ) % ('gstplayer'), 1)
            self.stepHelper.setInstallChoiseList(
                self._gstplayerInstallChoiseList)
            self.stepHelper.setPaths(self.gstplayerpaths)
            self.stepHelper.setDetectCmdBuilder(lambda path: path + " 2>&1 ")
            self.stepHelper.setDetectValidator(_detectValidator)
            self.stepHelper.setDownloadCmdBuilder(_downloadCmdBuilder)
            self.stepHelper.setDeprecatedHandler(_deprecatedHandler)
            self.stepHelper.setFinishHandler(self.gstplayerStepFinished)
            self.binaryDetect()
コード例 #6
0
ファイル: iptvsetupimpl.py プロジェクト: trunca/video
    def flumpegdemuxStep(self, ret=None):
        printDBG("IPTVSetupImpl.flumpegdemuxStep")

        def _detectValidator(code, data):
            # some grep return code 1 even if the pattern has been found  and printed
            if 0 == code or self.flumpegdemuxVersion in data:
                return True, False
            return False, True

        def _deprecatedHandler(paths, stsTab, dataTab):
            sts, retPath = False, ""
            try:
                currentSize = os_path.getsize(self.flumpegdemuxpaths[0])
            except Exception:
                currentSize = -1
            if -1 < currentSize: sts, retPath = True, paths[0]
            return sts, retPath

        def _downloadCmdBuilder(binName, platform, openSSLVersion, server,
                                tmpPath):
            url = server + 'bin/' + platform + ('/%s_gstreamer' %
                                                binName) + "0.10"
            tmpFile = tmpPath + binName
            cmd = SetupDownloaderCmdCreator(url, tmpFile) + ' > /dev/null 2>&1'
            return cmd

        self.stepHelper = CBinaryStepHelper("libgstflumpegdemux.so",
                                            self.platform, self.openSSLVersion,
                                            None)
        msg1 = _("Fluendo mpegdemux for GSTREAMER 0.10")
        msg2 = _("\nFor more info please visit http://fluendo.com/")
        msg3 = _('It improves playing of streams hls/m3u8.\n')
        self.stepHelper.updateMessage('detection', msg1, 0)
        self.stepHelper.updateMessage('detection', msg2, 1)
        self.stepHelper.updateMessage(
            'not_detected_2',
            msg1 + _(' has not been detected. \nDo you want to install it? ') +
            msg3 + msg2, 1)
        self.stepHelper.updateMessage(
            'deprecated_2',
            msg1 + _(' is deprecated. \nDo you want to install new one? ') +
            msg3 + msg2, 1)

        self.stepHelper.setInstallChoiseList([('gst-fluendo-mpegdemux',
                                               self.flumpegdemuxpaths[0])])
        self.stepHelper.setPaths(self.flumpegdemuxpaths)
        self.stepHelper.setDetectCmdBuilder(lambda path: (
            'grep "%s" "%s" 2>&1 ' % (self.flumpegdemuxVersion, path)))
        self.stepHelper.setDetectValidator(_detectValidator)
        self.stepHelper.setDownloadCmdBuilder(_downloadCmdBuilder)
        self.stepHelper.setDeprecatedHandler(_deprecatedHandler)
        self.stepHelper.setFinishHandler(self.flumpegdemuxStepFinished)
        self.binaryDetect()
コード例 #7
0
    def gstifdsrcStep(self, ret=None):
        printDBG("IPTVSetupImpl.gstifdsrcStep")

        def _detectValidator(code, data):
            # some grep return code 1 even if the pattern has been found  and printed
            if 0 == code or self.gstifdsrcVersion in data: return True, False
            return False, True

        def _deprecatedHandler(paths, stsTab, dataTab):
            sts, retPath = False, ""
            try:
                currentSize = os_path.getsize(self.gstifdsrcPaths[0])
            except:
                currentSize = -1
            if -1 < currentSize: sts, retPath = True, paths[0]
            return sts, retPath

        def _downloadCmdBuilder(binName, platform, openSSLVersion, server,
                                tmpPath):
            url = server + 'bin/' + platform + ('/%s_gstreamer' %
                                                binName) + "1.0"
            tmpFile = tmpPath + binName
            cmd = SetupDownloaderCmdCreator(url, tmpFile) + ' > /dev/null 2>&1'
            return cmd

        self.stepHelper = CBinaryStepHelper("libgstifdsrc.so", self.platform,
                                            self.openSSLVersion, None)
        msg1 = _("GST-IFDSRC for GSTREAMER 1.X")
        msg2 = _("\nFor more info please ask the author [email protected]")
        msg3 = _('It improves buffering mode with the gstplayer.\n')
        self.stepHelper.updateMessage('detection', msg1, 0)
        self.stepHelper.updateMessage('detection', msg2, 1)
        self.stepHelper.updateMessage(
            'not_detected_2',
            msg1 + _(' has not been detected. \nDo you want to install it? ') +
            msg3 + msg2, 1)
        self.stepHelper.updateMessage(
            'deprecated_2',
            msg1 + _(' is deprecated. \nDo you want to install new one? ') +
            msg3 + msg2, 1)

        self.stepHelper.setInstallChoiseList([('gst-ifdsrc',
                                               self.gstifdsrcPaths[0])])
        self.stepHelper.setPaths(self.gstifdsrcPaths)
        self.stepHelper.setDetectCmdBuilder(lambda path: (
            'grep "%s" "%s" 2>&1 ' % (self.gstifdsrcVersion, path)))
        self.stepHelper.setDetectValidator(_detectValidator)
        self.stepHelper.setDownloadCmdBuilder(_downloadCmdBuilder)
        self.stepHelper.setDeprecatedHandler(_deprecatedHandler)
        self.stepHelper.setFinishHandler(self.gstifdsrcStepFinished)
        self.binaryDetect()
コード例 #8
0
    def uchardetStep(self, ret=None):
        printDBG("IPTVSetupImpl.uchardetStep")
        self.binaryInstalledSuccessfully = False

        def _detectValidator(code, data):
            if self.binaryInstalledSuccessfully:
                self.stepHelper.setInstallChoiseList(
                    self._uchardetInstallChoiseList2)
            else:
                self.stepHelper.setInstallChoiseList(
                    self._uchardetInstallChoiseList)
            if self.uchardetVersion in data: return True, False
            else: return False, True

        def _deprecatedHandler(paths, stsTab, dataTab):
            sts, retPath = False, ""
            for idx in range(len(dataTab)):
                if 'Author: BYVoid' in dataTab[idx]:
                    sts, retPath = True, paths[idx]
            return sts, retPath

        def _downloadCmdBuilder(binName, platform, openSSLVersion, server,
                                tmpPath):
            if self.binaryInstalledSuccessfully:
                url = server + 'bin/' + platform + (
                    '/%s' % binName) + '_static_libstdc++'
                self.binaryInstalledSuccessfully = False
            else:
                url = server + 'bin/' + platform + ('/%s' % binName)

            tmpFile = tmpPath + binName
            cmd = SetupDownloaderCmdCreator(url, tmpFile) + ' > /dev/null 2>&1'
            return cmd

        self.stepHelper = CBinaryStepHelper(
            "uchardet", self.platform, self.openSSLVersion,
            config.plugins.iptvplayer.uchardetpath)
        self.stepHelper.updateMessage(
            'detection',
            _('The "%s" utility is used by the IPTVPlayer to determine the encoding of the text.'
              % ('uchardet')), 1)
        self.stepHelper.setInstallChoiseList(self._uchardetInstallChoiseList)
        self.stepHelper.setPaths(self.uchardetpaths)
        self.stepHelper.setDetectCmdBuilder(
            lambda path: path + " --version 2>&1 ")
        self.stepHelper.setDetectValidator(_detectValidator)
        self.stepHelper.setDownloadCmdBuilder(_downloadCmdBuilder)
        self.stepHelper.setDeprecatedHandler(_deprecatedHandler)
        self.stepHelper.setFinishHandler(self.uchardetStepFinished)
        self.binaryDetect()
コード例 #9
0
ファイル: iptvsetupimpl.py プロジェクト: trunca/video
    def exteplayer3Step(self, ret=None):
        printDBG("IPTVSetupImpl.exteplayer3Step")

        def _detectValidator(code, data):
            if '{"EPLAYER3_EXTENDED":{"version":' in data:
                try:
                    ver = int(
                        re.search('"version":([0-9]+?)[^0-9]', data).group(1))
                except Exception:
                    ver = 0
                if ver >= self.exteplayer3Version.get(self.platform, 0):
                    return True, False
            return False, True

        def _deprecatedHandler(paths, stsTab, dataTab):
            sts, retPath = False, ""
            for idx in range(len(dataTab)):
                if '{"EPLAYER3_EXTENDED":{"version":' in dataTab[idx]:
                    sts, retPath = True, paths[idx]
            return sts, retPath

        def _downloadCmdBuilder(ffmpegVersion, binName, platform,
                                openSSLVersion, server, tmpPath):
            url = server + 'bin/' + platform + ('/%s_ffmpeg' %
                                                binName) + ffmpegVersion
            tmpFile = tmpPath + binName
            cmd = SetupDownloaderCmdCreator(url, tmpFile) + ' > /dev/null 2>&1'
            return cmd

        self.stepHelper = CBinaryStepHelper(
            "exteplayer3", self.platform, self.openSSLVersion,
            config.plugins.iptvplayer.exteplayer3path)
        self.stepHelper.updateMessage(
            'detection',
            _('The "%s" utility is used by the IPTVPlayer as external movie player based on the ffmpeg and libeplayer.'
              ) % ('exteplayer3'), 1)
        self.stepHelper.setInstallChoiseList(
            self._exteplayer3InstallChoiseList)
        self.stepHelper.setPaths(self.exteplayer3paths)
        self.stepHelper.setDetectCmdBuilder(lambda path: path + " 2>&1 ")
        self.stepHelper.setDetectValidator(_detectValidator)
        self.stepHelper.setDownloadCmdBuilder(
            boundFunction(_downloadCmdBuilder, self.ffmpegVersion))
        self.stepHelper.setDeprecatedHandler(_deprecatedHandler)
        self.stepHelper.setFinishHandler(self.exteplayer3StepFinished)
        self.binaryDetect()
コード例 #10
0
ファイル: iptvsetupimpl.py プロジェクト: trunca/video
    def rtmpdumpStep(self, ret=None):
        printDBG("IPTVSetupImpl.rtmpdumpStep")

        def _detectValidator(code, data):
            if self.rtmpdumpVersion.get(
                    self.platform, self.rtmpdumpVersion['default']) in data:
                return True, False
            else:
                return False, True

        def _deprecatedHandler(paths, stsTab, dataTab):
            sts, retPath = False, ""
            for idx in range(len(dataTab)):
                if 'RTMPDump v2.4' in dataTab[idx]:
                    sts, retPath = True, paths[idx]
            return sts, retPath

        def _downloadCmdBuilder(binName, platform, openSSLVersion, server,
                                tmpPath):
            url = server + ('rtmpdump_%s_libssl.so%s.tar.gz' %
                            (platform, openSSLVersion))
            tmpFile = tmpPath + 'rtmpdump.tar.gz'
            cmd = SetupDownloaderCmdCreator(url, tmpFile) + ' > /dev/null 2>&1'
            return cmd

        def _installCmdBuilder(binName, binaryInstallPath, tmpPath):
            sourceArchive = tmpPath + 'rtmpdump.tar.gz'
            cmd = 'tar -xzf "%s" -C / 2>&1' % sourceArchive
            return cmd

        self.stepHelper = CBinaryStepHelper(
            "rtmpdump", self.platform, self.openSSLVersion,
            config.plugins.iptvplayer.rtmpdumppath)
        self.stepHelper.updateMessage('detection', (_(
            'The "%s" utility is used by the IPTVPlayer to buffering and downloading [%s] links.'
        ) % ('rtmpdump', 'rtmp, rtmpt, rtmpe, rtmpte, rtmps')), 1)
        self.stepHelper.setInstallChoiseList([('rtmpdump', '/usr/bin/rtmpdump')
                                              ])
        self.stepHelper.setPaths(self.rtmpdumppaths)
        self.stepHelper.setDetectCmdBuilder(lambda path: path + " -V 2>&1 ")
        self.stepHelper.setDetectValidator(_detectValidator)
        self.stepHelper.setDeprecatedHandler(_deprecatedHandler)
        self.stepHelper.setDownloadCmdBuilder(_downloadCmdBuilder)
        self.stepHelper.setInstallCmdBuilder(_installCmdBuilder)
        self.stepHelper.setFinishHandler(self.rtmpdumpStepFinished)
        self.binaryDetect()