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.

expose playlist_resume_track FFI to GraphQL and gRPC

expose playlist_resume_track FFI to GraphQL and gRPC

expose playlist_resume_track FFI to GraphQL and gRPC

expose playlist_resume_track FFI to GraphQL and gRPC

expose playlist_resume_track FFI to GraphQL and gRPC

expose playlist_resume_track FFI to GraphQL and gRPC

+58 -3
+7 -2
crates/graphql/src/schema/playlist.rs
··· 47 47 Ok("playlist resume".to_string()) 48 48 } 49 49 50 - async fn resume_track(&self) -> String { 51 - "resume track".to_string() 50 + async fn resume_track(&self, ctx: &Context<'_>) -> Result<String, Error> { 51 + ctx.data::<Arc<Mutex<Sender<RockboxCommand>>>>() 52 + .unwrap() 53 + .lock() 54 + .unwrap() 55 + .send(RockboxCommand::PlaylistResumeTrack)?; 56 + Ok("resume track".to_string()) 52 57 } 53 58 54 59 async fn playlist_set_modified(&self) -> String {
+4
crates/rpc/proto/rockbox/v1alpha1/playlist.proto
··· 45 45 } 46 46 47 47 message ResumeTrackRequest { 48 + int32 start_index = 1; 49 + uint32 crc = 2; 50 + uint64 elapsed = 3; 51 + uint64 offset = 4; 48 52 } 49 53 50 54 message ResumeTrackResponse {
+10 -1
crates/rpc/src/api/rockbox.v1alpha1.rs
··· 2000 2000 #[derive(Clone, Copy, PartialEq, ::prost::Message)] 2001 2001 pub struct PlaylistResumeResponse {} 2002 2002 #[derive(Clone, Copy, PartialEq, ::prost::Message)] 2003 - pub struct ResumeTrackRequest {} 2003 + pub struct ResumeTrackRequest { 2004 + #[prost(int32, tag = "1")] 2005 + pub start_index: i32, 2006 + #[prost(uint32, tag = "2")] 2007 + pub crc: u32, 2008 + #[prost(uint64, tag = "3")] 2009 + pub elapsed: u64, 2010 + #[prost(uint64, tag = "4")] 2011 + pub offset: u64, 2012 + } 2004 2013 #[derive(Clone, Copy, PartialEq, ::prost::Message)] 2005 2014 pub struct ResumeTrackResponse {} 2006 2015 #[derive(Clone, Copy, PartialEq, ::prost::Message)]
crates/rpc/src/api/rockbox_descriptor.bin

This is a binary file and will not be displayed.

+6
crates/rpc/src/playlist.rs
··· 74 74 &self, 75 75 request: tonic::Request<ResumeTrackRequest>, 76 76 ) -> Result<tonic::Response<ResumeTrackResponse>, tonic::Status> { 77 + let params = request.into_inner(); 78 + self.cmd_tx 79 + .lock() 80 + .unwrap() 81 + .send(RockboxCommand::PlaylistResumeTrack) 82 + .map_err(|_| tonic::Status::internal("Failed to send command"))?; 77 83 Ok(tonic::Response::new(ResumeTrackResponse::default())) 78 84 } 79 85
+12
crates/server/src/lib.rs
··· 94 94 "/playlist_resume" => { 95 95 rb::playlist::resume(); 96 96 } 97 + "/playlist_resume_track" => { 98 + let status = unsafe { &rb::global_status }; 99 + rb::playlist::resume_track( 100 + status.resume_index, 101 + status.resume_crc32, 102 + status.resume_elapsed.into(), 103 + status.resume_offset.into(), 104 + ); 105 + } 97 106 _ => { 98 107 if path.starts_with("/play") { 99 108 let params: Vec<_> = path.split('?').collect(); ··· 168 177 } 169 178 RockboxCommand::PlaylistResume => { 170 179 reqwest::blocking::get(&format!("{}/playlist_resume", url)).unwrap(); 180 + } 181 + RockboxCommand::PlaylistResumeTrack => { 182 + reqwest::blocking::get(&format!("{}/playlist_resume_track", url)).unwrap(); 171 183 } 172 184 } 173 185 }
+1
crates/sys/src/events.rs
··· 8 8 FlushAndReloadTracks, 9 9 Stop, 10 10 PlaylistResume, 11 + PlaylistResumeTrack, 11 12 }
+18
crates/sys/src/lib.rs
··· 604 604 ListEdgeBeepNoWrap, 605 605 } 606 606 607 + #[repr(C)] 608 + #[derive(Debug)] 609 + pub struct SystemStatus { 610 + pub resume_index: i32, 611 + pub resume_crc32: u32, 612 + pub resume_elapsed: u32, 613 + pub resume_offset: u32, 614 + pub runtime: i32, 615 + pub topruntime: i32, 616 + pub dircache_size: i32, 617 + pub last_screen: i8, 618 + pub viewer_icon_count: i32, 619 + pub last_volume_change: i32, 620 + pub font_id: [i32; NB_SCREENS], 621 + } 622 + 607 623 extern "C" { 624 + pub static global_status: SystemStatus; 625 + 608 626 // Playback control 609 627 fn audio_pause() -> c_void; 610 628 fn audio_play(elapsed: c_long, offset: c_long) -> c_void;