aboutsummaryrefslogtreecommitdiff
path: root/transcoder/src
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2023-10-02 11:25:15 +0200
committermetamuffin <metamuffin@disroot.org>2023-10-02 11:25:15 +0200
commit50b66f818d3d890e2ee13c88c404031faaeea7ba (patch)
treec467d65450304e617854e55e87e2515bc2fcea9f /transcoder/src
parent1a0463e1770561f1041e1cffdbbae9b468531c55 (diff)
downloadjellything-50b66f818d3d890e2ee13c88c404031faaeea7ba.tar
jellything-50b66f818d3d890e2ee13c88c404031faaeea7ba.tar.bz2
jellything-50b66f818d3d890e2ee13c88c404031faaeea7ba.tar.zst
tempfile
Diffstat (limited to 'transcoder/src')
-rw-r--r--transcoder/src/lib.rs1
-rw-r--r--transcoder/src/snippet.rs30
2 files changed, 31 insertions, 0 deletions
diff --git a/transcoder/src/lib.rs b/transcoder/src/lib.rs
index 010a7dd..167303d 100644
--- a/transcoder/src/lib.rs
+++ b/transcoder/src/lib.rs
@@ -5,3 +5,4 @@
*/
#![feature(async_closure)]
pub mod image;
+pub mod snippet;
diff --git a/transcoder/src/snippet.rs b/transcoder/src/snippet.rs
new file mode 100644
index 0000000..c7033d8
--- /dev/null
+++ b/transcoder/src/snippet.rs
@@ -0,0 +1,30 @@
+/*
+ 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>
+*/
+
+use jellybase::{cache::async_cache_file, AssetLocationExt};
+use jellycommon::AssetLocation;
+
+pub async fn transcode(
+ asset: AssetLocation,
+ quality: f32,
+ speed: u8,
+ width: usize,
+) -> anyhow::Result<AssetLocation> {
+ let original_path = asset.path();
+ let asset = asset.clone();
+ Ok(async_cache_file(
+ &[
+ "snip-tc",
+ original_path.as_os_str().to_str().unwrap(),
+ &format!("{width} {quality} {speed}"),
+ ],
+ move |output| async move {
+
+ Ok(())
+ },
+ )
+ .await?)
+}