diff options
Diffstat (limited to 'import/src/tmdb.rs')
| -rw-r--r-- | import/src/tmdb.rs | 33 |
1 files changed, 18 insertions, 15 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) } |