aboutsummaryrefslogtreecommitdiff
path: root/stream/src/segment.rs
diff options
context:
space:
mode:
Diffstat (limited to 'stream/src/segment.rs')
-rw-r--r--stream/src/segment.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/stream/src/segment.rs b/stream/src/segment.rs
index ce3f8e1..309da1d 100644
--- a/stream/src/segment.rs
+++ b/stream/src/segment.rs
@@ -4,8 +4,12 @@
Copyright (C) 2023 metamuffin <metamuffin.org>
*/
use anyhow::{anyhow, bail, Result};
-use jellybase::{AssetLocationExt, CONF};
-use jellycommon::{stream::StreamSpec, LocalTrack, Node};
+use jellybase::{permission::PermissionSetExt, AssetLocationExt, CONF};
+use jellycommon::{
+ stream::StreamSpec,
+ user::{PermissionSet, UserPermission},
+ LocalTrack, Node,
+};
use jellytranscoder::snippet::transcode;
use log::warn;
use tokio::{fs::File, io::DuplexStream};
@@ -16,6 +20,7 @@ pub async fn segment_stream(
track_sources: Vec<LocalTrack>,
spec: StreamSpec,
mut b: DuplexStream,
+ perms: &PermissionSet,
) -> Result<()> {
if spec.tracks.len() != 1 {
bail!("unsupported number of tracks for segment, must be exactly one");
@@ -24,6 +29,7 @@ pub async fn segment_stream(
let n = spec.index.ok_or(anyhow!("segment index missing"))?;
if let Some(profile) = spec.profile {
+ perms.assert(&UserPermission::Transcode)?;
let location = transcode(
&format!("{track} {n} {:?}", node.private.source), // TODO maybe not use the entire source
CONF.transcoding_profiles