aboutsummaryrefslogtreecommitdiff
path: root/import
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-12-09 16:23:21 +0100
committermetamuffin <metamuffin@disroot.org>2025-12-09 16:23:21 +0100
commit242d5763d451eed2402be7afde50cd9fa0d6bc79 (patch)
treeb16e4a3df790a498b7b44a6087dd203a0ba4b7e7 /import
parent6edf0fd93abf7e58b4c0974e3d3e54bcf8517946 (diff)
downloadjellything-new-model.tar
jellything-new-model.tar.bz2
jellything-new-model.tar.zst
fix cache name escape bugsnew-model
Diffstat (limited to 'import')
-rw-r--r--import/src/tmdb.rs33
-rw-r--r--import/src/trakt.rs2
2 files changed, 19 insertions, 16 deletions
diff --git a/import/src/tmdb.rs b/import/src/tmdb.rs
index 219c1f6..3d6e832 100644
--- a/import/src/tmdb.rs
+++ b/import/src/tmdb.rs
@@ -5,7 +5,7 @@
*/
use crate::USER_AGENT;
use anyhow::{anyhow, bail, Context, Result};
-use jellycache::{cache_memory, cache_store, HashKey};
+use jellycache::{cache_memory, cache_store, EscapeKey, HashKey};
use jellycommon::{
chrono::{format::Parsed, Utc},
Asset,
@@ -108,20 +108,23 @@ impl Tmdb {
.context("tmdb person images")
}
pub fn image(&self, path: &str, rt: &Handle) -> Result<Asset> {
- cache_store(format!("ext/tmdb/image/{path}.json"), move || {
- rt.block_on(async {
- info!("downloading image {path:?}");
- Ok(self
- .image_client
- .get(format!("https://image.tmdb.org/t/p/original{path}"))
- .send()
- .await?
- .error_for_status()?
- .bytes()
- .await?
- .to_vec())
- })
- })
+ cache_store(
+ format!("ext/tmdb/image/{}.image", EscapeKey(path)),
+ move || {
+ rt.block_on(async {
+ info!("downloading image {path:?}");
+ Ok(self
+ .image_client
+ .get(format!("https://image.tmdb.org/t/p/original{path}"))
+ .send()
+ .await?
+ .error_for_status()?
+ .bytes()
+ .await?
+ .to_vec())
+ })
+ },
+ )
.context("tmdb image download")
.map(Asset)
}
diff --git a/import/src/trakt.rs b/import/src/trakt.rs
index a241725..270c589 100644
--- a/import/src/trakt.rs
+++ b/import/src/trakt.rs
@@ -101,7 +101,7 @@ impl Trakt {
}
pub fn show_seasons(&self, id: u64, rt: &Handle) -> Result<Arc<Vec<TraktSeason>>> {
- cache_memory(&format!("ext/trakt/seasons/{id}"), move || {
+ cache_memory(&format!("ext/trakt/seasons/{id}.json"), move || {
rt.block_on(async {
info!("trakt seasons {id:?}");
let url = format!("https://api.trakt.tv/shows/{id}/seasons?extended=full");