Ejemplo n.º 1
0
 def start_backend(self, encoder_backend):
     """Starting backends"""
     if encoder_backend == 'node' and self.source_url == None:
         from mkchromecast.node import stream
         stream()
     elif encoder_backend in self.backends and self.source_url == None:
         import mkchromecast.audio
         mkchromecast.audio.main()
Ejemplo n.º 2
0
    def _play_cast_(self):
        if os.path.exists(configf):
            print(colors.warning(":::Threading::: Configuration file exists."))
            print(colors.warning(":::Threading::: Using defaults set there."))
            config.read(configf)
            backend = ConfigSectionMap("settings")["backend"]
            print(":::Threading backend::: %s." % backend)
        else:
            backend = mkchromecast.__init__.backend
        global cast
        if backend == "node":
            stream()
        else:
            try:
                reload(mkchromecast.audio)
            except NameError:
                from imp import reload

                reload(mkchromecast.audio)
            mkchromecast.audio.main()
        if platform == "Linux":
            # We create the sink only if it is not available
            if check_sink() is False and adevice is None:
                create_sink()

        start = Casting()
        start.initialize_cast()
        try:
            start.get_devices()
            start.play_cast()
            cast = start.cast
            # Let's change inputs at the end to avoid muting sound too early.
            # For Linux it does not matter given that user has to select sink
            # in pulse audio.  Therefore the sooner it is available, the
            # better.
            if platform == "Darwin":
                inputdev()
                outputdev()
            self.pcastready.emit("_play_cast_ success")
        except AttributeError:
            self.pcastready.emit("_play_cast_ failed")
        self.pcastfinished.emit()
Ejemplo n.º 3
0
    def _play_cast_(self):
        if os.path.exists(configf):
            print(colors.warning(':::Threading::: Configuration file exists.'))
            print(colors.warning(':::Threading::: Using defaults set there.'))
            config.read(configf)
            backend = ConfigSectionMap('settings')['backend']
            print(':::Threading backend::: %s.' % backend)
        else:
            backend = mkchromecast.__init__.backend
        global cast
        if backend == 'node':
            stream()
        else:
            try:
                reload(mkchromecast.audio)
            except NameError:
                from imp import reload
                reload(mkchromecast.audio)
            mkchromecast.audio.main()
        if platform == 'Linux':
            # We create the sink only if it is not available
            if check_sink() is False and adevice is None:
                create_sink()

        start = Casting()
        start.initialize_cast()
        try:
            start.get_devices()
            start.play_cast()
            cast = start.cast
            # Let's change inputs at the end to avoid muting sound too early.
            # For Linux it does not matter given that user has to select sink
            # in pulse audio.  Therefore the sooner it is available, the
            # better.
            if platform == 'Darwin':
                inputdev()
                outputdev()
            self.pcastready.emit('_play_cast_ success')
        except AttributeError:
            self.pcastready.emit('_play_cast_ failed')
        self.pcastfinished.emit()