diff options
author | metamuffin <metamuffin@disroot.org> | 2025-02-03 22:42:13 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-02-03 22:42:13 +0100 |
commit | e43dc75e3cfb950ac0d0308900c20fa292de0c46 (patch) | |
tree | fce989ad0292328166efede8cfb2b769c370ab24 /server/src/routes/external_compat.rs | |
parent | 11c5be29987912b89fd6d351938d08fe6a561ad2 (diff) | |
download | jellything-e43dc75e3cfb950ac0d0308900c20fa292de0c46.tar jellything-e43dc75e3cfb950ac0d0308900c20fa292de0c46.tar.bz2 jellything-e43dc75e3cfb950ac0d0308900c20fa292de0c46.tar.zst |
some jellyfin api endpoints
Diffstat (limited to 'server/src/routes/external_compat.rs')
-rw-r--r-- | server/src/routes/external_compat.rs | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/server/src/routes/external_compat.rs b/server/src/routes/external_compat.rs deleted file mode 100644 index eda3537..0000000 --- a/server/src/routes/external_compat.rs +++ /dev/null @@ -1,45 +0,0 @@ -/* - This file is part of jellything (https://codeberg.org/metamuffin/jellything) - which is licensed under the GNU Affero General Public License (version 3); see /COPYING. - Copyright (C) 2025 metamuffin <metamuffin.org> -*/ -use super::ui::{account::session::Session, error::MyResult}; -use crate::routes::ui::node::rocket_uri_macro_r_library_node; -use crate::routes::ui::player::{rocket_uri_macro_r_player, PlayerConfig}; -use anyhow::anyhow; -use jellybase::database::Database; -use rocket::{get, response::Redirect, State}; - -#[get("/watch?<v>")] -pub fn r_ext_youtube_watch(_session: Session, db: &State<Database>, v: &str) -> MyResult<Redirect> { - if v.len() != 11 { - Err(anyhow!("video id length incorrect"))? - } - let Some(id) = db.get_node_external_id("youtube:video", v)? else { - Err(anyhow!("element not found"))? - }; - let node = db.get_node(id)?.ok_or(anyhow!("node missing"))?; - Ok(Redirect::to(rocket::uri!(r_player( - &node.slug, - PlayerConfig::default() - )))) -} - -#[get("/channel/<id>")] -pub fn r_ext_youtube_channel( - _session: Session, - db: &State<Database>, - id: &str, -) -> MyResult<Redirect> { - let Some(id) = (if id.starts_with("UC") { - db.get_node_external_id("youtube:channel", id)? - } else if id.starts_with("@") { - db.get_node_external_id("youtube:channel-name", id)? - } else { - Err(anyhow!("unknown channel id format"))? - }) else { - Err(anyhow!("channel not found"))? - }; - let node = db.get_node(id)?.ok_or(anyhow!("node missing"))?; - Ok(Redirect::to(rocket::uri!(r_library_node(&node.slug)))) -} |