diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 00000000..67da2b47 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[env] +TS_RS_EXPORT_DIR = { value = "frontend/types", relative = true } diff --git a/Cargo.lock b/Cargo.lock index 030c614b..5dfcea2c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -403,9 +403,9 @@ dependencies = [ [[package]] name = "addr2line" -version = "0.24.1" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5fb1d8e4442bd405fdfd1dacb42792696b0cf9cb15882e5d097b742a676d375" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ "gimli", ] @@ -735,9 +735,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.24" +version = "1.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "812acba72f0a070b003d3697490d2b55b837230ae7c6c6497f05cc2ddbb8d938" +checksum = "2e80e3b6a3ab07840e1cae9b0666a63970dc28e8ed5ffbcdacbfc760c281bfc1" dependencies = [ "jobserver", "libc", @@ -793,9 +793,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.19" +version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7be5744db7978a28d9df86a214130d106a89ce49644cbc4e3f0c22c3fba30615" +checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8" dependencies = [ "clap_builder", "clap_derive", @@ -803,9 +803,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.19" +version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5fbc17d3ef8278f55b282b2a2e75ae6f6c7d4bb70ed3d0382375104bfafdb4b" +checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" dependencies = [ "anstream", "anstyle", @@ -1215,7 +1215,7 @@ checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" [[package]] name = "ffplayout" -version = "0.24.0-rc2" +version = "0.24.0-rc3" dependencies = [ "actix-files", "actix-multipart", @@ -1266,6 +1266,7 @@ dependencies = [ "tokio", "tokio-stream", "toml_edit", + "ts-rs", "uuid", "walkdir", "zeromq", @@ -1324,9 +1325,9 @@ dependencies = [ [[package]] name = "flexi_logger" -version = "0.29.0" +version = "0.29.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a250587a211932896a131f214a4f64c047b826ce072d2018764e5ff5141df8fa" +checksum = "6c6e500462d7c5ee8b974423b55bd47f3e09c8306050e5bbeaccaf2b17992f70" dependencies = [ "chrono", "glob", @@ -1373,9 +1374,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -1388,9 +1389,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -1398,15 +1399,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -1426,15 +1427,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-macro" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", @@ -1443,21 +1444,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", @@ -1496,9 +1497,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.31.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32085ea23f3234fc7846555e85283ba4de91e21016dc0455a16286d87a292d64" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "glob" @@ -1975,9 +1976,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.70" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" dependencies = [ "wasm-bindgen", ] @@ -2408,21 +2409,18 @@ dependencies = [ [[package]] name = "object" -version = "0.36.4" +version = "0.36.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" +checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.20.1" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82881c4be219ab5faaf2ad5e5e5ecdff8c66bd7402ca3160975c93b24961afd1" -dependencies = [ - "portable-atomic", -] +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "paris" @@ -2567,12 +2565,6 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" -[[package]] -name = "portable-atomic" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2" - [[package]] name = "powerfmt" version = "0.2.0" @@ -2590,9 +2582,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a" dependencies = [ "unicode-ident", ] @@ -2916,9 +2908,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.13" +version = "0.23.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dabaac7466917e566adb06783a81ca48944c6898a1b08b9374106dd671f4c8" +checksum = "415d9944693cb90382053259f89fbb077ea730ad7273047ec63b19bc9b160ba8" dependencies = [ "log", "once_cell", @@ -3103,9 +3095,9 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.10.0" +version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9720086b3357bcb44fce40117d769a4d068c70ecfa190850a980a71755f66fcc" +checksum = "8e28bdad6db2b8340e449f7108f020b3b092e8583a9e3fb82713e1d4e71fe817" dependencies = [ "base64 0.22.1", "chrono", @@ -3121,9 +3113,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.10.0" +version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f1abbfe725f27678f4663bcacb75a83e829fd464c25d78dd038a3a29e307cec" +checksum = "9d846214a9854ef724f3da161b426242d8de7c1fc7de2f89bb1efcb154dca79d" dependencies = [ "darling", "proc-macro2", @@ -3672,9 +3664,18 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + [[package]] name = "tests" -version = "0.24.0-rc2" +version = "0.24.0-rc3" dependencies = [ "actix-rt", "actix-test", @@ -3909,6 +3910,30 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +[[package]] +name = "ts-rs" +version = "10.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a2f31991cee3dce1ca4f929a8a04fdd11fd8801aac0f2030b0fa8a0a3fef6b9" +dependencies = [ + "chrono", + "lazy_static", + "thiserror", + "ts-rs-macros", +] + +[[package]] +name = "ts-rs-macros" +version = "10.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ea0b99e8ec44abd6f94a18f28f7934437809dd062820797c52401298116f70e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", + "termcolor", +] + [[package]] name = "typeid" version = "1.0.2" @@ -4100,9 +4125,9 @@ checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" [[package]] name = "wasm-bindgen" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" dependencies = [ "cfg-if", "once_cell", @@ -4111,9 +4136,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" dependencies = [ "bumpalo", "log", @@ -4126,9 +4151,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.43" +version = "0.4.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" +checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" dependencies = [ "cfg-if", "js-sys", @@ -4138,9 +4163,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4148,9 +4173,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", @@ -4161,15 +4186,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "web-sys" -version = "0.3.70" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" +checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" dependencies = [ "js-sys", "wasm-bindgen", @@ -4560,9 +4585,9 @@ checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" [[package]] name = "zeromq" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb0560d00172817b7f7c2265060783519c475702ae290b154115ca75e976d4d0" +checksum = "6a4528179201f6eecf211961a7d3276faa61554c82651ecc66387f68fc3004bd" dependencies = [ "async-trait", "asynchronous-codec", diff --git a/Cargo.toml b/Cargo.toml index 3b044f0e..f89d844a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ resolver = "2" [workspace.package] description = "24/7 playout based on rust and ffmpeg" readme = "README.md" -version = "0.24.0-rc2" +version = "0.24.0-rc3" license = "GPL-3.0" repository = "https://github.com/ffplayout/ffplayout" authors = ["Jonathan Baecker "] diff --git a/docker/Dockerfile b/docker/Dockerfile index d7ad6b9f..b47c26e9 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,6 +1,6 @@ FROM alpine:latest -ARG FFPLAYOUT_VERSION=0.24.0-rc1 +ARG FFPLAYOUT_VERSION=0.24.0-rc3 ARG SHARED_STORAGE=false ENV DB=/db diff --git a/docker/nonfree.Dockerfile b/docker/nonfree.Dockerfile index 7ed51bcc..fdd89293 100644 --- a/docker/nonfree.Dockerfile +++ b/docker/nonfree.Dockerfile @@ -1,6 +1,6 @@ FROM alpine:latest -ARG FFPLAYOUT_VERSION=0.24.0-rc1 +ARG FFPLAYOUT_VERSION=0.24.0-rc3 ARG SHARED_STORAGE=false ENV DB=/db diff --git a/docker/nvidia.Dockerfile b/docker/nvidia.Dockerfile index f1b5b196..9a4d24e3 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-rc1 +ARG FFPLAYOUT_VERSION=0.24.0-rc3 ARG SHARED_STORAGE=false ENV DB=/db diff --git a/docs/closed_captions.md b/docs/closed_captions.md index c9cbf5e0..2d6877ac 100644 --- a/docs/closed_captions.md +++ b/docs/closed_captions.md @@ -1,7 +1,7 @@ ## Closed Captions #### Note: -**This is only an _experimental feature_. Please be aware that bugs and unexpected behavior may occur. To utilize this feature, a [special patched](https://github.com/jb-alvarado/compile-ffmpeg-osx-linux) version of FFmpeg is required. Importantly, there is currently no official support for this functionality.** +**This is only an _experimental feature_. Please be aware that bugs and unexpected behavior may occur. To utilize this feature, a version after 7.1 of FFmpeg is required. Importantly, there is currently no official support for this functionality.** ### Usage **ffplayout** can handle closed captions in WebVTT format for HLS streaming. @@ -16,7 +16,7 @@ To encode the closed captions, the **hls** mode needs to be enabled, and specifi -profile:v Main -level 3.1 -c:a aac -ar 44100 -b:a 128k -flags +cgop \ -muxpreload 0 -muxdelay 0 -f hls -hls_time 6 -hls_list_size 600 \ -hls_flags append_list+delete_segments+omit_endlist \ --var_stream_map v:0,a:0,s:0,sgroup:subs,name:English,language:en-US,default:YES \ +-var_stream_map v:0,a:0,s:0,sgroup:subs,sname:English,language:en-US,default:YES \ -master_pl_name master.m3u8 \ -hls_segment_filename \ live/stream-%d.ts live/stream.m3u8 diff --git a/docs/developer.md b/docs/developer.md index 46d83ce0..b255652c 100644 --- a/docs/developer.md +++ b/docs/developer.md @@ -69,6 +69,11 @@ cargo deb --no-build --target=aarch64-unknown-linux-gnu --variant=arm64 -p ffpla cargo generate-rpm --target=x86_64-unknown-linux-musl ``` +## Generate types for Frontend +The frontend uses TypeScript, to generate types for the rust structs run: `cargo test`. + +The generated types are then in [types folder](/frontend/types). + ## Setup Frontend Make sure to install the dependencies: diff --git a/engine/Cargo.toml b/engine/Cargo.toml index 68e32230..43fda5da 100644 --- a/engine/Cargo.toml +++ b/engine/Cargo.toml @@ -27,7 +27,7 @@ crossbeam-channel = "0.5" derive_more = { version = "1", features = ["display"] } faccess = "0.2" ffprobe = "0.4" -flexi_logger = { version = "=0.29.0", features = ["kv", "colors"] } +flexi_logger = { version = "0.29", features = ["kv", "colors"] } futures-util = { version = "0.3", default-features = false, features = ["std"] } home = "0.5" jsonwebtoken = "9" @@ -60,7 +60,8 @@ sqlx = { version = "0.8", features = ["runtime-tokio", "sqlite"] } time = { version = "0.3", features = ["formatting", "macros"] } tokio = { version = "1.29", features = ["full"] } tokio-stream = "0.1" -toml_edit = {version ="0.22", features = ["serde"]} +toml_edit = {version = "0.22", features = ["serde"]} +ts-rs = { version = "10", features = ["chrono-impl", "no-serde-warnings"] } uuid = "1.8" walkdir = "2" zeromq = { version = "0.4", default-features = false, features = [ diff --git a/engine/src/api/routes.rs b/engine/src/api/routes.rs index 0780067f..978f87eb 100644 --- a/engine/src/api/routes.rs +++ b/engine/src/api/routes.rs @@ -869,10 +869,22 @@ pub async fn control_playout( ) -> Result { let manager = controllers.lock().unwrap().get(*id).unwrap(); - match control_state(&pool, manager, &control.control).await { + if manager.is_processing.load(Ordering::SeqCst) { + return Err(ServiceError::Conflict( + "A command is already being processed, please wait".to_string(), + )); + } + + manager.is_processing.store(true, Ordering::SeqCst); + + let resp = match control_state(&pool, &manager, &control.control).await { Ok(res) => Ok(web::Json(res)), Err(e) => Err(e), - } + }; + + manager.is_processing.store(false, Ordering::SeqCst); + + resp } /// **Get current Clip** diff --git a/engine/src/db/models.rs b/engine/src/db/models.rs index 2f9abc29..a58b3500 100644 --- a/engine/src/db/models.rs +++ b/engine/src/db/models.rs @@ -267,23 +267,19 @@ where pub struct Configuration { pub id: i32, pub channel_id: i32, - pub general_help: String, pub general_stop_threshold: f64, - pub mail_help: String, pub mail_subject: String, pub mail_recipient: String, pub mail_level: String, pub mail_interval: i64, - pub logging_help: String, pub logging_ffmpeg_level: String, pub logging_ingest_level: String, pub logging_detect_silence: bool, #[serde(default)] pub logging_ignore: String, - pub processing_help: String, pub processing_mode: String, pub processing_audio_only: bool, pub processing_copy_audio: bool, @@ -311,34 +307,28 @@ pub struct Configuration { #[serde(default)] pub processing_vtt_dummy: Option, - pub ingest_help: String, pub ingest_enable: bool, pub ingest_param: String, #[serde(default)] pub ingest_filter: String, - pub playlist_help: String, pub playlist_day_start: String, pub playlist_length: String, pub playlist_infinit: bool, - pub storage_help: String, pub storage_filler: String, pub storage_extensions: String, pub storage_shuffle: bool, - pub text_help: String, pub text_add: bool, pub text_from_filename: bool, pub text_font: String, pub text_style: String, pub text_regex: String, - pub task_help: String, pub task_enable: bool, pub task_path: String, - pub output_help: String, pub output_mode: String, pub output_param: String, } @@ -348,19 +338,15 @@ impl Configuration { Self { id, channel_id, - general_help: config.general.help_text, general_stop_threshold: config.general.stop_threshold, - mail_help: config.mail.help_text, mail_subject: config.mail.subject, mail_recipient: config.mail.recipient, mail_level: config.mail.mail_level.to_string(), mail_interval: config.mail.interval, - logging_help: config.logging.help_text, logging_ffmpeg_level: config.logging.ffmpeg_level, logging_ingest_level: config.logging.ingest_level, logging_detect_silence: config.logging.detect_silence, logging_ignore: config.logging.ignore_lines.join(";"), - processing_help: config.processing.help_text, processing_mode: config.processing.mode.to_string(), processing_audio_only: config.processing.audio_only, processing_audio_track_index: config.processing.audio_track_index, @@ -381,28 +367,22 @@ impl Configuration { processing_filter: config.processing.custom_filter, processing_vtt_enable: config.processing.vtt_enable, processing_vtt_dummy: config.processing.vtt_dummy, - ingest_help: config.ingest.help_text, ingest_enable: config.ingest.enable, ingest_param: config.ingest.input_param, ingest_filter: config.ingest.custom_filter, - playlist_help: config.playlist.help_text, playlist_day_start: config.playlist.day_start, playlist_length: config.playlist.length, playlist_infinit: config.playlist.infinit, - storage_help: config.storage.help_text, storage_filler: config.storage.filler, storage_extensions: config.storage.extensions.join(";"), storage_shuffle: config.storage.shuffle, - text_help: config.text.help_text, text_add: config.text.add_text, text_font: config.text.font, text_from_filename: config.text.text_from_filename, text_style: config.text.style, text_regex: config.text.regex, - task_help: config.task.help_text, task_enable: config.task.enable, task_path: config.task.path.to_string_lossy().to_string(), - output_help: config.output.help_text, output_mode: config.output.mode.to_string(), output_param: config.output.output_param, } diff --git a/engine/src/utils/advanced_config.rs b/engine/src/utils/advanced_config.rs index 9301486f..a22b91f3 100644 --- a/engine/src/utils/advanced_config.rs +++ b/engine/src/utils/advanced_config.rs @@ -5,11 +5,13 @@ use serde_with::{serde_as, NoneAsEmptyString}; use shlex::split; use sqlx::{Pool, Sqlite}; use tokio::io::AsyncReadExt; +use ts_rs::TS; use crate::db::{handles, models::AdvancedConfiguration}; use crate::utils::ServiceError; -#[derive(Debug, Default, Serialize, Deserialize, Clone)] +#[derive(Debug, Default, Serialize, Deserialize, Clone, TS)] +#[ts(export, export_to = "advanced_config.d.ts")] pub struct AdvancedConfig { pub decoder: DecoderConfig, pub encoder: EncoderConfig, @@ -18,81 +20,115 @@ pub struct AdvancedConfig { } #[serde_as] -#[derive(Debug, Default, Serialize, Deserialize, Clone)] +#[derive(Debug, Default, Serialize, Deserialize, Clone, TS)] +#[ts(export, export_to = "advanced_config.d.ts")] pub struct DecoderConfig { + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub input_param: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub output_param: Option, + #[ts(skip)] #[serde(skip_serializing, skip_deserializing)] pub input_cmd: Option>, + #[ts(skip)] #[serde(skip_serializing, skip_deserializing)] pub output_cmd: Option>, } #[serde_as] -#[derive(Debug, Default, Serialize, Deserialize, Clone)] +#[derive(Debug, Default, Serialize, Deserialize, Clone, TS)] +#[ts(export, export_to = "advanced_config.d.ts")] pub struct EncoderConfig { + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub input_param: Option, + #[ts(skip)] #[serde(skip_serializing, skip_deserializing)] pub input_cmd: Option>, } #[serde_as] -#[derive(Debug, Default, Serialize, Deserialize, Clone)] +#[derive(Debug, Default, Serialize, Deserialize, Clone, TS)] +#[ts(export, export_to = "advanced_config.d.ts")] pub struct IngestConfig { + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub input_param: Option, + #[ts(skip)] #[serde(skip_serializing, skip_deserializing)] pub input_cmd: Option>, } #[serde_as] -#[derive(Debug, Default, Serialize, Deserialize, Clone)] +#[derive(Debug, Default, Serialize, Deserialize, Clone, TS)] +#[ts(export, export_to = "advanced_config.d.ts")] pub struct FilterConfig { + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub deinterlace: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub pad_scale_w: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub pad_scale_h: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub pad_video: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub fps: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub scale: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub set_dar: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub fade_in: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub fade_out: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub overlay_logo_scale: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub overlay_logo_fade_in: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub overlay_logo_fade_out: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub overlay_logo: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub tpad: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub drawtext_from_file: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub drawtext_from_zmq: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub aevalsrc: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub afade_in: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub afade_out: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub apad: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub volume: Option, + #[ts(type = "string")] #[serde_as(as = "NoneAsEmptyString")] pub split: Option, } diff --git a/engine/src/utils/config.rs b/engine/src/utils/config.rs index 6d39024d..1d248389 100644 --- a/engine/src/utils/config.rs +++ b/engine/src/utils/config.rs @@ -11,6 +11,7 @@ use serde::{Deserialize, Serialize}; use shlex::split; use sqlx::{Pool, Sqlite}; use tokio::{fs, io::AsyncReadExt}; +use ts_rs::TS; use crate::db::{handles, models}; use crate::utils::{files::norm_abs_path, free_tcp_socket, time_to_sec}; @@ -52,7 +53,8 @@ pub const FFMPEG_UNRECOVERABLE_ERRORS: [&str; 6] = [ "Unrecognized option", ]; -#[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] +#[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize, TS)] +#[ts(export, export_to = "playout_config.d.ts")] #[serde(rename_all = "lowercase")] pub enum OutputMode { Desktop, @@ -103,7 +105,8 @@ impl fmt::Display for OutputMode { } } -#[derive(Debug, Default, Clone, Serialize, Deserialize, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Serialize, Deserialize, Eq, PartialEq, TS)] +#[ts(export, export_to = "playout_config.d.ts")] #[serde(rename_all = "lowercase")] pub enum ProcessMode { Folder, @@ -141,14 +144,16 @@ impl FromStr for ProcessMode { } } -#[derive(Clone, Debug, Default, Deserialize, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, Serialize, TS)] pub struct Template { pub sources: Vec, } -#[derive(Clone, Debug, Default, Deserialize, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, Serialize, TS)] pub struct Source { + #[ts(type = "string")] pub start: NaiveTime, + #[ts(type = "string")] pub duration: NaiveTime, pub shuffle: bool, pub paths: Vec, @@ -157,10 +162,14 @@ pub struct Source { /// Channel Config /// /// This we init ones, when ffplayout is starting and use them globally in the hole program. -#[derive(Debug, Default, Clone, Deserialize, Serialize)] + +#[derive(Debug, Default, Clone, Deserialize, Serialize, TS)] +#[ts(export, export_to = "playout_config.d.ts")] pub struct PlayoutConfig { + #[ts(skip)] #[serde(skip_serializing, skip_deserializing)] pub channel: Channel, + #[ts(skip)] #[serde(skip_serializing, skip_deserializing)] pub advanced: AdvancedConfig, pub general: General, @@ -176,7 +185,7 @@ pub struct PlayoutConfig { pub output: Output, } -#[derive(Debug, Default, Clone, Deserialize, Serialize)] +#[derive(Debug, Default, Clone, Deserialize, Serialize, TS)] pub struct Channel { pub logs: PathBuf, pub public: PathBuf, @@ -197,24 +206,32 @@ impl Channel { } } -#[derive(Debug, Default, Clone, Deserialize, Serialize)] +#[derive(Debug, Default, Clone, Deserialize, Serialize, TS)] +#[ts(export, export_to = "playout_config.d.ts")] pub struct General { - pub help_text: String, + #[ts(skip)] #[serde(skip_serializing, skip_deserializing)] pub id: i32, + #[ts(skip)] #[serde(skip_serializing, skip_deserializing)] pub channel_id: i32, pub stop_threshold: f64, + #[ts(skip)] #[serde(skip_serializing, skip_deserializing)] pub generate: Option>, + #[ts(skip)] #[serde(skip_serializing, skip_deserializing)] pub ffmpeg_filters: Vec, + #[ts(skip)] #[serde(skip_serializing, skip_deserializing)] pub ffmpeg_libs: Vec, + #[ts(skip)] #[serde(skip_serializing, skip_deserializing)] pub template: Option