feat: stream currently playing + volume + toggle pause + seek position
This commit is contained in:
@@ -9,7 +9,7 @@ use crate::{
|
||||
checksum::generate_hash,
|
||||
database::tracks::{get_tracks, insert_tracks},
|
||||
music::metadata::{extract_track_data, TrackMetadata},
|
||||
proto::{self, library_server::Library},
|
||||
proto::library::{library_server::Library, Track, TrackList},
|
||||
state::GrooveState,
|
||||
};
|
||||
|
||||
@@ -30,7 +30,7 @@ impl Library for LibraryService {
|
||||
async fn list_tracks(
|
||||
&self,
|
||||
_request: tonic::Request<()>,
|
||||
) -> Result<tonic::Response<proto::TrackList>, tonic::Status> {
|
||||
) -> Result<tonic::Response<TrackList>, tonic::Status> {
|
||||
let Ok(db) = self.pool.get() else {
|
||||
return Err(tonic::Status::internal(""));
|
||||
};
|
||||
@@ -39,16 +39,17 @@ impl Library for LibraryService {
|
||||
return Err(tonic::Status::internal(""));
|
||||
};
|
||||
|
||||
let response = proto::TrackList {
|
||||
let response = TrackList {
|
||||
tracks: tracks
|
||||
.iter()
|
||||
.map(|t| proto::Track {
|
||||
.map(|t| Track {
|
||||
hash: t.hash.clone(),
|
||||
name: t.name.clone(),
|
||||
artist_name: t.artist_name.clone(),
|
||||
artist_id: t.artist_id,
|
||||
duration: t.duration,
|
||||
})
|
||||
.collect::<Vec<proto::Track>>(),
|
||||
.collect::<Vec<Track>>(),
|
||||
};
|
||||
|
||||
Ok(tonic::Response::new(response))
|
||||
|
||||
Reference in New Issue
Block a user