Update library lists when a move finishes (#1)
CI / test (push) Successful in 1m14s

The Library now follows moves on both servers: an item shows "Moving to …" while it moves and "Moved to …" until the source's Jellyfin drops
it after its rescan; the list reloads when a move finishes and checks again every 20 s for a few minutes. The destination shows the new item
straight away.
This commit is contained in:
IxianPixel committed 2026-11-06 17:21:22 +00:00
1 parent 484ac50508
commit 2bd4489b1a
9 files changed
+236 -61

No files matched your search

+14
View File
@@ -589,6 +589,9 @@ async fn moves_seasons_one_at_a_time_and_trashes_the_empty_show() {
assert_eq!(seasons[0]["folder"], "Season 01");
assert_eq!(seasons[1]["number"], 2);
// List cloud's shows first so their sizes are cached.
items_with_sizes(&cloud.url, "node=local&library=lib-tv-shows").await;
// Season 2 into a show home doesn't have yet: the show's NFO comes too.
let s2 = cloud.fake.season_id("Severance", 2).unwrap();
assert_eq!(seasons[1]["id"], s2);
@@ -612,8 +615,15 @@ async fn moves_seasons_one_at_a_time_and_trashes_the_empty_show() {
let home_series = home.fake.find("Series", "Severance").unwrap();
assert!(home.fake.get_user_data(&home_series).is_none());
// The cached size of cloud's show was dropped, so it's measured again
// without waiting for the hourly check.
let shows = items_with_sizes(&cloud.url, "node=local&library=lib-tv-shows").await;
assert_eq!(shows[0]["size"]["bytes"], tree_size(&show_cloud));
assert_eq!(shows[0]["size"]["parts"].as_array().unwrap().len(), 1);
// Mark home's copy of the NFO so we can tell it isn't overwritten.
std::fs::write(show_home.join("tvshow.nfo"), b"home's own").unwrap();
items_with_sizes(&home.url, "node=local&library=lib-tv-shows").await;
// Season 1 joins the existing show, and was the last one on cloud.
let s1 = cloud.fake.season_id("Severance", 1).unwrap();
@@ -628,6 +638,10 @@ async fn moves_seasons_one_at_a_time_and_trashes_the_empty_show() {
);
assert!(show_home.join("Season 01/Severance S01E02.mkv").exists());
assert_eq!(std::fs::read(show_home.join("tvshow.nfo")).unwrap(), b"home's own");
// Home's show grew, and its size says so straight away.
let shows = items_with_sizes(&home.url, "node=local&library=lib-tv-shows").await;
assert_eq!(shows[0]["size"]["bytes"], tree_size(&show_home));
assert_eq!(shows[0]["size"]["parts"].as_array().unwrap().len(), 2);
let new_e1 = home.fake.episode_id("Severance", 1, 1).unwrap();
assert_eq!(home.fake.get_user_data(&new_e1).unwrap()["Played"], true);