feat: Update to latest iced
This commit is contained in:
50
src/main.rs
50
src/main.rs
@@ -2,8 +2,7 @@ mod errors;
|
||||
use api::{JellyfinClient, JellyfinConfig};
|
||||
use errors::*;
|
||||
|
||||
#[tokio::main]
|
||||
pub async fn main() -> Result<()> {
|
||||
fn jellyfin_config_try() -> Result<JellyfinConfig> {
|
||||
dotenvy::dotenv()
|
||||
.change_context(Error)
|
||||
.inspect_err(|err| {
|
||||
@@ -16,16 +15,45 @@ pub async fn main() -> Result<()> {
|
||||
std::env::var("JELLYFIN_SERVER_URL").change_context(Error)?,
|
||||
"jello".to_string(),
|
||||
);
|
||||
let mut jellyfin = api::JellyfinClient::new(config);
|
||||
jellyfin
|
||||
.authenticate_with_cached_token(".session")
|
||||
.await
|
||||
.change_context(Error)?;
|
||||
Ok(config)
|
||||
}
|
||||
|
||||
#[cfg(feature = "iced")]
|
||||
ui_iced::ui(jellyfin);
|
||||
#[cfg(feature = "gpui")]
|
||||
ui_gpui::ui(jellyfin);
|
||||
fn jellyfin_config() -> JellyfinConfig {
|
||||
jellyfin_config_try().unwrap_or_else(|err| {
|
||||
eprintln!("Error loading Jellyfin configuration: {}", err);
|
||||
std::process::exit(1);
|
||||
})
|
||||
}
|
||||
|
||||
fn main() -> Result<()> {
|
||||
ui_iced::ui(jellyfin_config).change_context(Error)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// #[tokio::main]
|
||||
// pub async fn main() -> Result<()> {
|
||||
// dotenvy::dotenv()
|
||||
// .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(),
|
||||
// );
|
||||
// let mut jellyfin = api::JellyfinClient::new(config);
|
||||
// jellyfin
|
||||
// .authenticate_with_cached_token(".session")
|
||||
// .await
|
||||
// .change_context(Error)?;
|
||||
//
|
||||
// #[cfg(feature = "iced")]
|
||||
// ui_iced::ui(jellyfin);
|
||||
// #[cfg(feature = "gpui")]
|
||||
// ui_gpui::ui(jellyfin);
|
||||
//
|
||||
// Ok(())
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user