aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-01-23 04:16:00 +0100
committermetamuffin <metamuffin@disroot.org>2024-01-23 04:16:00 +0100
commite5712e82b369019457cf738a70ae97c67388cbc4 (patch)
treea3ab191ba5bfd1c900aaabb7e8535624630b7310
parent0318a9f925f2507200a5b9b714f20560b770d7b0 (diff)
downloadjellything-e5712e82b369019457cf738a70ae97c67388cbc4.tar
jellything-e5712e82b369019457cf738a70ae97c67388cbc4.tar.bz2
jellything-e5712e82b369019457cf738a70ae97c67388cbc4.tar.zst
comments and minor changes
-rw-r--r--common/src/lib.rs16
-rw-r--r--import/src/tmdb.rs2
-rw-r--r--import/src/trakt.rs6
-rw-r--r--server/src/routes/ui/error.rs2
-rw-r--r--tool/src/add.rs2
-rw-r--r--transcoder/src/subtitles.rs2
6 files changed, 19 insertions, 11 deletions
diff --git a/common/src/lib.rs b/common/src/lib.rs
index d61532c..e61bdb9 100644
--- a/common/src/lib.rs
+++ b/common/src/lib.rs
@@ -293,20 +293,22 @@ impl ToString for TraktKind {
}
impl Display for ObjectIds {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
- f.write_str("trakt")?;
- if self.slug.is_some() {
+ if let Some(id) = self.trakt {
+ f.write_fmt(format_args!("trakt={}", id))?;
+ }
+ if let Some(_id) = &self.slug {
f.write_str(",slug")?;
}
- if self.tmdb.is_some() {
- f.write_str(",tmdb")?;
+ if let Some(id) = self.tmdb {
+ f.write_fmt(format_args!(",tmdb={}", id))?;
}
- if self.imdb.is_some() {
+ if let Some(_id) = &self.imdb {
f.write_str(",imdb")?;
}
- if self.tvdb.is_some() {
+ if let Some(_id) = &self.tvdb {
f.write_str(",tvdb")?;
}
- if self.omdb.is_some() {
+ if let Some(_id) = &self.omdb {
f.write_str(",omdb")?;
}
Ok(())
diff --git a/import/src/tmdb.rs b/import/src/tmdb.rs
index c349edf..5dbc335 100644
--- a/import/src/tmdb.rs
+++ b/import/src/tmdb.rs
@@ -51,7 +51,7 @@ impl Tmdb {
.client
.get(&format!(
"https://api.themoviedb.org/3/search/{kind}?query={}?api_key={}",
- query.replace(" ", "+"),
+ query.replace(" ", "+"), // TODO this is horrible, please find a proper urlencoding library that supports + for space
self.key
))
.send()
diff --git a/import/src/trakt.rs b/import/src/trakt.rs
index 1d7b8f7..08962c6 100644
--- a/import/src/trakt.rs
+++ b/import/src/trakt.rs
@@ -185,7 +185,7 @@ pub enum TraktPeopleGroup {
Art,
#[serde(rename = "crew")]
Crew,
- #[serde(rename = "costume & make-up")]
+ #[serde(rename = "costume & make-up")] //? they really use that in as a key?!
CostumeMakeup,
#[serde(rename = "directing")]
Directing,
@@ -258,10 +258,10 @@ pub struct TraktMediaObject {
impl Display for TraktSearchResult {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_fmt(format_args!(
- "{}: {} ({}) \x1b[2m[{}]\x1b[0m",
- self.r#type.to_string(),
+ "{} ({}) \x1b[2m{} [{}]\x1b[0m",
self.inner.inner().title,
self.inner.inner().year.unwrap_or(0),
+ self.r#type.to_string(),
self.inner.inner().ids
))
}
diff --git a/server/src/routes/ui/error.rs b/server/src/routes/ui/error.rs
index c0685e1..d111041 100644
--- a/server/src/routes/ui/error.rs
+++ b/server/src/routes/ui/error.rs
@@ -48,6 +48,8 @@ pub fn r_api_catch<'a>(status: Status, _request: &Request) -> Value {
pub type MyResult<T> = Result<T, MyError>;
+// TODO an actual error enum would be useful for status codes
+
pub struct MyError(pub anyhow::Error);
impl<'r> Responder<'r, 'static> for MyError {
diff --git a/tool/src/add.rs b/tool/src/add.rs
index 279574f..3cf13fd 100644
--- a/tool/src/add.rs
+++ b/tool/src/add.rs
@@ -63,6 +63,7 @@ pub(crate) async fn add(action: Action) -> anyhow::Result<()> {
let target_dir_index = FuzzySelect::with_theme(&theme)
.items(&directories)
.default(default)
+ .with_prompt("Library Path")
.interact()
.unwrap();
directories[target_dir_index].0.clone()
@@ -138,6 +139,7 @@ pub(crate) async fn add(action: Action) -> anyhow::Result<()> {
if Confirm::with_theme(&theme)
.with_prompt(format!("Write {:?}?", ypath))
+ .default(true)
.interact()
.unwrap()
{
diff --git a/transcoder/src/subtitles.rs b/transcoder/src/subtitles.rs
index 61f8cbc..11ed2a4 100644
--- a/transcoder/src/subtitles.rs
+++ b/transcoder/src/subtitles.rs
@@ -6,6 +6,8 @@
use anyhow::anyhow;
use std::fmt::Write;
+// TODO discontinued for now. since this should be snippetized aswell.
+
pub fn webvtt_from_ass_blocks(
title: String,
_codec_private: Vec<u8>,