Almost kinda functional description box

This commit is contained in:
2023-08-08 10:50:04 -06:00
parent d39acb0683
commit b24e0cdccd
16 changed files with 710 additions and 288 deletions
+26 -2
View File
@@ -1,6 +1,30 @@
use reqwest::Response;
use serde::de::DeserializeOwned;
use serde_json::Number;
use crate::network::radarr_network::DownloadRecord;
pub async fn parse_response<T: DeserializeOwned>(response: Response) -> Result<T, reqwest::Error> {
response.json::<T>().await
}
response.json::<T>().await
}
pub fn get_movie_status(
has_file: bool,
downloads_vec: &Vec<DownloadRecord>,
movie_id: Number,
) -> String {
if !has_file {
if let Some(download) = downloads_vec
.iter()
.find(|&download| download.movie_id == movie_id)
{
if download.status == "downloading" {
return "Downloading".to_owned();
}
return "Missing".to_owned();
}
}
"Downloaded".to_owned()
}