33 lines
685 B
Rust
33 lines
685 B
Rust
|
use std::process::exit;
|
||
|
|
||
|
use std::error::Error;
|
||
|
use std::sync::mpsc::channel;
|
||
|
|
||
|
mod audio;
|
||
|
mod config;
|
||
|
mod player;
|
||
|
mod ssonic;
|
||
|
mod utils;
|
||
|
|
||
|
fn init() -> Result<(), Box<dyn Error>> {
|
||
|
let settings = config::init()?;
|
||
|
let (error_in, error_out) = channel();
|
||
|
let audio_event_chan = audio::init(settings.clone(), error_in.clone())?;
|
||
|
let api_event_chan = ssonic::init(settings.clone(), error_in.clone())?;
|
||
|
let mut player = player::init(
|
||
|
settings.clone(),
|
||
|
audio_event_chan,
|
||
|
api_event_chan,
|
||
|
error_in.clone(),
|
||
|
)?;
|
||
|
player.begin()?;
|
||
|
Ok(())
|
||
|
}
|
||
|
|
||
|
fn main() {
|
||
|
match init() {
|
||
|
Err(_) => exit(1),
|
||
|
Ok(_) => exit(0),
|
||
|
};
|
||
|
}
|