diff --git a/docker/Dockerfile b/docker/Dockerfile index 0feccbf0..81f356bb 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,6 +1,6 @@ FROM alpine:latest -ARG FFPLAYOUT_VERSION=0.24.0-beta1 +ARG FFPLAYOUT_VERSION=0.24.0-beta2 ARG SHARED_STORAGE=false ENV DB=/db @@ -12,7 +12,7 @@ COPY <<-EOT /run.sh #!/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 + ffplayout -u admin -p admin -m contact@example.com --storage-root "/tv-media" --playlist-root "/playlists" --public-root "/public" --log-path "/logging" --shared-storage fi /usr/bin/ffplayout -l "0.0.0.0:8787" diff --git a/docker/README.md b/docker/README.md index 71a13e37..3d023f06 100644 --- a/docker/README.md +++ b/docker/README.md @@ -39,7 +39,7 @@ docker build -f nvidia.Dockerfile -t ffplayout-image:nvidia . example of command to start the container: ```BASH -docker run -it -v /path/to/db:/db -v /path/to/storage:/tv-media -v /path/to/playlists:/playlists -v /path/to/hls:/hls -v /path/to/logging:/logging --name ffplayout -p 8787:8787 ffplayout-image +docker run -it -v /path/to/db:/db -v /path/to/storage:/tv-media -v /path/to/playlists:/playlists -v /path/to/public:/public -v /path/to/logging:/logging --name ffplayout -p 8787:8787 ffplayout-image # run in daemon mode docker run -d --name ffplayout -p 8787:8787 ffplayout-image diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 2def622b..9bb197e1 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -11,6 +11,6 @@ services: - ./data/storage:/tv-media - ./data/playlists:/playlists - ./data/logging:/logging - - ./data/hls:/hls + - ./data/public:/public ports: - '8787:8787' diff --git a/docker/nonfree.Dockerfile b/docker/nonfree.Dockerfile index d568bb4e..88c955d1 100644 --- a/docker/nonfree.Dockerfile +++ b/docker/nonfree.Dockerfile @@ -1,6 +1,6 @@ FROM alpine:latest -ARG FFPLAYOUT_VERSION=0.24.0-beta1 +ARG FFPLAYOUT_VERSION=0.24.0-beta2 ARG SHARED_STORAGE=false ENV DB=/db @@ -14,7 +14,7 @@ COPY <<-EOT /run.sh #!/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 + ffplayout -u admin -p admin -m contact@example.com --storage-root "/tv-media" --playlist-root "/playlists" --public-root "/public" --log-path "/logging" --shared-storage fi /usr/bin/ffplayout -l "0.0.0.0:8787" diff --git a/docker/nvidia.Dockerfile b/docker/nvidia.Dockerfile index 71560177..10d668b7 100644 --- a/docker/nvidia.Dockerfile +++ b/docker/nvidia.Dockerfile @@ -1,6 +1,6 @@ FROM nvidia/cuda:12.5.0-runtime-rockylinux9 -ARG FFPLAYOUT_VERSION=0.24.0-beta1 +ARG FFPLAYOUT_VERSION=0.24.0-beta2 ARG SHARED_STORAGE=false ENV DB=/db @@ -204,7 +204,7 @@ COPY <<-EOT /run.sh #!/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 + ffplayout -u admin -p admin -m contact@example.com --storage-root "/tv-media" --playlist-root "/playlists" --public-root "/public" --log-path "/logging" --shared-storage fi /usr/bin/ffplayout -l "0.0.0.0:8787" diff --git a/ffplayout/src/api/routes.rs b/ffplayout/src/api/routes.rs index 14233a90..a0938c88 100644 --- a/ffplayout/src/api/routes.rs +++ b/ffplayout/src/api/routes.rs @@ -475,9 +475,11 @@ async fn patch_channel( pool: web::Data>, id: web::Path, data: web::Json, + controllers: web::Data>, role: AuthDetails, user: web::ReqData, ) -> Result { + let manager = controllers.lock().unwrap().get(*id).unwrap(); let mut data = data.into_inner(); if !role.has_authority(&Role::GlobalAdmin) { @@ -488,11 +490,11 @@ async fn patch_channel( data.storage_path = channel.storage_path; } - if handles::update_channel(&pool, *id, data).await.is_ok() { - return Ok("Update Success"); - }; + handles::update_channel(&pool, *id, data).await?; + let new_config = get_config(&pool, *id).await?; + manager.update_config(new_config); - Err(ServiceError::InternalServerError) + Ok("Update Success") } /// **Create new Channel** diff --git a/ffplayout/src/utils/args_parse.rs b/ffplayout/src/utils/args_parse.rs index fb22ccb3..8f1bd9c6 100644 --- a/ffplayout/src/utils/args_parse.rs +++ b/ffplayout/src/utils/args_parse.rs @@ -453,8 +453,39 @@ pub async fn run_args(pool: &Pool) -> Result<(), i32> { shared_storage: args.shared_storage, }; + let mut channel = handles::select_channel(pool, &1) + .await + .expect("Select Channel 1"); + + if args.shared_storage { + channel.hls_path = Path::new(&global.public_root) + .join("1") + .to_string_lossy() + .to_string(); + channel.playlist_path = Path::new(&global.playlist_root) + .join("1") + .to_string_lossy() + .to_string(); + channel.storage_path = Path::new(&global.storage_root) + .join("1") + .to_string_lossy() + .to_string(); + } else { + channel.hls_path = global.public_root.clone(); + channel.playlist_path = global.playlist_root.clone(); + channel.storage_path = global.storage_root.clone(); + } + match handles::update_global(pool, global.clone()).await { - Ok(_) => println!("Update global paths..."), + Ok(_) => println!("Update globals done..."), + Err(e) => { + eprintln!("{e}"); + error_code = 1; + } + }; + + match handles::update_channel(pool, 1, channel).await { + Ok(_) => println!("Update channel done..."), Err(e) => { eprintln!("{e}"); error_code = 1; diff --git a/frontend b/frontend index e183320e..4d38a743 160000 --- a/frontend +++ b/frontend @@ -1 +1 @@ -Subproject commit e183320e13bd972d632b841bde722fa7bbed70e5 +Subproject commit 4d38a74306113431d6b5db10738e0bb2b1a2cf75