def do_function(self): songs = self.controller.media_library.list_songs() for song in songs: if song.description is not None and song.description != "": print_msg(" %s: %s || %s" % (song.alias, song.uri, song.description)) else: print_msg(" %s: %s" % (song.alias, song.uri))
async def run_server(self): v1 = v1_server.MediaServer(self.controller, self.ml) muxer = websocket_muxer.WebsocketMuxer() muxer.register(v1_c_types.SERVING_ADDRESS, v1) await websockets.serve(muxer.handle_session, "localhost", v1_c_types.DEFAULT_PORT) print_msg("Server running @ ws://localhost:%s..." % v1_c_types.DEFAULT_PORT)
def start_local_cli(self): # "Normal" commands, which only need the controller. commands_dict = {} for class_defn in [ commands.ListAudioDevices, commands.GetDevice, commands.SetDevice, commands.AddSong, commands.ListSongs, commands.ListPlaylists, commands.PlaySong, commands.Queue, commands.Play, commands.Pause, commands.Stop, commands.CreatePlaylist, commands.AddSongToPlaylist, commands.SaveLibrary, commands.LoadLibrary, commands.DescribeSong, ]: c = class_defn(self.controller) commands_dict[c.name] = c # Special commands. commands_dict["help"] = common.commands.Help(commands_dict) commands_dict["commands"] = common.commands.ListCommands(commands_dict) for console_input in self.console_output.commands(): if console_input.command in commands_dict: try: commands_dict[console_input.command].process( console_input.arguments) except UserException as e: print(e.user_error_message) except Exception: traceback.print_exc() time.sleep(1) else: print_msg("Command not found: '%s' - discarding args '%s'" % (console_input.command, console_input.arguments)) if self.console_output.terminate: break self.console.write("Exiting now...")
def do_function(self, command=""): if command is None: print_msg(self.help_string()) return if command not in self.command_dict: print_msg("Cannot find command '%s'.\n\nAvailable commands: '%s'" % (command, self.command_dict.keys())) return print_msg(self.command_dict[command].help_string()) return
def error(self, message): print_msg(message)
def do_function(self): print_msg(self.controller.get_device())
def do_function(self): print_msg("Devices: %s" % (self.controller.list_devices()))
def do_function(self): playlists = self.controller.media_library.list_playlists() for playlist in playlists: print_msg(" %s: %s" % (playlist[0], playlist[1]))
def do_function(self): print_msg("Available commands: [\n %s\n]" % ("\n ".join(", ".join(g) for g in group_by(self.command_dict, 5))))