aboutsummaryrefslogtreecommitdiff
path: root/common/src
diff options
context:
space:
mode:
authortpart <tpart120@proton.me>2023-08-07 12:00:50 +0200
committertpart <tpart120@proton.me>2023-08-07 12:00:50 +0200
commit6e3c84c12b2182ff0e33c1447d94979358919148 (patch)
tree567a0b5b3662a8f36f4ce0f4a54025300858bf46 /common/src
parenteef08157290987437829db0c1bbc82183732b6b5 (diff)
parentb8d46141a13610f7451d7ad809691b0dd99b5f89 (diff)
downloadjellything-6e3c84c12b2182ff0e33c1447d94979358919148.tar
jellything-6e3c84c12b2182ff0e33c1447d94979358919148.tar.bz2
jellything-6e3c84c12b2182ff0e33c1447d94979358919148.tar.zst
Merge branch 'master' of codeberg.org:metamuffin/jellything
Diffstat (limited to 'common/src')
-rw-r--r--common/src/impl.rs8
-rw-r--r--common/src/lib.rs21
2 files changed, 13 insertions, 16 deletions
diff --git a/common/src/impl.rs b/common/src/impl.rs
index d7759af..55364ab 100644
--- a/common/src/impl.rs
+++ b/common/src/impl.rs
@@ -3,7 +3,7 @@
which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
Copyright (C) 2023 metamuffin <metamuffin.org>
*/
-use crate::{NodeKind, SourceTrack, SourceTrackKind};
+use crate::{SourceTrack, SourceTrackKind};
impl SourceTrackKind {
pub fn letter(&self) -> char {
@@ -34,9 +34,3 @@ impl std::fmt::Display for SourceTrack {
))
}
}
-
-impl Default for NodeKind {
- fn default() -> Self {
- Self::Collection
- }
-}
diff --git a/common/src/lib.rs b/common/src/lib.rs
index a96df9e..9d5a31e 100644
--- a/common/src/lib.rs
+++ b/common/src/lib.rs
@@ -7,6 +7,7 @@ pub mod config;
pub mod r#impl;
use bincode::{Decode, Encode};
+use rocket::{FromFormField, UriDisplayQuery};
use serde::{Deserialize, Serialize};
use std::path::PathBuf;
@@ -57,17 +58,19 @@ pub enum AssetLocation {
Assets(PathBuf),
}
-#[derive(Debug, Clone, Deserialize, Serialize)]
+#[rustfmt::skip]
+#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq, Default)]
+#[cfg_attr(feature = "rocket", derive(FromFormField, UriDisplayQuery))]
#[serde(rename_all = "snake_case")]
pub enum NodeKind {
- Movie,
- Video,
- Collection,
- Channel,
- Show,
- Series,
- Season,
- Episode,
+ #[cfg_attr(feature = "rocket", field(value = "movie"))] #[default] Movie,
+ #[cfg_attr(feature = "rocket", field(value = "video"))] Video,
+ #[cfg_attr(feature = "rocket", field(value = "collection"))] Collection,
+ #[cfg_attr(feature = "rocket", field(value = "channel"))] Channel,
+ #[cfg_attr(feature = "rocket", field(value = "show"))] Show,
+ #[cfg_attr(feature = "rocket", field(value = "series"))] Series,
+ #[cfg_attr(feature = "rocket", field(value = "season"))] Season,
+ #[cfg_attr(feature = "rocket", field(value = "episode"))] Episode,
}
#[derive(Debug, Clone, Deserialize, Serialize)]