diff options
Diffstat (limited to 'common/src')
-rw-r--r-- | common/src/config.rs | 2 | ||||
-rw-r--r-- | common/src/lib.rs | 52 |
2 files changed, 54 insertions, 0 deletions
diff --git a/common/src/config.rs b/common/src/config.rs index 4e90cf0..d9f2a8e 100644 --- a/common/src/config.rs +++ b/common/src/config.rs @@ -46,9 +46,11 @@ pub struct FederationAccount { #[serde(default = "return_true")] pub tls: bool, } + #[derive(Serialize, Deserialize, Debug)] pub struct ApiSecrets { pub tmdb: Option<String>, + pub tvdb: Option<String>, pub imdb: Option<String>, pub omdb: Option<String>, pub fanart_tv: Option<String>, diff --git a/common/src/lib.rs b/common/src/lib.rs index 5387679..57b210b 100644 --- a/common/src/lib.rs +++ b/common/src/lib.rs @@ -67,6 +67,10 @@ pub enum ImportSource { Tmdb { id: u64, }, + Trakt { + kind: TraktKind, + id: u64, + }, AutoChildren { path: Option<PathBuf>, }, @@ -163,6 +167,7 @@ pub enum Rating { YoutubeViews, YoutubeLikes, YoutubeFollowers, + Trakt, } #[derive(Debug, Clone, Deserialize, Serialize, Encode, Decode)] @@ -188,3 +193,50 @@ pub enum AssetRole { #[cfg_attr(feature = "rocket", field(value = "poster"))] Poster, #[cfg_attr(feature = "rocket", field(value = "backdrop"))] Backdrop, } + +#[derive(Debug, Serialize, Deserialize, Clone, Copy, Encode, Decode)] +#[serde(rename_all = "snake_case")] +pub enum TraktKind { + Movie, + Show, + Season, + Episode, + Person, + User, +} + +impl TraktKind { + pub fn singular(self) -> &'static str { + match self { + TraktKind::Movie => "movie", + TraktKind::Show => "show", + TraktKind::Season => "season", + TraktKind::Episode => "episode", + TraktKind::Person => "person", + TraktKind::User => "user", + } + } + pub fn plural(self) -> &'static str { + match self { + TraktKind::Movie => "movies", + TraktKind::Show => "shows", + TraktKind::Season => "seasons", + TraktKind::Episode => "episodes", + TraktKind::Person => "people", + TraktKind::User => "users", // //! not used in API + } + } +} +impl ToString for TraktKind { + fn to_string(&self) -> String { + match self { + TraktKind::Movie => "Movie", + TraktKind::Show => "Show", + TraktKind::Season => "Season", + TraktKind::Episode => "Episode", + TraktKind::Person => "Person", + TraktKind::User => "User", + } + .to_string() + } +} |