def __init__(self, mpv_path, streamer_fifo_path, mpv_cmds_fifo_path, server_ip, mpd_port, http_port): self.streamer_fifo_path = streamer_fifo_path self.mpv_cmds_fifo_path = mpv_cmds_fifo_path # the command that Popen will call in a new process (the media player, # controlled by writing commands to mpv_cmds_fifo_path, a handy feature # of mpv) self.playercmd = [mpv_path, "--input-file=" + mpv_cmds_fifo_path, streamer_fifo_path] # create mpd client, connect it to the server self.remote = mpd_client.mpd_client(server_ip, mpd_port, REMOTE_DEBUGLEVEL) self.remote.connect_to_server() # get the status of the server self.remote.retrieve_status() # create player self.player = player.player(self.playercmd, mpv_cmds_fifo_path, PLAYER_DEBUGLEVEL) # create http client self.streamer = http_client.http_client(server_ip, http_port, streamer_fifo_path, STREAMER_BUFFER_SIZE, STREAMER_DEBUGLEVEL) # if the mpd server is playing, initialize the http client's connetion state = self.remote.status.state if state == "play": self.player.play() self.streamer.play() # check if the streamer successfully connected if not self.streamer.connected: self.print_debug("Error: could not connect to HTTP server!", 1) self.quit() self.message = None
# prog = irexec # button = KEY_MUTE # config = echo "KEY_MUTE" > /tmp/irpipe # repeat = 0 # end # If you want to use remote, put to True, otherwise put to False # WARNING: Don't enable it if you don't have working LIRC!!! REMOTE_ENABLE = True # Specify pipeline name (in upper example this is "/tmp/irpipe" IR_PIPELINE = '/tmp/irpipe' ##################################################################### # Initialize MPD client mpdcl = mpd_client.mpd_client(CON_ID, PASSWORD) # Start it mpdcl.start() # If enabled, nitialize display instance if LCD_ENABLE: # I2C display is chosen if (DISPLAY_TYPE == 0): display = i2c_display.i2c_display(I2C_DISPLAY_ADDRESS, LCD_ROWS, LCD_COLUMNS, TEMPORARY_SCREEN_PERIOD, SCROLLING_PERIOD) # Let MPD and display know for each other display.register(mpdcl) mpdcl.register(display) # Start display thread
# prog = irexec # button = KEY_MUTE # config = echo "KEY_MUTE" > /tmp/irpipe # repeat = 0 # end # If you want to use remote, put to True, otherwise put to False # WARNING: Don't enable it if you don't have working LIRC!!! REMOTE_ENABLE = True # Specify pipeline name (in upper example this is "/tmp/irpipe" IR_PIPELINE = '/tmp/irpipe' ##################################################################### # Initialize MPD client mpdcl = mpd_client.mpd_client(CON_ID, PASSWORD) # Start it mpdcl.start() # If enabled, nitialize display instance if LCD_ENABLE: # I2C display is chosen if (DISPLAY_TYPE == 0): display = i2c_display.i2c_display(I2C_DISPLAY_ADDRESS, LCD_ROWS, LCD_COLUMNS, TEMPORARY_SCREEN_PERIOD, SCROLLING_PERIOD) # Let MPD and display know for each other display.register(mpdcl) mpdcl.register(display)