feat: Initial working prototype
Some checks failed
build / checks-matrix (push) Has been cancelled
build / checks-build (push) Has been cancelled
build / codecov (push) Has been cancelled
docs / docs (push) Has been cancelled

This commit is contained in:
uttarayan21
2025-11-19 01:39:20 +05:30
parent 3222c26bb6
commit a1c36e4fb2
10 changed files with 269 additions and 76 deletions

View File

@@ -3,29 +3,22 @@ use api::{JellyfinClient, JellyfinConfig};
use errors::*;
fn jellyfin_config_try() -> Result<JellyfinConfig> {
dotenvy::dotenv()
let file = std::fs::read("config.toml").change_context(Error)?;
let config: JellyfinConfig = toml::from_slice(&file)
.change_context(Error)
.inspect_err(|err| {
eprintln!("Failed to load .env file: {}", err);
})
.ok();
let config = JellyfinConfig::new(
std::env::var("JELLYFIN_USERNAME").change_context(Error)?,
std::env::var("JELLYFIN_PASSWORD").change_context(Error)?,
std::env::var("JELLYFIN_SERVER_URL").change_context(Error)?,
"jello".to_string(),
);
.attach("Failed to parse Jellyfin Config")?;
Ok(config)
}
fn jellyfin_config() -> JellyfinConfig {
jellyfin_config_try().unwrap_or_else(|err| {
eprintln!("Error loading Jellyfin configuration: {}", err);
eprintln!("Error loading Jellyfin configuration: {:?}", err);
std::process::exit(1);
})
}
fn main() -> Result<()> {
tracing_subscriber::fmt::init();
ui_iced::ui(jellyfin_config).change_context(Error)?;
Ok(())
}