コード例 #1
0
 def backend(self):
     """
     Backend
     """
     backends_supported = [
         'node', 'ffmpeg', 'avconv', 'parec', 'gstreamer'
     ]
     self.backends = []
     if platform == 'Darwin':
         for item in backends_supported:
             if (is_installed(item, PATH, debug) is True
                     and item != 'avconv' and item != 'gstreamer'):
                 self.backends.append(item)
     else:
         for item in backends_supported:
             if (is_installed(item, PATH, debug) is True
                     and item != 'node' and item != 'gstreamer'):
                 self.backends.append(item)
             # hardcoded gst-launch-1.0 for gstreamer
             elif (is_installed('gst-launch-1.0', PATH, debug) is True
                   and item == 'gstreamer'):
                 self.backends.append(item)
     backendindex = self.backends.index(self.backendconf)
     self.backend = QLabel('Select Backend', self)
     self.backend.move(20 * self.scale_factor, 24 * self.scale_factor)
     self.qcbackend = QComboBox(self)
     self.qcbackend.move(180 * self.scale_factor,
                         20 * self.scale_factor)
     self.qcbackend.setMinimumContentsLength(7)
     for item in self.backends:
         self.qcbackend.addItem(item)
     self.qcbackend.setCurrentIndex(backendindex)
     self.qcbackend.activated[str].connect(self.onActivatedbk)
コード例 #2
0
ファイル: preferences.py プロジェクト: zodmaner/mkchromecast
        def backend(self):
            """
            Backend
            """
            backends_supported = [
                "node", "ffmpeg", "avconv", "parec", "gstreamer"
            ]
            self.backends = []
            if platform == "Darwin":
                for item in backends_supported:
                    if (is_installed(item, PATH, debug) is True
                            and item != "avconv" and item != "gstreamer"):
                        self.backends.append(item)
            else:
                for item in backends_supported:
                    if (is_installed(item, PATH, debug) is True
                            and item != "node" and item != "gstreamer"):
                        self.backends.append(item)
                    # hardcoded gst-launch-1.0 for gstreamer
                    elif (is_installed("gst-launch-1.0", PATH, debug) is True
                          and item == "gstreamer"):
                        self.backends.append(item)
            try:
                backend_index = self.backends.index(self.backend_conf)
            except ValueError:
                # No backend found
                backend_index = None
                pass
            self.backend = QLabel("Select Backend", self)
            self.backend.move(20 * self.scale_factor, 24 * self.scale_factor)
            self.qcbackend = QComboBox(self)
            self.qcbackend.move(180 * self.scale_factor,
                                20 * self.scale_factor)
            self.qcbackend.setMinimumContentsLength(7)
            for item in self.backends:
                self.qcbackend.addItem(item)

            if backend_index:
                self.qcbackend.setCurrentIndex(backend_index)

            self.qcbackend.activated[str].connect(self.onActivatedbk)
コード例 #3
0
ファイル: preferences.py プロジェクト: muammar/mkchromecast
        def backend(self):
            """
            Backend
            """
            backends_supported = ['node', 'ffmpeg', 'avconv', 'parec',
                                  'gstreamer']
            self.backends = []
            if platform == 'Darwin':
                for item in backends_supported:
                    if (is_installed(item, PATH, debug) is True and
                       item != 'avconv' and item != 'gstreamer'):
                        self.backends.append(item)
            else:
                for item in backends_supported:
                    if (is_installed(item, PATH, debug) is True and
                       item != 'node' and item != 'gstreamer'):
                        self.backends.append(item)
                    # hardcoded gst-launch-1.0 for gstreamer
                    elif (is_installed('gst-launch-1.0', PATH, debug) is
                          True and item == 'gstreamer'):
                        self.backends.append(item)
            try:
                backend_index = self.backends.index(self.backend_conf)
            except ValueError:
                # No backend found
                backend_index = None
                pass
            self.backend = QLabel('Select Backend', self)
            self.backend.move(20 * self.scale_factor, 24 * self.scale_factor)
            self.qcbackend = QComboBox(self)
            self.qcbackend.move(180 * self.scale_factor,
                                20 * self.scale_factor)
            self.qcbackend.setMinimumContentsLength(7)
            for item in self.backends:
                self.qcbackend.addItem(item)

            if backend_index:
                self.qcbackend.setCurrentIndex(backend_index)

            self.qcbackend.activated[str].connect(self.onActivatedbk)
コード例 #4
0
ファイル: video.py プロジェクト: shakkhar/mkchromecast
def main():
    if encoder_backend != 'node':
        st = multi_proc()
        st.start()
    else:
        print('Starting Node')
        if platform == 'Darwin':
            PATH = './bin:./nodejs/bin:/Users/' + \
                   str(USER) + \
                   '/bin:/usr/local/bin:/usr/local/sbin:' + \
                   '/usr/bin:/bin:/usr/sbin:' + \
                   '/sbin:/opt/X11/bin:/usr/X11/bin:/usr/games:' + \
                   os.environ['PATH']
        else:
            PATH = os.environ['PATH']

        if debug is True:
            print('PATH = %s.' % PATH)

        node_names = ['node']
        nodejs_dir = ['./nodejs/']

        if platform == 'Linux':
            node_names.append('nodejs')
            nodejs_dir.append('/usr/share/mkchromecast/nodejs/')

        for name in node_names:
            if is_installed(name, PATH, debug) is True:
                for path in nodejs_dir:
                    if os.path.isdir(path):
                        path = path + 'html5-video-streamer.js'
                        webcast = [
                            name,
                            path,
                            input_file
                            ]
                        break

        if input_file == None:
            print(colors.warning('Please specify an input file with -i'))
            print(colors.warning('Closing the application...'))
            terminate()

        try:
            Popen(webcast)
        except:
            print(colors.warning('Nodejs is not installed in your system. '
                  'Please, install it to use this backend.'))
            print(colors.warning('Closing the application...'))
            terminate()
コード例 #5
0
def main():
    if encoder_backend != "node":
        st = multi_proc()
        st.start()
    else:
        print("Starting Node")
        if platform == "Darwin":
            PATH = ("./bin:./nodejs/bin:/Users/" + str(USER) +
                    "/bin:/usr/local/bin:/usr/local/sbin:" +
                    "/usr/bin:/bin:/usr/sbin:" +
                    "/sbin:/opt/X11/bin:/usr/X11/bin:/usr/games:" +
                    os.environ["PATH"])
        else:
            PATH = os.environ["PATH"]

        if debug is True:
            print("PATH = %s." % PATH)

        node_names = ["node"]
        nodejs_dir = ["./nodejs/"]

        if platform == "Linux":
            node_names.append("nodejs")
            nodejs_dir.append("/usr/share/mkchromecast/nodejs/")

        for name in node_names:
            if is_installed(name, PATH, debug) is True:
                for path in nodejs_dir:
                    if os.path.isdir(path):
                        path = path + "html5-video-streamer.js"
                        webcast = [name, path, input_file]
                        break

        if input_file == None:
            print(colors.warning("Please specify an input file with -i"))
            print(colors.warning("Closing the application..."))
            terminate()

        try:
            Popen(webcast)
        except:
            print(
                colors.warning("Nodejs is not installed in your system. "
                               "Please, install it to use this backend."))
            print(colors.warning("Closing the application..."))
            terminate()
コード例 #6
0
ファイル: video.py プロジェクト: xmbwd/mkchromecast
def main():
    if encoder_backend != 'node':
        st = multi_proc()
        st.start()
    else:
        print('Starting Node')
        if platform == 'Darwin':
            PATH = './bin:./nodejs/bin:/Users/' + str(
                USER
            ) + '/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/X11/bin:/usr/games:' + os.environ[
                'PATH']
        else:
            PATH = os.environ['PATH']

        if debug == True:
            print('PATH =' + str(PATH))

        if platform == 'Darwin' and os.path.exists('./bin/node') == True:
            webcast = [
                './bin/node', './nodejs/html5-video-streamer.js', input_file
            ]
        elif platform == 'Linux':
            node_names = ['node', 'nodejs']
            nodejs_dir = ['./nodejs/', '/usr/share/mkchromecast/nodejs/']
            for name in node_names:
                if is_installed(name, PATH, debug) == True:
                    for path in nodejs_dir:
                        if os.path.isdir(path):
                            path = path + 'html5-video-streamer.js'
                            webcast = [name, path, input_file]
                            break
        try:
            p = subprocess.Popen(webcast)
        except:
            print(
                colors.warning(
                    'Nodejs is not installed in your system. Please, install it to use this backend.'
                ))
            print(colors.warning('Closing the application...'))
            terminate()