diff options
Diffstat (limited to 'import/src')
-rw-r--r-- | import/src/acoustid.rs | 12 | ||||
-rw-r--r-- | import/src/musicbrainz.rs | 27 | ||||
-rw-r--r-- | import/src/tmdb.rs | 19 |
3 files changed, 28 insertions, 30 deletions
diff --git a/import/src/acoustid.rs b/import/src/acoustid.rs index 741d491..cbdfc7a 100644 --- a/import/src/acoustid.rs +++ b/import/src/acoustid.rs @@ -12,7 +12,7 @@ use reqwest::{ header::{HeaderMap, HeaderName, HeaderValue}, Client, ClientBuilder, }; -use serde::Deserialize; +use serde::{Deserialize, Serialize}; use std::{path::Path, process::Stdio, sync::Arc, time::Duration}; use tokio::{ io::AsyncReadExt, @@ -27,30 +27,30 @@ pub(crate) struct AcoustID { rate_limit: Arc<Semaphore>, } -#[derive(Debug, Hash, Clone, Encode, Decode)] +#[derive(Debug, Hash, Clone, Serialize, Deserialize)] pub(crate) struct Fingerprint { duration: u32, fingerprint: String, } -#[derive(Debug, Deserialize)] +#[derive(Debug, Serialize, Deserialize)] pub(crate) struct FpCalcOutput { duration: f32, fingerprint: String, } -#[derive(Deserialize, Encode, Decode)] +#[derive(Serialize, Deserialize, Encode, Decode)] pub(crate) struct AcoustIDLookupResultRecording { id: String, } -#[derive(Deserialize, Encode, Decode)] +#[derive(Serialize, Deserialize, Encode, Decode)] pub(crate) struct AcoustIDLookupResult { id: String, score: f32, #[serde(default)] recordings: Vec<AcoustIDLookupResultRecording>, } -#[derive(Deserialize, Encode, Decode)] +#[derive(Serialize, Deserialize, Encode, Decode)] pub(crate) struct AcoustIDLookupResponse { status: String, results: Vec<AcoustIDLookupResult>, diff --git a/import/src/musicbrainz.rs b/import/src/musicbrainz.rs index 612c4ba..e4f38da 100644 --- a/import/src/musicbrainz.rs +++ b/import/src/musicbrainz.rs @@ -6,14 +6,13 @@ use crate::USER_AGENT; use anyhow::{Context, Result}; -use bincode::{Decode, Encode}; use jellycache::async_cache_memory; use log::info; use reqwest::{ header::{HeaderMap, HeaderName, HeaderValue}, Client, ClientBuilder, }; -use serde::Deserialize; +use serde::{Deserialize, Serialize}; use std::{collections::BTreeMap, sync::Arc, time::Duration}; use tokio::{ sync::Semaphore, @@ -40,7 +39,7 @@ pub struct MusicBrainz { rate_limit: Arc<Semaphore>, } -#[derive(Debug, Deserialize, Encode, Decode)] +#[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "kebab-case")] pub struct MbRecordingRel { pub id: String, @@ -54,7 +53,7 @@ pub struct MbRecordingRel { pub artist_credit: Vec<MbArtistCredit>, } -#[derive(Debug, Deserialize, Encode, Decode)] +#[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "kebab-case")] pub struct MbArtistRel { pub id: String, @@ -72,14 +71,14 @@ pub struct MbArtistRel { pub relations: Vec<MbRelation>, } -#[derive(Debug, Deserialize, Encode, Decode)] +#[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "kebab-case")] pub struct MbArtistCredit { pub name: String, pub artist: MbArtist, } -#[derive(Debug, Deserialize, Encode, Decode)] +#[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "kebab-case")] pub struct MbRelation { pub direction: String, @@ -103,7 +102,7 @@ pub struct MbRelation { pub event: Option<MbEvent>, } -#[derive(Debug, Deserialize, Encode, Decode)] +#[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "kebab-case")] pub struct MbSeries { pub id: String, @@ -113,7 +112,7 @@ pub struct MbSeries { pub disambiguation: String, } -#[derive(Debug, Deserialize, Encode, Decode)] +#[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "kebab-case")] pub struct MbRecording { pub id: String, @@ -127,7 +126,7 @@ pub struct MbRecording { pub artist_credit: Vec<MbArtistCredit>, } -#[derive(Debug, Deserialize, Encode, Decode)] +#[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "kebab-case")] pub struct MbWork { pub id: String, @@ -141,7 +140,7 @@ pub struct MbWork { pub disambiguation: String, } -#[derive(Debug, Deserialize, Encode, Decode)] +#[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "kebab-case")] pub struct MbEvent { pub id: String, @@ -154,7 +153,7 @@ pub struct MbEvent { pub life_span: MbTimespan, } -#[derive(Debug, Deserialize, Encode, Decode)] +#[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "kebab-case")] pub struct MbArtist { pub id: String, @@ -166,7 +165,7 @@ pub struct MbArtist { pub sort_name: String, } -#[derive(Debug, Deserialize, Encode, Decode)] +#[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "kebab-case")] pub struct MbTimespan { pub begin: Option<String>, @@ -174,7 +173,7 @@ pub struct MbTimespan { pub ended: bool, } -#[derive(Debug, Deserialize, Encode, Decode)] +#[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "kebab-case")] pub struct MbArea { pub name: String, @@ -185,7 +184,7 @@ pub struct MbArea { pub disambiguation: String, } -#[derive(Debug, Deserialize, Encode, Decode)] +#[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "kebab-case")] pub struct MbUrl { pub id: String, diff --git a/import/src/tmdb.rs b/import/src/tmdb.rs index ceb1650..ad99fde 100644 --- a/import/src/tmdb.rs +++ b/import/src/tmdb.rs @@ -5,7 +5,6 @@ */ use crate::USER_AGENT; use anyhow::{anyhow, bail, Context}; -use bincode::{Decode, Encode}; use jellycache::{async_cache_file, async_cache_memory, CachePath}; use jellycommon::{ chrono::{format::Parsed, Utc}, @@ -16,7 +15,7 @@ use reqwest::{ header::{HeaderMap, HeaderName, HeaderValue}, Client, ClientBuilder, }; -use serde::Deserialize; +use serde::{Deserialize, Serialize}; use std::sync::Arc; use tokio::io::AsyncWriteExt; @@ -165,7 +164,7 @@ pub fn parse_release_date(d: &str) -> anyhow::Result<Option<i64>> { Ok(Some(p.to_datetime_with_timezone(&Utc)?.timestamp_millis())) } -#[derive(Debug, Clone, Deserialize, Encode, Decode)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct TmdbEpisode { pub air_date: String, pub overview: String, @@ -177,12 +176,12 @@ pub struct TmdbEpisode { pub vote_count: usize, } -#[derive(Debug, Clone, Deserialize, Encode, Decode)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct TmdbPersonImage { pub id: u64, pub profiles: Vec<TmdbPersonImageProfile>, } -#[derive(Debug, Clone, Deserialize, Encode, Decode)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct TmdbPersonImageProfile { pub aspect_ratio: f64, pub height: u32, @@ -190,7 +189,7 @@ pub struct TmdbPersonImageProfile { pub file_path: String, } -#[derive(Debug, Clone, Deserialize, Encode, Decode)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct TmdbQuery { pub page: usize, pub results: Vec<TmdbQueryResult>, @@ -198,7 +197,7 @@ pub struct TmdbQuery { pub total_results: usize, } -#[derive(Debug, Clone, Deserialize, Encode, Decode)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct TmdbQueryResult { pub adult: bool, pub backdrop_path: Option<String>, @@ -216,7 +215,7 @@ pub struct TmdbQueryResult { pub vote_count: usize, } -#[derive(Debug, Clone, Deserialize, Encode, Decode)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct TmdbDetails { pub adult: bool, pub backdrop_path: Option<String>, @@ -240,13 +239,13 @@ pub struct TmdbDetails { pub tagline: Option<String>, } -#[derive(Debug, Clone, Deserialize, Encode, Decode)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct TmdbGenre { pub id: u64, pub name: String, } -#[derive(Debug, Clone, Deserialize, Encode, Decode)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct TmdbProductionCompany { pub id: u64, pub name: String, |