feat(ui): Sonarr support for viewing season details

This commit is contained in:
2024-12-10 18:23:09 -07:00
parent 7bf3311102
commit e9a30382a3
14 changed files with 737 additions and 92 deletions
+52 -1
View File
@@ -107,7 +107,7 @@ pub struct DeleteSeriesParams {
#[serde(rename_all = "camelCase")]
pub struct DownloadRecord {
pub title: String,
pub status: String,
pub status: DownloadStatus,
#[serde(deserialize_with = "super::from_i64")]
pub id: i64,
#[serde(deserialize_with = "super::from_i64")]
@@ -124,6 +124,57 @@ pub struct DownloadRecord {
impl Eq for DownloadRecord {}
#[derive(Serialize, Deserialize, Default, PartialEq, Eq, Clone, Copy, Debug, EnumIter)]
#[serde(rename_all = "camelCase")]
pub enum DownloadStatus {
#[default]
Unknown,
Queued,
Paused,
Downloading,
Completed,
Failed,
Warning,
Delay,
DownloadClientUnavailable,
Fallback,
}
impl Display for DownloadStatus {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let download_status = match self {
DownloadStatus::Unknown => "unknown",
DownloadStatus::Queued => "queued",
DownloadStatus::Paused => "paused",
DownloadStatus::Downloading => "downloading",
DownloadStatus::Completed => "completed",
DownloadStatus::Failed => "failed",
DownloadStatus::Warning => "warning",
DownloadStatus::Delay => "delay",
DownloadStatus::DownloadClientUnavailable => "downloadClientUnavailable",
DownloadStatus::Fallback => "fallback",
};
write!(f, "{download_status}")
}
}
impl<'a> EnumDisplayStyle<'a> for DownloadStatus {
fn to_display_str(self) -> &'a str {
match self {
DownloadStatus::Unknown => "Unknown",
DownloadStatus::Queued => "Queued",
DownloadStatus::Paused => "Paused",
DownloadStatus::Downloading => "Downloading",
DownloadStatus::Completed => "Completed",
DownloadStatus::Failed => "Failed",
DownloadStatus::Warning => "Warning",
DownloadStatus::Delay => "Delay",
DownloadStatus::DownloadClientUnavailable => "Download Client Unavailable",
DownloadStatus::Fallback => "Fallback",
}
}
}
#[derive(Default, Clone, Serialize, Deserialize, Debug, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct DownloadsResponse {