aboutsummaryrefslogtreecommitdiff
path: root/import/src/tmdb.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-01-24 18:11:23 +0100
committermetamuffin <metamuffin@disroot.org>2024-01-24 18:47:29 +0100
commit7323709537c6ff14136cd79fb07606cd79391758 (patch)
tree3d817d449d4c0a821b9b5073c8acf826c6ccfda1 /import/src/tmdb.rs
parentcbb2e163abfefd8ed61c41a096d5d6c27b4721b4 (diff)
downloadjellything-7323709537c6ff14136cd79fb07606cd79391758.tar
jellything-7323709537c6ff14136cd79fb07606cd79391758.tar.bz2
jellything-7323709537c6ff14136cd79fb07606cd79391758.tar.zst
refactor asset system pt. 1
Diffstat (limited to 'import/src/tmdb.rs')
-rw-r--r--import/src/tmdb.rs14
1 files changed, 5 insertions, 9 deletions
diff --git a/import/src/tmdb.rs b/import/src/tmdb.rs
index 5dbc335..3470b90 100644
--- a/import/src/tmdb.rs
+++ b/import/src/tmdb.rs
@@ -1,23 +1,19 @@
-use std::{fmt::Display, sync::Arc};
-
/*
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) 2023 metamuffin <metamuffin.org>
+ Copyright (C) 2024 metamuffin <metamuffin.org>
*/
use anyhow::{anyhow, bail, Context};
use bincode::{Decode, Encode};
-use jellybase::cache::{async_cache_file, async_cache_memory};
-use jellycommon::{
- chrono::{format::Parsed, Utc},
- AssetLocation,
-};
+use jellybase::cache::{async_cache_file, async_cache_memory, CachePath};
+use jellycommon::chrono::{format::Parsed, Utc};
use log::info;
use reqwest::{
header::{HeaderMap, HeaderName, HeaderValue},
Client, ClientBuilder,
};
use serde::Deserialize;
+use std::{fmt::Display, sync::Arc};
use tokio::io::AsyncWriteExt;
pub struct Tmdb {
@@ -99,7 +95,7 @@ impl Tmdb {
})
.await
}
- pub async fn image(&self, path: &str) -> anyhow::Result<AssetLocation> {
+ pub async fn image(&self, path: &str) -> anyhow::Result<CachePath> {
async_cache_file(&["api-tmdb-image", path], |mut file| async move {
info!("downloading image {path:?}");
let mut res = self