fix(radarr): Pass the movie ID alongside all UpdateAndScan events published to the networking channel

This commit is contained in:
2024-12-17 21:34:14 -07:00
parent cb8035a2ce
commit 43410fac60
10 changed files with 26 additions and 192 deletions
+5 -23
View File
@@ -75,7 +75,7 @@ pub enum RadarrEvent {
TestAllIndexers,
TriggerAutomaticSearch(i64),
UpdateAllMovies,
UpdateAndScan(Option<i64>),
UpdateAndScan(i64),
UpdateCollections,
UpdateDownloads,
}
@@ -1778,13 +1778,12 @@ impl<'a, 'b> Network<'a, 'b> {
.await
}
async fn update_and_scan_movie(&mut self, movie_id: Option<i64>) -> Result<Value> {
let (id, _) = self.extract_movie_id(movie_id).await;
let event = RadarrEvent::UpdateAndScan(None);
info!("Updating and scanning movie with ID: {id}");
async fn update_and_scan_movie(&mut self, movie_id: i64) -> Result<Value> {
let event = RadarrEvent::UpdateAndScan(movie_id);
info!("Updating and scanning movie with ID: {movie_id}");
let body = MovieCommandBody {
name: "RefreshMovie".to_owned(),
movie_ids: vec![id],
movie_ids: vec![movie_id],
};
let request_props = self
@@ -1857,23 +1856,6 @@ impl<'a, 'b> Network<'a, 'b> {
})
.collect()
}
async fn extract_movie_id(&mut self, movie_id: Option<i64>) -> (i64, String) {
let movie_id = if let Some(id) = movie_id {
id
} else {
self
.app
.lock()
.await
.data
.radarr_data
.movies
.current_selection()
.id
};
(movie_id, format!("movieId={movie_id}"))
}
}
fn get_movie_status(has_file: bool, downloads_vec: &[DownloadRecord], movie_id: i64) -> String {