Terminal interface to find, download, and stream movies, TV shows, and live TV using local media players.
refactor: simplify etag comparison logic and rename ThemeKind::from_str to parse
Samir Hossainsb29d277dae36
diff --git a/src/download.rs b/src/download.rsindex 9d8244a..d5027a5 100644--- a/src/download.rs+++ b/src/download.rs@@ -604,9 +604,8 @@ fn metadata_matches(previous: &ResumeMetadata, current: &ResumeMetadata) -> boolreturn false;}- match (&previous.etag, ¤t.etag) {- (Some(a), Some(b)) => return a == b,- _ => {}+ if let (Some(a), Some(b)) = (&previous.etag, ¤t.etag) {+ return a == b;}match (&previous.last_modified, ¤t.last_modified) {diff --git a/src/tui/app.rs b/src/tui/app.rsindex d321d6a..42f04e6 100644--- a/src/tui/app.rs+++ b/src/tui/app.rs@@ -94,7 +94,7 @@ impl App {let mut theme = crate::tui::theme::Theme::new();if !state.active_theme_kind.is_empty() {- let theme_kind = crate::tui::theme::ThemeKind::from_str(&state.active_theme_kind);+ let theme_kind = crate::tui::theme::ThemeKind::parse(&state.active_theme_kind);state.active_theme_kind = theme_kind.as_str().to_string();theme = crate::tui::theme::Theme::from_kind(theme_kind);} else {@@ -3209,7 +3209,7 @@ impl App {}}Action::SelectTheme(theme_name) => {- let kind = crate::tui::theme::ThemeKind::from_str(&theme_name);+ let kind = crate::tui::theme::ThemeKind::parse(&theme_name);self.state.active_theme_kind = kind.as_str().to_string();self.theme = crate::tui::theme::Theme::from_kind(kind);self.state.dirty = true;diff --git a/src/tui/theme.rs b/src/tui/theme.rsindex 87b3e92..9a0f650 100644--- a/src/tui/theme.rs+++ b/src/tui/theme.rs@@ -20,7 +20,7 @@ pub enum ThemeKind {}impl ThemeKind {- pub fn from_str(s: &str) -> Self {+ pub fn parse(s: &str) -> Self {match s.to_ascii_lowercase().as_str() {"latte" | "light" => ThemeKind::Latte,"macchiato" => ThemeKind::Macchiato,@@ -197,7 +197,7 @@ impl Theme {let is_light = crate::tui::terminal::background_is_light();if let Ok(theme_env) = std::env::var("MOVIEBOX_THEME") {- return Self::from_kind(ThemeKind::from_str(&theme_env));+ return Self::from_kind(ThemeKind::parse(&theme_env));}if has_no_color {