diff --git a/docker/Dockerfile b/docker/Dockerfile index 1d0042c5..349cde93 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -7,6 +7,7 @@ ENV DB=/db ENV SHARED_STORAGE=${SHARED_STORAGE} COPY README.md ffplayout-v${FFPLAYOUT_VERSION}_x86_64-unknown-linux-musl.tar.* /tmp/ +COPY scripts/run.sh / RUN apk update && \ apk upgrade && \ @@ -20,8 +21,6 @@ RUN [[ -f "/tmp/ffplayout-v${FFPLAYOUT_VERSION}_x86_64-unknown-linux-musl.tar.gz rm -rf /tmp/* && \ mkdir ${DB} -RUN ffplayout -u admin -p admin -m contact@example.com --storage-path "/tv-media" --playlist-path "/playlists" --hls-path "/hls" --log-path "/logging" - EXPOSE 8787 -CMD ["/usr/bin/ffplayout", "-l", "0.0.0.0:8787"] +CMD ["/run.sh"] diff --git a/docker/nonfree.Dockerfile b/docker/nonfree.Dockerfile index 5f1104c2..4ace3a0f 100644 --- a/docker/nonfree.Dockerfile +++ b/docker/nonfree.Dockerfile @@ -9,6 +9,7 @@ ENV SHARED_STORAGE=${SHARED_STORAGE} COPY --from=ffmpeg-build /usr/local/bin/ffmpeg /usr/local/bin/ffmpeg COPY --from=ffmpeg-build /usr/local/bin/ffprobe /usr/local/bin/ffprobe COPY README.md ffplayout-v${FFPLAYOUT_VERSION}_x86_64-unknown-linux-musl.tar.* /tmp/ +COPY scripts/run.sh / RUN apk update && \ apk upgrade && \ @@ -22,8 +23,6 @@ RUN [[ -f "/tmp/ffplayout-v${FFPLAYOUT_VERSION}_x86_64-unknown-linux-musl.tar.gz rm -rf /tmp/* && \ mkdir ${DB} -RUN ffplayout -u admin -p admin -m contact@example.com --storage-path "/tv-media" --playlist-path "/playlists" --hls-path "/hls" --log-path "/logging" - EXPOSE 8787 -CMD ["/usr/bin/ffplayout", "-l", "0.0.0.0:8787"] +CMD ["/run.sh"] diff --git a/docker/nvidia.Dockerfile b/docker/nvidia.Dockerfile index 274ee609..8920efd0 100644 --- a/docker/nvidia.Dockerfile +++ b/docker/nvidia.Dockerfile @@ -199,6 +199,7 @@ ENV DB=/db ENV SHARED_STORAGE=${SHARED_STORAGE} COPY README.md ffplayout-v${FFPLAYOUT_VERSION}_x86_64-unknown-linux-musl.tar.* /tmp/ +COPY scripts/run.sh / RUN [[ -f "/tmp/ffplayout-v${FFPLAYOUT_VERSION}_x86_64-unknown-linux-musl.tar.gz" ]] || \ wget -q "https://github.com/ffplayout/ffplayout/releases/download/v${FFPLAYOUT_VERSION}/ffplayout-v${FFPLAYOUT_VERSION}_x86_64-unknown-linux-musl.tar.gz" -P /tmp/ && \ @@ -208,8 +209,6 @@ RUN [[ -f "/tmp/ffplayout-v${FFPLAYOUT_VERSION}_x86_64-unknown-linux-musl.tar.gz rm -rf /tmp/* && \ mkdir ${DB} -RUN ffplayout -u admin -p admin -m contact@example.com --storage-path "/tv-media" --playlist-path "/playlists" --hls-path "/hls" --log-path "/logging" - EXPOSE 8787 -CMD ["/usr/bin/ffplayout", "-l", "0.0.0.0:8787"] +CMD ["/run.sh"] diff --git a/ffplayout/src/utils/config.rs b/ffplayout/src/utils/config.rs index 70e4a152..9966f721 100644 --- a/ffplayout/src/utils/config.rs +++ b/ffplayout/src/utils/config.rs @@ -406,6 +406,8 @@ impl Playlist { #[derive(Debug, Default, Clone, Deserialize, Serialize)] pub struct Storage { pub help_text: String, + #[serde(skip_deserializing)] + pub path: PathBuf, #[serde(skip_serializing, skip_deserializing)] pub paths: Vec, pub filler: PathBuf, @@ -414,9 +416,10 @@ pub struct Storage { } impl Storage { - fn new(config: &models::Configuration) -> Self { + fn new(config: &models::Configuration, path: PathBuf) -> Self { Self { help_text: config.storage_help.clone(), + path, paths: vec![], filler: PathBuf::from(config.storage_filler.clone()), extensions: config @@ -564,7 +567,6 @@ impl PlayoutConfig { let mut processing = Processing::new(&config); let mut ingest = Ingest::new(&config); let mut playlist = Playlist::new(&config); - let mut storage = Storage::new(&config); let mut text = Text::new(&config); let task = Task::new(&config); let mut output = Output::new(&config); @@ -579,6 +581,8 @@ impl PlayoutConfig { .expect("Can't create storage folder"); } + let mut storage = Storage::new(&config, global.storage_path.clone()); + if channel_id > 1 || !global.shared_storage { global.playlist_path = global.playlist_path.join(channel_id.to_string()); global.hls_path = global.hls_path.join(channel_id.to_string()); diff --git a/frontend b/frontend index 18518dd5..c0d6f02d 160000 --- a/frontend +++ b/frontend @@ -1 +1 @@ -Subproject commit 18518dd53acb2b78c2bf7f3ac199f038fc225fd9 +Subproject commit c0d6f02d739f8554cf3a6c4ee090f8b346b26e31 diff --git a/scripts/run.sh b/scripts/run.sh new file mode 100755 index 00000000..732bda0d --- /dev/null +++ b/scripts/run.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +if [ ! -f /db/ffplayout.db ]; then + ffplayout -u admin -p admin -m contact@example.com --storage-path "/tv-media" --playlist-path "/playlists" --hls-path "/hls" --log-path "/logging" --shared-storage +fi + +/usr/bin/ffplayout -l "0.0.0.0:8787"