fix(radarr): model the movie status as an enum
Movie.status and AddMovieSearchResult.status were bare Strings compared against the literal "released" in the row-style decorator and in the movie details style function. They now carry a MovieStatus enum with the five values Radarr actually sends (tba, announced, inCinemas, released, deleted), shaped like MinimumAvailability and DownloadStatus, and guarded with from_json_or_default so an unrecognised status degrades to Tba instead of failing the whole fetch. Radarr never sends "Downloaded" as a movie status; its web UI derives that label from released plus hasFile. Every fixture that carried "Downloaded" now holds released, the value it was standing in for, so none of them degrade to the default through the guard. The status is never rendered as text in the Radarr tree, so no snapshot changes; the CLI JSON output is unchanged since the enum serializes to the same camelCase strings. The style_from_download_status tests now exercise the unreleased arm, which previously had no case, in place of a duplicated unmonitored-missing row.
This commit is contained in:
10 files changed
+149
-50
No files matched your search
@@ -1,7 +1,7 @@
|
||||
use crate::app::App;
|
||||
use crate::logos::RADARR_LOGO;
|
||||
use crate::models::Route;
|
||||
use crate::models::radarr_models::{DownloadRecord, DownloadStatus, Movie};
|
||||
use crate::models::radarr_models::{DownloadRecord, DownloadStatus, Movie, MovieStatus};
|
||||
use crate::models::servarr_data::radarr::radarr_data::RadarrData;
|
||||
use crate::models::servarr_models::{DiskSpace, RootFolder};
|
||||
use crate::ui::DrawUi;
|
||||
@@ -243,7 +243,7 @@ fn decorate_with_row_style<'a>(
|
||||
return row.unmonitored_missing();
|
||||
}
|
||||
|
||||
if movie.status != "released" {
|
||||
if movie.status != MovieStatus::Released {
|
||||
return row.unreleased();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user