Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

mpd: handle mpd 'commands' command

+61 -2
+44
crates/mpd/src/consts.rs
··· 313 313 mime_type: audio/x-mpd-alsa-pcm 314 314 OK 315 315 "#; 316 + 317 + pub const COMMANDS: &str = r#"command: add 318 + command: addid 319 + command: clear 320 + command: commands 321 + command: currentsong 322 + command: decoders 323 + command: delete 324 + command: deleteid 325 + command: find 326 + command: getvol 327 + command: list 328 + command: listall 329 + command: listallinfo 330 + command: listfiles 331 + command: listmounts 332 + command: lsinfo 333 + command: next 334 + command: outputs 335 + command: pause 336 + command: play 337 + command: playid 338 + command: playlistinfo 339 + command: playlistsearch 340 + command: plchanges 341 + command: previous 342 + command: random 343 + command: repeat 344 + command: rescan 345 + command: search 346 + command: seekcur 347 + command: seekid 348 + command: sendmessage 349 + command: setvol 350 + command: shuffle 351 + command: single 352 + command: stats 353 + command: status 354 + command: stop 355 + command: tagtypes 356 + command: update 357 + command: volume 358 + OK 359 + "#;
+15 -1
crates/mpd/src/handlers/system.rs
··· 4 4 net::TcpStream, 5 5 }; 6 6 7 - use crate::{consts::DECODERS, Context}; 7 + use crate::{ 8 + consts::{COMMANDS, DECODERS}, 9 + Context, 10 + }; 8 11 9 12 pub async fn handle_idle( 10 13 _ctx: &mut Context, ··· 51 54 } 52 55 Ok(DECODERS.to_string()) 53 56 } 57 + 58 + pub async fn handle_commands( 59 + ctx: &mut Context, 60 + _request: &str, 61 + stream: &mut BufReader<TcpStream>, 62 + ) -> Result<String, Error> { 63 + if !ctx.batch { 64 + stream.write_all(COMMANDS.as_bytes()).await?; 65 + } 66 + Ok(COMMANDS.to_string()) 67 + }
+2 -1
crates/mpd/src/lib.rs
··· 16 16 handle_add, handle_addid, handle_clear, handle_delete, handle_move, handle_playlistinfo, 17 17 handle_shuffle, 18 18 }, 19 - system::{handle_decoders, handle_idle, handle_noidle}, 19 + system::{handle_commands, handle_decoders, handle_idle, handle_noidle}, 20 20 }; 21 21 use kv::{build_tracks_kv, KV}; 22 22 use rockbox_graphql::{ ··· 159 159 "find artist" => handle_find_artist(&mut ctx, &request, &mut stream).await?, 160 160 "find album" => handle_find_album(&mut ctx, &request, &mut stream).await?, 161 161 "find title" => handle_find_title(&mut ctx, &request, &mut stream).await?, 162 + "commands" => handle_commands(&mut ctx, &request, &mut stream).await?, 162 163 "command_list_begin" => { 163 164 handle_command_list_begin(&mut ctx, &request, &mut stream).await? 164 165 }