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.

Merge pull request #62 from tsirysndr/feat/mpd-outputs

mpd: handle mpd outputs command

authored by

Tsiry Sandratraina and committed by
GitHub
3bd2bbbc 13e3b25a

+23 -6
+5 -3
crates/mpd/src/handlers/batch.rs
··· 13 13 handle_tagtypes_enable, 14 14 }, 15 15 playback::{ 16 - handle_currentsong, handle_getvol, handle_next, handle_pause, handle_play, handle_playid, 17 - handle_previous, handle_random, handle_repeat, handle_seek, handle_seekcur, handle_seekid, 18 - handle_setvol, handle_single, handle_status, handle_toggle, 16 + handle_currentsong, handle_getvol, handle_next, handle_outputs, handle_pause, handle_play, 17 + handle_playid, handle_previous, handle_random, handle_repeat, handle_seek, handle_seekcur, 18 + handle_seekid, handle_setvol, handle_single, handle_status, handle_toggle, 19 19 }, 20 20 queue::{ 21 21 handle_add, handle_clear, handle_delete, handle_move, handle_playlistinfo, handle_shuffle, ··· 73 73 "tagtypes enable" => handle_tagtypes_enable(&mut ctx, &request, stream).await?, 74 74 "stats" => handle_stats(&mut ctx, &request, stream).await?, 75 75 "plchanges" => handle_playlistinfo(&mut ctx, &request, stream).await?, 76 + "outputs" => handle_outputs(&mut ctx, &request, stream).await?, 76 77 _ => { 77 78 println!("Unhandled command: {}", request); 78 79 if !ctx.batch { ··· 143 144 "tagtypes enable" => handle_tagtypes_enable(&mut ctx, &request, stream).await?, 144 145 "stats" => handle_stats(&mut ctx, &request, stream).await?, 145 146 "plchanges" => handle_playlistinfo(&mut ctx, &request, stream).await?, 147 + "outputs" => handle_outputs(&mut ctx, &request, stream).await?, 146 148 _ => { 147 149 println!("Unhandled command: {}", request); 148 150 if !ctx.batch {
+14
crates/mpd/src/handlers/playback.rs
··· 424 424 } 425 425 Ok(response) 426 426 } 427 + 428 + pub async fn handle_outputs( 429 + ctx: &mut Context, 430 + _request: &str, 431 + stream: &mut BufReader<TcpStream>, 432 + ) -> Result<String, Error> { 433 + let response = 434 + "outputid: 0\noutputname: default detected output\nplugin: pulse\noutputenabled: 1\nOK\n" 435 + .to_string(); 436 + if !ctx.batch { 437 + stream.write_all(response.as_bytes()).await?; 438 + } 439 + Ok(response) 440 + }
+4 -3
crates/mpd/src/lib.rs
··· 8 8 handle_search, handle_stats, handle_tagtypes, handle_tagtypes_enable, 9 9 }, 10 10 playback::{ 11 - handle_currentsong, handle_getvol, handle_next, handle_pause, handle_play, handle_playid, 12 - handle_previous, handle_random, handle_repeat, handle_seek, handle_seekcur, handle_seekid, 13 - handle_setvol, handle_single, handle_status, handle_toggle, 11 + handle_currentsong, handle_getvol, handle_next, handle_outputs, handle_pause, handle_play, 12 + handle_playid, handle_previous, handle_random, handle_repeat, handle_seek, handle_seekcur, 13 + handle_seekid, handle_setvol, handle_single, handle_status, handle_toggle, 14 14 }, 15 15 queue::{ 16 16 handle_add, handle_clear, handle_delete, handle_move, handle_playlistinfo, handle_shuffle, ··· 117 117 "tagtypes enable" => handle_tagtypes_enable(&mut ctx, &request, &mut stream).await?, 118 118 "stats" => handle_stats(&mut ctx, &request, &mut stream).await?, 119 119 "plchanges" => handle_playlistinfo(&mut ctx, &request, &mut stream).await?, 120 + "outputs" => handle_outputs(&mut ctx, &request, &mut stream).await?, 120 121 "command_list_begin" => { 121 122 handle_command_list_begin(&mut ctx, &request, &mut stream).await? 122 123 }