Initial boilerplate

This commit is contained in:
Muaz Ahmad 2024-11-25 14:57:49 +05:00
commit cd106914a1
10 changed files with 1936 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
target/

1838
Cargo.lock generated Normal file

File diff suppressed because it is too large Load diff

9
Cargo.toml Normal file
View file

@ -0,0 +1,9 @@
[package]
name = "subtails"
version = "0.1.0"
edition = "2021"
[dependencies]
crossterm = "0.28.1"
ratatui = "0.29.0"
reqwest = "0.12.9"

12
src/audio/mod.rs Normal file
View file

@ -0,0 +1,12 @@
use std::sync::{mpsc::Sender, Arc};
use crate::{config::Settings, utils::Error};
pub enum AudioEvent {}
pub fn init(
settings: Arc<Settings>,
error_chan: Sender<Error>,
) -> Result<Sender<AudioEvent>, Error> {
unimplemented!()
}

9
src/config/mod.rs Normal file
View file

@ -0,0 +1,9 @@
use std::sync::Arc;
use crate::utils::Error;
pub struct Settings {}
pub fn init() -> Result<Arc<Settings>, Error> {
unimplemented!()
}

32
src/main.rs Normal file
View file

@ -0,0 +1,32 @@
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),
};
}

9
src/player/begin.rs Normal file
View file

@ -0,0 +1,9 @@
use crate::utils::Error;
use super::Player;
impl Player {
pub fn begin(&mut self) -> Result<(), Error> {
unimplemented!()
}
}

16
src/player/mod.rs Normal file
View file

@ -0,0 +1,16 @@
use std::sync::{mpsc::Sender, Arc};
use crate::{audio::AudioEvent, config::Settings, ssonic::APIEvent, utils::Error};
pub struct Player {}
pub fn init(
settings: Arc<Settings>,
audio_chan: Sender<AudioEvent>,
api_chan: Sender<APIEvent>,
error_chan: Sender<Error>,
) -> Result<Player, Error> {
unimplemented!()
}
mod begin;

9
src/ssonic/mod.rs Normal file
View file

@ -0,0 +1,9 @@
use std::sync::{mpsc::Sender, Arc};
use crate::{config::Settings, utils::Error};
pub enum APIEvent {}
pub fn init(settings: Arc<Settings>, error_chan: Sender<Error>) -> Result<Sender<APIEvent>, Error> {
unimplemented!()
}

1
src/utils.rs Normal file
View file

@ -0,0 +1 @@
pub type Error = Box<dyn std::error::Error>;