feat: stream currently playing + volume + toggle pause + seek position

This commit is contained in:
2024-11-24 23:36:24 +01:00
parent 51a57ebd40
commit de9e430828
14 changed files with 314 additions and 62 deletions

View File

@@ -3,12 +3,12 @@ use database::{establish_connection, initialize_database};
use library::LibraryService;
use music::player::AudioPlayer;
use player::PlayerService;
use proto::library_server::LibraryServer;
use proto::player_server::PlayerServer;
use proto::settings_server::SettingsServer;
use proto::library::library_server::LibraryServer;
use proto::player::player_server::PlayerServer;
use proto::settings::settings_server::SettingsServer;
use rodio::{OutputStream, Sink};
use state::{GrooveState, GrooveStateData};
use tokio::sync::RwLock;
use tokio::sync::Mutex;
use tonic::transport::Server;
pub mod checksum;
@@ -23,9 +23,15 @@ pub mod state;
use settings::SettingsService;
pub mod proto {
tonic::include_proto!("settings");
tonic::include_proto!("library");
tonic::include_proto!("player");
pub mod settings {
tonic::include_proto!("settings");
}
pub mod library {
tonic::include_proto!("library");
}
pub mod player {
tonic::include_proto!("player");
}
}
#[tokio::main]
@@ -44,7 +50,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let player = AudioPlayer::new(sink);
let state = GrooveState::new(RwLock::new(GrooveStateData::new(player)));
let state = GrooveState::new(Mutex::new(GrooveStateData::new(player)));
let settings = SettingsService::new(state.clone(), pool.clone());
let library = LibraryService::new(state.clone(), pool.clone());