Fix TUI Add flow landing new movies/shows flat in the library root

add_selected_search_result passed the raw configured default_root_folder
straight through as root_folder for both movies and series, with no
per-item subfolder computed. import_one/season_dir both expect
root_folder to already be the item's own folder, so new grabs landed
directly in the shared library root instead of their own folder,
invisible to Jellyfin's per-category libraries. Split default_root_folder
(series) from a new movies_root_folder, and have the TUI build the
"{Title} (Year)" subfolder itself before sending the add request.
This commit is contained in:
Breadway 2026-08-05 19:02:27 +08:00
parent 15b5b12a06
commit 7e1b7450cf
4 changed files with 71 additions and 14 deletions

View file

@ -27,19 +27,31 @@ pub struct Config {
pub transcode: TranscodeConfig,
}
/// Where the TUI's "add show" flow places new series by default. Sonarr/
/// Radarr let you pick a root folder per add; a single configured default
/// is a reasonable v1 simplification — per-add picking can follow later.
/// Where the TUI's "add" flow places new series/movies by default. Sonarr/
/// Radarr let you pick a root folder per add; a single configured default per
/// kind is a reasonable v1 simplification — per-add picking can follow later.
/// Series and movies need *separate* defaults (not one shared value) because
/// they live under different category roots on disk (e.g. `TV Shows/` vs
/// `Movies/`) — a real production bug had both kinds falling back to one
/// bare library root with no per-item subfolder, landing new grabs directly
/// in the library root instead of inside their own show/movie folder,
/// invisible to Jellyfin's per-category libraries.
#[derive(Debug, Clone, Default, Deserialize)]
pub struct LibraryConfig {
#[serde(default = "default_root_folder")]
pub default_root_folder: String,
#[serde(default = "default_movies_root_folder")]
pub movies_root_folder: String,
}
fn default_root_folder() -> String {
"~/breadarr-library".to_string()
}
fn default_movies_root_folder() -> String {
"~/breadarr-library/Movies".to_string()
}
#[derive(Debug, Clone, Deserialize)]
pub struct SourcesConfig {
/// 1337x's main domain bans IPs at the Cloudflare WAF level after
@ -625,6 +637,10 @@ impl Config {
pub fn default_root_folder(&self) -> PathBuf {
expand_home(&self.library.default_root_folder)
}
pub fn movies_root_folder(&self) -> PathBuf {
expand_home(&self.library.movies_root_folder)
}
}
fn config_path() -> PathBuf {