Fixed a subtle bug when downloading movies where the movie_id needs to be specified in the POST to the releases endpoint

This commit is contained in:
2023-08-08 10:50:07 -06:00
parent 77fd9e621f
commit e9b6ff0ca1
3 changed files with 16 additions and 2 deletions
+1
View File
@@ -458,6 +458,7 @@ pub struct Release {
pub struct ReleaseDownloadBody { pub struct ReleaseDownloadBody {
pub guid: String, pub guid: String,
pub indexer_id: u64, pub indexer_id: u64,
pub movie_id: u64,
} }
#[derive(Default, PartialEq, Eq, Clone, Copy, Debug, EnumIter, Display)] #[derive(Default, PartialEq, Eq, Clone, Copy, Debug, EnumIter, Display)]
+6 -1
View File
@@ -443,6 +443,7 @@ impl<'a, 'b> Network<'a, 'b> {
} }
async fn download_release(&mut self) { async fn download_release(&mut self) {
let (movie_id, _) = self.extract_movie_id().await;
let (guid, title, indexer_id) = { let (guid, title, indexer_id) = {
let app = self.app.lock().await; let app = self.app.lock().await;
let Release { let Release {
@@ -457,7 +458,11 @@ impl<'a, 'b> Network<'a, 'b> {
info!("Downloading release: {}", title); info!("Downloading release: {}", title);
let download_release_body = ReleaseDownloadBody { guid, indexer_id }; let download_release_body = ReleaseDownloadBody {
guid,
indexer_id,
movie_id,
};
let request_props = self let request_props = self
.radarr_request_props_from( .radarr_request_props_from(
+9 -1
View File
@@ -1805,7 +1805,8 @@ mod test {
RequestMethod::Post, RequestMethod::Post,
Some(json!({ Some(json!({
"guid": "1234", "guid": "1234",
"indexerId": 2 "indexerId": 2,
"movieId": 1
})), })),
None, None,
RadarrEvent::DownloadRelease.resource(), RadarrEvent::DownloadRelease.resource(),
@@ -1818,6 +1819,13 @@ mod test {
.radarr_data .radarr_data
.movie_releases .movie_releases
.set_items(vec![release()]); .set_items(vec![release()]);
app_arc
.lock()
.await
.data
.radarr_data
.movies
.set_items(vec![movie()]);
let mut network = Network::new(&app_arc, CancellationToken::new()); let mut network = Network::new(&app_arc, CancellationToken::new());
network network