refactor: move shared servarr types into servarr_models
SystemStatus was declared three times, byte for byte identically, in radarr_models, sonarr_models, and lidarr_models. MetadataProfile and the Lidarr release download body were each declared in a single servarr module despite having nothing servarr specific about them: MetadataProfile is an id and name pair structurally identical to QualityProfile, which already lives in servarr_models, and a download body of a guid plus an indexer id is the generic form of that request. Move all three into servarr_models, preserving that file's alphabetical ordering, and drop the prefix from LidarrReleaseDownloadBody now that it is no longer owned by one servarr. RadarrReleaseDownloadBody and SonarrReleaseDownloadBody deliberately stay where they are. Radarr's carries a movie id and Sonarr's carries optional series, episode, and season fields, so the three types are not interchangeable and only the Lidarr shape is the common one. Behavior is unchanged. Every remaining edit is an import path update or the rename at a call site.
This commit is contained in:
24 files changed
+101
-107
No files matched your search
@@ -284,10 +284,8 @@ mod tests {
|
||||
use crate::cli::lidarr::manual_search_command_handler::LidarrManualSearchCommand;
|
||||
use crate::cli::lidarr::refresh_command_handler::LidarrRefreshCommand;
|
||||
use crate::cli::lidarr::trigger_automatic_search_command_handler::LidarrTriggerAutomaticSearchCommand;
|
||||
use crate::models::lidarr_models::{
|
||||
BlocklistItem, BlocklistResponse, LidarrReleaseDownloadBody, LidarrTaskName,
|
||||
};
|
||||
use crate::models::servarr_models::IndexerSettings;
|
||||
use crate::models::lidarr_models::{BlocklistItem, BlocklistResponse, LidarrTaskName};
|
||||
use crate::models::servarr_models::{IndexerSettings, ReleaseDownloadBody};
|
||||
use crate::{
|
||||
app::App,
|
||||
cli::{
|
||||
@@ -583,7 +581,7 @@ mod tests {
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_download_release_command() {
|
||||
let expected_release_download_body = LidarrReleaseDownloadBody {
|
||||
let expected_release_download_body = ReleaseDownloadBody {
|
||||
guid: "guid".to_owned(),
|
||||
indexer_id: 1,
|
||||
};
|
||||
|
||||
@@ -18,7 +18,8 @@ use super::{CliCommandHandler, Command};
|
||||
use crate::cli::lidarr::manual_search_command_handler::{
|
||||
LidarrManualSearchCommand, LidarrManualSearchCommandHandler,
|
||||
};
|
||||
use crate::models::lidarr_models::{LidarrReleaseDownloadBody, LidarrTaskName};
|
||||
use crate::models::lidarr_models::LidarrTaskName;
|
||||
use crate::models::servarr_models::ReleaseDownloadBody;
|
||||
use crate::network::lidarr_network::LidarrEvent;
|
||||
use crate::{app::App, network::NetworkTrait};
|
||||
|
||||
@@ -231,7 +232,7 @@ impl<'a, 'b> CliCommandHandler<'a, 'b, LidarrCommand> for LidarrCliHandler<'a, '
|
||||
serde_json::to_string_pretty(&resp)?
|
||||
}
|
||||
LidarrCommand::DownloadRelease { guid, indexer_id } => {
|
||||
let params = LidarrReleaseDownloadBody { guid, indexer_id };
|
||||
let params = ReleaseDownloadBody { guid, indexer_id };
|
||||
let resp = self
|
||||
.network
|
||||
.handle_network_event(LidarrEvent::DownloadRelease(params).into())
|
||||
|
||||
@@ -5,10 +5,9 @@ use crate::handlers::table_handler::{TableHandlingConfig, handle_table};
|
||||
use crate::handlers::{KeyEventHandler, handle_prompt_toggle};
|
||||
use crate::matches_key;
|
||||
use crate::models::Route;
|
||||
use crate::models::lidarr_models::{
|
||||
LidarrHistoryItem, LidarrRelease, LidarrReleaseDownloadBody, Track,
|
||||
};
|
||||
use crate::models::lidarr_models::{LidarrHistoryItem, LidarrRelease, Track};
|
||||
use crate::models::servarr_data::lidarr::lidarr_data::{ALBUM_DETAILS_BLOCKS, ActiveLidarrBlock};
|
||||
use crate::models::servarr_models::ReleaseDownloadBody;
|
||||
use crate::models::stateful_table::SortOption;
|
||||
use crate::network::lidarr_network::LidarrEvent;
|
||||
use serde_json::Number;
|
||||
@@ -281,7 +280,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveLidarrBlock> for AlbumDetailsHandler<
|
||||
.unwrap()
|
||||
.album_releases
|
||||
.current_selection();
|
||||
let params = LidarrReleaseDownloadBody {
|
||||
let params = ReleaseDownloadBody {
|
||||
guid: guid.clone(),
|
||||
indexer_id: *indexer_id,
|
||||
};
|
||||
@@ -386,7 +385,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveLidarrBlock> for AlbumDetailsHandler<
|
||||
.unwrap()
|
||||
.album_releases
|
||||
.current_selection();
|
||||
let params = LidarrReleaseDownloadBody {
|
||||
let params = ReleaseDownloadBody {
|
||||
guid: guid.clone(),
|
||||
indexer_id: *indexer_id,
|
||||
};
|
||||
|
||||
@@ -9,10 +9,10 @@ mod tests {
|
||||
AlbumDetailsHandler, releases_sorting_options,
|
||||
};
|
||||
use crate::models::HorizontallyScrollableText;
|
||||
use crate::models::lidarr_models::{LidarrRelease, LidarrReleaseDownloadBody};
|
||||
use crate::models::lidarr_models::LidarrRelease;
|
||||
use crate::models::servarr_data::lidarr::lidarr_data::{ALBUM_DETAILS_BLOCKS, ActiveLidarrBlock};
|
||||
use crate::models::servarr_data::lidarr::modals::AlbumDetailsModal;
|
||||
use crate::models::servarr_models::{Quality, QualityWrapper};
|
||||
use crate::models::servarr_models::{Quality, QualityWrapper, ReleaseDownloadBody};
|
||||
use pretty_assertions::{assert_eq, assert_str_eq};
|
||||
use rstest::rstest;
|
||||
use serde_json::Number;
|
||||
@@ -297,7 +297,7 @@ mod tests {
|
||||
assert_navigation_popped!(app, ActiveLidarrBlock::ManualAlbumSearch.into());
|
||||
assert_some_eq_x!(
|
||||
&app.data.lidarr_data.prompt_confirm_action,
|
||||
&LidarrEvent::DownloadRelease(LidarrReleaseDownloadBody {
|
||||
&LidarrEvent::DownloadRelease(ReleaseDownloadBody {
|
||||
guid: "1234".to_owned(),
|
||||
indexer_id: 2,
|
||||
})
|
||||
@@ -654,7 +654,7 @@ mod tests {
|
||||
assert_navigation_popped!(app, ActiveLidarrBlock::ManualAlbumSearch.into());
|
||||
assert_some_eq_x!(
|
||||
&app.data.lidarr_data.prompt_confirm_action,
|
||||
&LidarrEvent::DownloadRelease(LidarrReleaseDownloadBody {
|
||||
&LidarrEvent::DownloadRelease(ReleaseDownloadBody {
|
||||
guid: "1234".to_owned(),
|
||||
indexer_id: 2,
|
||||
})
|
||||
|
||||
@@ -4,13 +4,12 @@ use crate::handlers::lidarr_handlers::history::history_sorting_options;
|
||||
use crate::handlers::table_handler::{TableHandlingConfig, handle_table};
|
||||
use crate::handlers::{KeyEventHandler, handle_prompt_toggle};
|
||||
use crate::matches_key;
|
||||
use crate::models::lidarr_models::{
|
||||
Album, LidarrHistoryItem, LidarrRelease, LidarrReleaseDownloadBody,
|
||||
};
|
||||
use crate::models::lidarr_models::{Album, LidarrHistoryItem, LidarrRelease};
|
||||
use crate::models::servarr_data::lidarr::lidarr_data::{
|
||||
ARTIST_DETAILS_BLOCKS, ActiveLidarrBlock, DELETE_ALBUM_SELECTION_BLOCKS,
|
||||
EDIT_ARTIST_SELECTION_BLOCKS,
|
||||
};
|
||||
use crate::models::servarr_models::ReleaseDownloadBody;
|
||||
use crate::models::stateful_table::SortOption;
|
||||
use crate::models::{BlockSelectionState, Route};
|
||||
use crate::network::lidarr_network::LidarrEvent;
|
||||
@@ -202,7 +201,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveLidarrBlock> for ArtistDetailsHandler
|
||||
.discography_releases
|
||||
.current_selection()
|
||||
.clone();
|
||||
let params = LidarrReleaseDownloadBody { guid, indexer_id };
|
||||
let params = ReleaseDownloadBody { guid, indexer_id };
|
||||
self.app.data.lidarr_data.prompt_confirm_action =
|
||||
Some(LidarrEvent::DownloadRelease(params));
|
||||
}
|
||||
@@ -365,7 +364,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveLidarrBlock> for ArtistDetailsHandler
|
||||
.discography_releases
|
||||
.current_selection()
|
||||
.clone();
|
||||
let params = LidarrReleaseDownloadBody { guid, indexer_id };
|
||||
let params = ReleaseDownloadBody { guid, indexer_id };
|
||||
self.app.data.lidarr_data.prompt_confirm_action =
|
||||
Some(LidarrEvent::DownloadRelease(params));
|
||||
|
||||
|
||||
@@ -137,8 +137,9 @@ mod tests {
|
||||
use crate::event::Key;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::lidarr_handlers::library::artist_details_handler::ArtistDetailsHandler;
|
||||
use crate::models::lidarr_models::{LidarrHistoryItem, LidarrReleaseDownloadBody};
|
||||
use crate::models::lidarr_models::LidarrHistoryItem;
|
||||
use crate::models::servarr_data::lidarr::lidarr_data::ActiveLidarrBlock;
|
||||
use crate::models::servarr_models::ReleaseDownloadBody;
|
||||
use crate::network::lidarr_network::LidarrEvent;
|
||||
use crate::network::lidarr_network::lidarr_network_test_utils::test_utils::{
|
||||
artist, torrent_release,
|
||||
@@ -307,7 +308,7 @@ mod tests {
|
||||
assert_navigation_popped!(app, ActiveLidarrBlock::ManualArtistSearch.into());
|
||||
assert_eq!(
|
||||
app.data.lidarr_data.prompt_confirm_action,
|
||||
Some(LidarrEvent::DownloadRelease(LidarrReleaseDownloadBody {
|
||||
Some(LidarrEvent::DownloadRelease(ReleaseDownloadBody {
|
||||
guid: release.guid,
|
||||
indexer_id: release.indexer_id,
|
||||
}))
|
||||
@@ -449,10 +450,11 @@ mod tests {
|
||||
use crate::assert_navigation_pushed;
|
||||
use crate::handlers::KeyEventHandler;
|
||||
use crate::handlers::lidarr_handlers::library::artist_details_handler::ArtistDetailsHandler;
|
||||
use crate::models::lidarr_models::{Artist, LidarrReleaseDownloadBody};
|
||||
use crate::models::lidarr_models::Artist;
|
||||
use crate::models::servarr_data::lidarr::lidarr_data::{
|
||||
ActiveLidarrBlock, EDIT_ARTIST_SELECTION_BLOCKS,
|
||||
};
|
||||
use crate::models::servarr_models::ReleaseDownloadBody;
|
||||
use crate::network::lidarr_network::LidarrEvent;
|
||||
use crate::network::lidarr_network::lidarr_network_test_utils::test_utils::torrent_release;
|
||||
use crate::{assert_modal_absent, assert_modal_present, assert_navigation_popped};
|
||||
@@ -801,7 +803,7 @@ mod tests {
|
||||
assert_navigation_popped!(app, ActiveLidarrBlock::ManualArtistSearch.into());
|
||||
assert_eq!(
|
||||
app.data.lidarr_data.prompt_confirm_action,
|
||||
Some(LidarrEvent::DownloadRelease(LidarrReleaseDownloadBody {
|
||||
Some(LidarrEvent::DownloadRelease(ReleaseDownloadBody {
|
||||
guid: release.guid,
|
||||
indexer_id: release.indexer_id,
|
||||
}))
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use super::{
|
||||
HorizontallyScrollableText, Serdeable,
|
||||
servarr_models::{
|
||||
DiskSpace, HostConfig, Indexer, IndexerTestResult, QualityProfile, QualityWrapper, RootFolder,
|
||||
SecurityConfig, Tag,
|
||||
DiskSpace, HostConfig, Indexer, IndexerTestResult, MetadataProfile, QualityProfile,
|
||||
QualityWrapper, RootFolder, SecurityConfig, SystemStatus, Tag,
|
||||
},
|
||||
};
|
||||
use crate::models::servarr_models::{IndexerSettings, LogResponse, QueueEvent, Update};
|
||||
@@ -97,22 +97,6 @@ pub struct ArtistStatistics {
|
||||
|
||||
impl Eq for ArtistStatistics {}
|
||||
|
||||
#[derive(Default, Clone, Serialize, Deserialize, Debug, PartialEq, Eq)]
|
||||
pub struct MetadataProfile {
|
||||
#[serde(deserialize_with = "super::from_i64")]
|
||||
pub id: i64,
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
impl From<(&i64, &String)> for MetadataProfile {
|
||||
fn from(value: (&i64, &String)) -> Self {
|
||||
MetadataProfile {
|
||||
id: *value.0,
|
||||
name: value.1.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Serialize,
|
||||
Deserialize,
|
||||
@@ -230,13 +214,6 @@ pub struct DownloadsResponse {
|
||||
pub records: Vec<DownloadRecord>,
|
||||
}
|
||||
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct SystemStatus {
|
||||
pub version: String,
|
||||
pub start_time: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[derive(Derivative, Serialize, Deserialize, Debug, Default, Clone, PartialEq, Eq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct AddArtistSearchResult {
|
||||
@@ -492,13 +469,6 @@ pub struct LidarrRelease {
|
||||
pub quality: QualityWrapper,
|
||||
}
|
||||
|
||||
#[derive(Default, Serialize, Debug, PartialEq, Eq, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct LidarrReleaseDownloadBody {
|
||||
pub guid: String,
|
||||
pub indexer_id: i64,
|
||||
}
|
||||
|
||||
#[derive(Default, Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct BlocklistItem {
|
||||
|
||||
@@ -7,12 +7,13 @@ mod tests {
|
||||
use crate::models::lidarr_models::{
|
||||
AddArtistSearchResult, Album, AudioTags, BlocklistItem, BlocklistResponse, DownloadRecord,
|
||||
DownloadStatus, DownloadsResponse, LidarrHistoryEventType, LidarrHistoryItem,
|
||||
LidarrHistoryWrapper, LidarrRelease, LidarrTask, MediaInfo, Member, MetadataProfile,
|
||||
MonitorType, NewItemMonitorType, SystemStatus, Track, TrackFile,
|
||||
LidarrHistoryWrapper, LidarrRelease, LidarrTask, MediaInfo, Member, MonitorType,
|
||||
NewItemMonitorType, Track, TrackFile,
|
||||
};
|
||||
use crate::models::servarr_models::{
|
||||
DiskSpace, HostConfig, Indexer, IndexerSettings, IndexerTestResult, Log, LogResponse,
|
||||
QualityProfile, QueueEvent, RootFolder, SecurityConfig, Tag, Update,
|
||||
MetadataProfile, QualityProfile, QueueEvent, RootFolder, SecurityConfig, SystemStatus, Tag,
|
||||
Update,
|
||||
};
|
||||
use crate::models::{
|
||||
Serdeable,
|
||||
|
||||
@@ -13,7 +13,7 @@ use strum_macros::{Display, EnumIter};
|
||||
use super::Serdeable;
|
||||
use super::servarr_models::{
|
||||
DiskSpace, HostConfig, Indexer, Language, LogResponse, QualityProfile, QualityWrapper,
|
||||
QueueEvent, RootFolder, SecurityConfig, Tag, Update,
|
||||
QueueEvent, RootFolder, SecurityConfig, SystemStatus, Tag, Update,
|
||||
};
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -401,13 +401,6 @@ pub struct RadarrReleaseDownloadBody {
|
||||
pub movie_id: i64,
|
||||
}
|
||||
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct SystemStatus {
|
||||
pub version: String,
|
||||
pub start_time: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Default, Debug, Clone, PartialEq, Eq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct RadarrHistoryWrapper {
|
||||
|
||||
@@ -12,9 +12,11 @@ mod tests {
|
||||
AddMovieSearchResult, BlocklistItem, BlocklistResponse, Collection, Credit, DiskSpace,
|
||||
DownloadRecord, DownloadsResponse, Indexer, IndexerSettings, IndexerTestResult,
|
||||
MinimumAvailability, Movie, MovieHistoryItem, MovieMonitor, QualityProfile, RadarrRelease,
|
||||
RadarrSerdeable, RadarrTask, RadarrTaskName, SystemStatus, Tag, Update,
|
||||
RadarrSerdeable, RadarrTask, RadarrTaskName, Tag, Update,
|
||||
},
|
||||
servarr_models::{
|
||||
HostConfig, Log, LogResponse, QueueEvent, RootFolder, SecurityConfig, SystemStatus,
|
||||
},
|
||||
servarr_models::{HostConfig, Log, LogResponse, QueueEvent, RootFolder, SecurityConfig},
|
||||
};
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -238,6 +238,22 @@ pub struct LogResponse {
|
||||
pub records: Vec<Log>,
|
||||
}
|
||||
|
||||
#[derive(Default, Clone, Serialize, Deserialize, Debug, PartialEq, Eq)]
|
||||
pub struct MetadataProfile {
|
||||
#[serde(deserialize_with = "super::from_i64")]
|
||||
pub id: i64,
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
impl From<(&i64, &String)> for MetadataProfile {
|
||||
fn from(value: (&i64, &String)) -> Self {
|
||||
MetadataProfile {
|
||||
id: *value.0,
|
||||
name: value.1.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Default, Debug, Clone, PartialEq, Eq, Ord, PartialOrd)]
|
||||
pub struct Quality {
|
||||
pub name: String,
|
||||
@@ -277,6 +293,13 @@ pub struct QueueEvent {
|
||||
pub duration: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Default, Serialize, Debug, PartialEq, Eq, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ReleaseDownloadBody {
|
||||
pub guid: String,
|
||||
pub indexer_id: i64,
|
||||
}
|
||||
|
||||
#[derive(Default, Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct RootFolder {
|
||||
@@ -303,6 +326,13 @@ pub struct SecurityConfig {
|
||||
pub certificate_validation: CertificateValidation,
|
||||
}
|
||||
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct SystemStatus {
|
||||
pub version: String,
|
||||
pub start_time: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[derive(Default, Clone, Serialize, Deserialize, Debug, PartialEq, Eq)]
|
||||
pub struct Tag {
|
||||
#[serde(deserialize_with = "super::from_i64")]
|
||||
|
||||
@@ -17,7 +17,7 @@ use super::{
|
||||
HorizontallyScrollableText, Serdeable,
|
||||
servarr_models::{
|
||||
DiskSpace, HostConfig, Indexer, Language, LogResponse, QualityProfile, QualityWrapper,
|
||||
QueueEvent, RootFolder, SecurityConfig, Tag, Update,
|
||||
QueueEvent, RootFolder, SecurityConfig, SystemStatus, Tag, Update,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -626,10 +626,3 @@ serde_enum_from!(
|
||||
Value(Value),
|
||||
}
|
||||
);
|
||||
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct SystemStatus {
|
||||
pub version: String,
|
||||
pub start_time: DateTime<Utc>,
|
||||
}
|
||||
@@ -7,13 +7,14 @@ mod tests {
|
||||
Serdeable,
|
||||
servarr_models::{
|
||||
DiskSpace, HostConfig, Indexer, IndexerSettings, IndexerTestResult, Language, Log,
|
||||
LogResponse, QualityProfile, QueueEvent, RootFolder, SecurityConfig, Tag, Update,
|
||||
LogResponse, QualityProfile, QueueEvent, RootFolder, SecurityConfig, SystemStatus, Tag,
|
||||
Update,
|
||||
},
|
||||
sonarr_models::{
|
||||
AddSeriesSearchResult, BlocklistItem, BlocklistResponse, DownloadRecord, DownloadStatus,
|
||||
DownloadsResponse, Episode, EpisodeFile, Series, SeriesMonitor, SeriesStatus, SeriesType,
|
||||
SonarrHistoryEventType, SonarrHistoryItem, SonarrRelease, SonarrSerdeable, SonarrTask,
|
||||
SonarrTaskName, SystemStatus,
|
||||
SonarrTaskName,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::models::lidarr_models::LidarrReleaseDownloadBody;
|
||||
use crate::models::servarr_data::Notification;
|
||||
use crate::models::servarr_models::ReleaseDownloadBody;
|
||||
use crate::network::lidarr_network::LidarrEvent;
|
||||
use crate::network::network_tests::test_utils::{MockServarrApi, test_network};
|
||||
use pretty_assertions::assert_eq;
|
||||
@@ -9,7 +9,7 @@ mod tests {
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_handle_download_lidarr_release_event_uses_provided_params() {
|
||||
let params = LidarrReleaseDownloadBody {
|
||||
let params = ReleaseDownloadBody {
|
||||
guid: "1234".to_owned(),
|
||||
indexer_id: 2,
|
||||
};
|
||||
@@ -44,7 +44,7 @@ mod tests {
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_handle_download_lidarr_release_event_sets_failure_notification_on_error() {
|
||||
let params = LidarrReleaseDownloadBody {
|
||||
let params = ReleaseDownloadBody {
|
||||
guid: "1234".to_owned(),
|
||||
indexer_id: 2,
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::models::lidarr_models::LidarrReleaseDownloadBody;
|
||||
use crate::models::servarr_data::Notification;
|
||||
use crate::models::servarr_models::ReleaseDownloadBody;
|
||||
use crate::network::lidarr_network::LidarrEvent;
|
||||
use crate::network::{Network, RequestMethod};
|
||||
use anyhow::Result;
|
||||
@@ -17,9 +17,9 @@ mod lidarr_library_network_tests;
|
||||
impl Network<'_, '_> {
|
||||
pub(in crate::network::lidarr_network) async fn download_lidarr_release(
|
||||
&mut self,
|
||||
lidarr_release_download_body: LidarrReleaseDownloadBody,
|
||||
lidarr_release_download_body: ReleaseDownloadBody,
|
||||
) -> Result<Value> {
|
||||
let event = LidarrEvent::DownloadRelease(LidarrReleaseDownloadBody::default());
|
||||
let event = LidarrEvent::DownloadRelease(ReleaseDownloadBody::default());
|
||||
info!("Downloading Lidarr release with params: {lidarr_release_download_body:?}");
|
||||
|
||||
let request_props = self
|
||||
@@ -33,7 +33,7 @@ impl Network<'_, '_> {
|
||||
.await;
|
||||
|
||||
let result = self
|
||||
.handle_request::<LidarrReleaseDownloadBody, Value>(request_props, |_, mut app| {
|
||||
.handle_request::<ReleaseDownloadBody, Value>(request_props, |_, mut app| {
|
||||
app.notification = Some(Notification::new(
|
||||
"Download Result".to_owned(),
|
||||
"Download request sent successfully".to_owned(),
|
||||
|
||||
@@ -6,11 +6,12 @@ pub mod test_utils {
|
||||
AudioTags, BlocklistItem, BlocklistResponse, DownloadRecord, DownloadStatus, DownloadsResponse,
|
||||
EditArtistParams, LidarrHistoryData, LidarrHistoryEventType, LidarrHistoryItem,
|
||||
LidarrHistoryWrapper, LidarrRelease, LidarrTask, LidarrTaskName, MediaInfo, Member,
|
||||
MetadataProfile, NewItemMonitorType, Ratings, SystemStatus, Track, TrackFile,
|
||||
NewItemMonitorType, Ratings, Track, TrackFile,
|
||||
};
|
||||
use crate::models::servarr_models::IndexerSettings;
|
||||
use crate::models::servarr_models::{
|
||||
Indexer, IndexerField, Quality, QualityProfile, QualityWrapper, RootFolder, Tag,
|
||||
Indexer, IndexerField, MetadataProfile, Quality, QualityProfile, QualityWrapper, RootFolder,
|
||||
SystemStatus, Tag,
|
||||
};
|
||||
use crate::models::{HorizontallyScrollableText, ScrollableText};
|
||||
use bimap::BiMap;
|
||||
|
||||
@@ -2,10 +2,12 @@
|
||||
mod tests {
|
||||
use crate::app::App;
|
||||
use crate::models::lidarr_models::{
|
||||
AddArtistBody, DeleteParams, EditArtistParams, LidarrSerdeable, MetadataProfile,
|
||||
AddArtistBody, DeleteParams, EditArtistParams, LidarrSerdeable,
|
||||
};
|
||||
use crate::models::servarr_data::lidarr::modals::EditArtistModal;
|
||||
use crate::models::servarr_models::{EditIndexerParams, IndexerSettings, QualityProfile, Tag};
|
||||
use crate::models::servarr_models::{
|
||||
EditIndexerParams, IndexerSettings, MetadataProfile, QualityProfile, Tag,
|
||||
};
|
||||
use crate::network::network_tests::test_utils::{MockServarrApi, test_network};
|
||||
use crate::network::{NetworkEvent, NetworkResource, lidarr_network::LidarrEvent};
|
||||
use bimap::BiMap;
|
||||
|
||||
@@ -3,10 +3,12 @@ use log::info;
|
||||
|
||||
use super::{NetworkEvent, NetworkResource};
|
||||
use crate::models::lidarr_models::{
|
||||
AddArtistBody, AddLidarrRootFolderBody, DeleteParams, EditArtistParams,
|
||||
LidarrReleaseDownloadBody, LidarrSerdeable, LidarrTaskName, MetadataProfile,
|
||||
AddArtistBody, AddLidarrRootFolderBody, DeleteParams, EditArtistParams, LidarrSerdeable,
|
||||
LidarrTaskName,
|
||||
};
|
||||
use crate::models::servarr_models::{
|
||||
EditIndexerParams, IndexerSettings, MetadataProfile, QualityProfile, ReleaseDownloadBody, Tag,
|
||||
};
|
||||
use crate::models::servarr_models::{EditIndexerParams, IndexerSettings, QualityProfile, Tag};
|
||||
use crate::network::{Network, RequestMethod};
|
||||
|
||||
mod blocklist;
|
||||
@@ -39,7 +41,7 @@ pub enum LidarrEvent {
|
||||
DeleteRootFolder(i64),
|
||||
DeleteTag(i64),
|
||||
DeleteTrackFile(i64),
|
||||
DownloadRelease(LidarrReleaseDownloadBody),
|
||||
DownloadRelease(ReleaseDownloadBody),
|
||||
EditArtist(EditArtistParams),
|
||||
EditAllIndexerSettings(IndexerSettings),
|
||||
EditIndexer(EditIndexerParams),
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::models::HorizontallyScrollableText;
|
||||
use crate::models::lidarr_models::{LidarrSerdeable, LidarrTask, LidarrTaskName, SystemStatus};
|
||||
use crate::models::lidarr_models::{LidarrSerdeable, LidarrTask, LidarrTaskName};
|
||||
use crate::models::servarr_models::{
|
||||
DiskSpace, HostConfig, LogResponse, QueueEvent, SecurityConfig, Update,
|
||||
DiskSpace, HostConfig, LogResponse, QueueEvent, SecurityConfig, SystemStatus, Update,
|
||||
};
|
||||
use crate::network::lidarr_network::LidarrEvent;
|
||||
use crate::network::lidarr_network::lidarr_network_test_utils::test_utils::updates;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::models::lidarr_models::{LidarrTask, LidarrTaskName, SystemStatus};
|
||||
use crate::models::lidarr_models::{LidarrTask, LidarrTaskName};
|
||||
use crate::models::servarr_models::{
|
||||
CommandBody, DiskSpace, HostConfig, LogResponse, QueueEvent, SecurityConfig, Update,
|
||||
CommandBody, DiskSpace, HostConfig, LogResponse, QueueEvent, SecurityConfig, SystemStatus, Update,
|
||||
};
|
||||
use crate::models::{HorizontallyScrollableText, Scrollable, ScrollableText};
|
||||
use crate::network::lidarr_network::LidarrEvent;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::models::radarr_models::{RadarrTask, RadarrTaskName, SystemStatus};
|
||||
use crate::models::radarr_models::{RadarrTask, RadarrTaskName};
|
||||
use crate::models::servarr_models::{
|
||||
CommandBody, DiskSpace, HostConfig, LogResponse, QueueEvent, SecurityConfig, Update,
|
||||
CommandBody, DiskSpace, HostConfig, LogResponse, QueueEvent, SecurityConfig, SystemStatus, Update,
|
||||
};
|
||||
use crate::models::{HorizontallyScrollableText, Scrollable, ScrollableText};
|
||||
use crate::network::radarr_network::RadarrEvent;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::models::HorizontallyScrollableText;
|
||||
use crate::models::radarr_models::{RadarrSerdeable, RadarrTask, RadarrTaskName, SystemStatus};
|
||||
use crate::models::radarr_models::{RadarrSerdeable, RadarrTask, RadarrTaskName};
|
||||
use crate::models::servarr_models::{
|
||||
DiskSpace, HostConfig, LogResponse, QueueEvent, SecurityConfig, Update,
|
||||
DiskSpace, HostConfig, LogResponse, QueueEvent, SecurityConfig, SystemStatus, Update,
|
||||
};
|
||||
use crate::network::network_tests::test_utils::{MockServarrApi, test_network};
|
||||
use crate::network::radarr_network::RadarrEvent;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::models::servarr_models::{
|
||||
CommandBody, DiskSpace, HostConfig, LogResponse, QueueEvent, SecurityConfig, Update,
|
||||
CommandBody, DiskSpace, HostConfig, LogResponse, QueueEvent, SecurityConfig, SystemStatus, Update,
|
||||
};
|
||||
use crate::models::sonarr_models::{SonarrTask, SonarrTaskName, SystemStatus};
|
||||
use crate::models::sonarr_models::{SonarrTask, SonarrTaskName};
|
||||
use crate::models::{HorizontallyScrollableText, Scrollable, ScrollableText};
|
||||
use crate::network::sonarr_network::SonarrEvent;
|
||||
use crate::network::{Network, RequestMethod};
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
mod tests {
|
||||
use crate::models::HorizontallyScrollableText;
|
||||
use crate::models::servarr_models::{
|
||||
DiskSpace, HostConfig, LogResponse, QueueEvent, SecurityConfig, Update,
|
||||
DiskSpace, HostConfig, LogResponse, QueueEvent, SecurityConfig, SystemStatus, Update,
|
||||
};
|
||||
use crate::models::sonarr_models::{SonarrSerdeable, SonarrTask, SonarrTaskName, SystemStatus};
|
||||
use crate::models::sonarr_models::{SonarrSerdeable, SonarrTask, SonarrTaskName};
|
||||
use crate::network::network_tests::test_utils::{MockServarrApi, test_network};
|
||||
use crate::network::sonarr_network::SonarrEvent;
|
||||
use crate::network::sonarr_network::sonarr_network_test_utils::test_utils::updates;
|
||||
|
||||
Reference in new issue
Block a user