Ejemplo n.º 1
0
    def __init__(self):
        super().__init__()
        signal.signal(signal.SIGUSR1, self.handler)
        signal.signal(signal.SIGINT, self.termination_handler)
        self.remote_msg = dict()
        self.remotes_termination = threading.Event()
        self.remote_event = threading.Event(
        )  # Event for signaling control thread(s) events to main thread
        self.reply_event = threading.Event()
        self.control_pipe = ControlPipe(self.remote_event, self.remote_msg)
        self.bt_remote = BtRemote(self.remote_event, self.remote_msg)

        # TODO: maybe refractor into player_methods and always eval()?
        self.media_control_methods = [
            f for f in dir(MediaControl)
            if not f.startswith('_') and callable(getattr(MediaControl, f))
        ]
        self.media_info_methods = [
            f for f in dir(MediaInfo)
            if not f.startswith('_') and callable(getattr(MediaInfo, f))
        ]
        self.player = StoragePlayer()
        self.encoder = Encoder()

        if config.get_settings()["PIRATERADIO"]["output"] == "fm":
            self.output = FmOutput()
        else:
            self.output = AnalogOutput()
Ejemplo n.º 2
0
    def __init__(self):
        signal.signal(signal.SIGUSR1, self.handler)
        signal.signal(signal.SIGINT, self.termination_handler)
        self.remote_msg = dict()
        self.check_remotes_termination = threading.Event()
        self.remote_event = threading.Event(
        )  # Event for signaling control thread(s) events to main thread
        self.control_pipe = ControlPipe(self.remote_event, self.remote_msg)
        # Bluetooth setup (only if a2dp is supported)
        # if which("bluealsa") is not None:
        #     self.bt_daemon = BluetoothDaemon()

        # TODO: maybe refractor into player_methods end always eval()?
        self.media_control_methods = [
            f for f in dir(MediaControl)
            if not f.startswith('_') and callable(getattr(MediaControl, f))
        ]
        self.media_info_methods = [
            f for f in dir(MediaInfo)
            if not f.startswith('_') and callable(getattr(MediaInfo, f))
        ]
        self.player = StoragePlayer()
        self.encoder = Encoder()

        if config.get_settings()["PIRATERADIO"]["output"] == "fm":
            self.output = FmOutput()
        else:
            self.output = AnalogOutput()