feat: stream currently playing + volume + toggle pause + seek position
This commit is contained in:
22
src/main.rs
22
src/main.rs
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user