fix playlist switch, when total_delta < threshold

- update packages
- cleanup code with new clippy
- add fake_time cmd arg for debugging
- add ignore_chapters only to file source
This commit is contained in:
jb-alvarado 2022-08-15 14:27:41 +02:00
parent e5840f2ff8
commit 449268dfe0
13 changed files with 129 additions and 302 deletions

337
Cargo.lock generated
View File

@ -63,7 +63,7 @@ dependencies = [
"actix-rt",
"actix-service",
"actix-utils",
"ahash 0.7.6",
"ahash",
"base64",
"bitflags",
"brotli",
@ -83,7 +83,7 @@ dependencies = [
"mime",
"percent-encoding",
"pin-project-lite",
"rand 0.8.5",
"rand",
"sha1",
"smallvec",
"tracing",
@ -196,7 +196,7 @@ dependencies = [
"actix-service",
"actix-utils",
"actix-web-codegen",
"ahash 0.7.6",
"ahash",
"bytes",
"bytestring",
"cfg-if 1.0.0",
@ -264,22 +264,13 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]]
name = "ahash"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8fd72866655d1904d6b0997d0b07ba561047d070fbe29de039031c641b61217"
dependencies = [
"const-random",
]
[[package]]
name = "ahash"
version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47"
dependencies = [
"getrandom 0.2.7",
"getrandom",
"once_cell",
"version_check",
]
@ -346,9 +337,9 @@ dependencies = [
[[package]]
name = "async-channel"
version = "1.7.0"
version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b31b87a3367ed04dbcbc252bce3f2a8172fef861d47177524c503c908dff2c6"
checksum = "e14485364214912d3b19cc3435dde4df66065127f05fa0d75c712f36f12c2f28"
dependencies = [
"concurrent-queue",
"event-listener",
@ -424,7 +415,7 @@ dependencies = [
"async-global-executor",
"async-io",
"async-lock",
"crossbeam-utils 0.8.11",
"crossbeam-utils",
"futures-channel",
"futures-core",
"futures-io",
@ -638,9 +629,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "chrono"
version = "0.4.21"
version = "0.4.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f725f340c3854e3cb3ab736dc21f0cca183303acea3b3ffec30f141503ac8eb"
checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1"
dependencies = [
"iana-time-zone",
"js-sys",
@ -653,9 +644,9 @@ dependencies = [
[[package]]
name = "clap"
version = "3.2.16"
version = "3.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3dbbb6653e7c55cc8595ad3e1f7be8f32aba4eb7ff7f0fd1163d4f3d137c0a9"
checksum = "29e724a68d9319343bb3328c9cc2dfde263f4b3142ee1059a9980580171c954b"
dependencies = [
"atty",
"bitflags",
@ -670,9 +661,9 @@ dependencies = [
[[package]]
name = "clap_derive"
version = "3.2.15"
version = "3.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ba52acd3b0a5c33aeada5cdaa3267cdc7c594a98731d4268cdc1532f4264cb4"
checksum = "13547f7012c01ab4a0e8f8967730ada8f9fdf419e8b6c792788f39cf4e46eefa"
dependencies = [
"heck",
"proc-macro-error",
@ -699,28 +690,6 @@ dependencies = [
"cache-padded",
]
[[package]]
name = "const-random"
version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f590d95d011aa80b063ffe3253422ed5aa462af4e9867d43ce8337562bac77c4"
dependencies = [
"const-random-macro",
"proc-macro-hack",
]
[[package]]
name = "const-random-macro"
version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "615f6e27d000a2bffbc7f2f6a8669179378fa27ee4d0a509e985dfc0a7defb40"
dependencies = [
"getrandom 0.2.7",
"lazy_static",
"proc-macro-hack",
"tiny-keccak",
]
[[package]]
name = "convert_case"
version = "0.4.0"
@ -787,30 +756,6 @@ dependencies = [
"cfg-if 1.0.0",
]
[[package]]
name = "crossbeam"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69323bff1fb41c635347b8ead484a5ca6c3f11914d784170b158d8449ab07f8e"
dependencies = [
"cfg-if 0.1.10",
"crossbeam-channel 0.4.4",
"crossbeam-deque",
"crossbeam-epoch",
"crossbeam-queue 0.2.3",
"crossbeam-utils 0.7.2",
]
[[package]]
name = "crossbeam-channel"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87"
dependencies = [
"crossbeam-utils 0.7.2",
"maybe-uninit",
]
[[package]]
name = "crossbeam-channel"
version = "0.5.6"
@ -818,44 +763,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521"
dependencies = [
"cfg-if 1.0.0",
"crossbeam-utils 0.8.11",
]
[[package]]
name = "crossbeam-deque"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c20ff29ded3204c5106278a81a38f4b482636ed4fa1e6cfbeef193291beb29ed"
dependencies = [
"crossbeam-epoch",
"crossbeam-utils 0.7.2",
"maybe-uninit",
]
[[package]]
name = "crossbeam-epoch"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace"
dependencies = [
"autocfg",
"cfg-if 0.1.10",
"crossbeam-utils 0.7.2",
"lazy_static",
"maybe-uninit",
"memoffset",
"scopeguard",
]
[[package]]
name = "crossbeam-queue"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570"
dependencies = [
"cfg-if 0.1.10",
"crossbeam-utils 0.7.2",
"maybe-uninit",
"crossbeam-utils",
]
[[package]]
@ -865,18 +773,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1cd42583b04998a5363558e5f9291ee5a5ff6b49944332103f251e7479a82aa7"
dependencies = [
"cfg-if 1.0.0",
"crossbeam-utils 0.8.11",
]
[[package]]
name = "crossbeam-utils"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
dependencies = [
"autocfg",
"cfg-if 0.1.10",
"lazy_static",
"crossbeam-utils",
]
[[package]]
@ -889,12 +786,6 @@ dependencies = [
"once_cell",
]
[[package]]
name = "crunchy"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
[[package]]
name = "crypto-common"
version = "0.1.6"
@ -917,13 +808,14 @@ dependencies = [
[[package]]
name = "dashmap"
version = "3.11.10"
version = "5.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f260e2fc850179ef410018660006951c1b55b79e8087e87111a2c388994b9b5"
checksum = "3495912c9c1ccf2e18976439f4443f3fee0fd61f424ff99fde6a66b15ecb448f"
dependencies = [
"ahash 0.3.8",
"cfg-if 0.1.10",
"num_cpus",
"cfg-if 1.0.0",
"hashbrown",
"lock_api",
"parking_lot_core 0.9.3",
]
[[package]]
@ -1049,10 +941,11 @@ dependencies = [
[[package]]
name = "ffplayout"
version = "0.14.0"
version = "0.14.1"
dependencies = [
"chrono",
"clap",
"crossbeam-channel 0.5.6",
"crossbeam-channel",
"ffplayout-lib",
"futures",
"jsonrpc-http-server",
@ -1067,7 +960,7 @@ dependencies = [
[[package]]
name = "ffplayout-api"
version = "0.5.2"
version = "0.5.3"
dependencies = [
"actix-files",
"actix-multipart",
@ -1083,7 +976,7 @@ dependencies = [
"futures-util",
"jsonwebtoken",
"once_cell",
"rand 0.8.5",
"rand",
"relative-path",
"reqwest",
"rpassword",
@ -1097,10 +990,10 @@ dependencies = [
[[package]]
name = "ffplayout-lib"
version = "0.14.0"
version = "0.14.1"
dependencies = [
"chrono",
"crossbeam-channel 0.5.6",
"crossbeam-channel",
"ffprobe",
"file-rotate",
"jsonrpc-http-server",
@ -1108,7 +1001,7 @@ dependencies = [
"log",
"notify",
"openssl",
"rand 0.8.5",
"rand",
"regex",
"reqwest",
"serde",
@ -1249,9 +1142,9 @@ checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
[[package]]
name = "futures"
version = "0.3.21"
version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f73fe65f54d1e12b726f517d3e2135ca3125a437b6d998caf1962961f7172d9e"
checksum = "ab30e97ab6aacfe635fad58f22c2bb06c8b685f7421eb1e064a729e2a5f481fa"
dependencies = [
"futures-channel",
"futures-core",
@ -1264,9 +1157,9 @@ dependencies = [
[[package]]
name = "futures-channel"
version = "0.3.21"
version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010"
checksum = "2bfc52cbddcfd745bf1740338492bb0bd83d76c67b445f91c5fb29fae29ecaa1"
dependencies = [
"futures-core",
"futures-sink",
@ -1274,15 +1167,15 @@ dependencies = [
[[package]]
name = "futures-core"
version = "0.3.21"
version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3"
checksum = "d2acedae88d38235936c3922476b10fced7b2b68136f5e3c03c2d5be348a1115"
[[package]]
name = "futures-executor"
version = "0.3.21"
version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9420b90cfa29e327d0429f19be13e7ddb68fa1cccb09d65e5706b8c7a749b8a6"
checksum = "1d11aa21b5b587a64682c0094c2bdd4df0076c5324961a40cc3abd7f37930528"
dependencies = [
"futures-core",
"futures-task",
@ -1302,9 +1195,9 @@ dependencies = [
[[package]]
name = "futures-io"
version = "0.3.21"
version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b"
checksum = "93a66fc6d035a26a3ae255a6d2bca35eda63ae4c5512bef54449113f7a1228e5"
[[package]]
name = "futures-lite"
@ -1323,9 +1216,9 @@ dependencies = [
[[package]]
name = "futures-macro"
version = "0.3.21"
version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512"
checksum = "0db9cce532b0eae2ccf2766ab246f114b56b9cf6d445e00c2549fbc100ca045d"
dependencies = [
"proc-macro2",
"quote",
@ -1334,21 +1227,21 @@ dependencies = [
[[package]]
name = "futures-sink"
version = "0.3.21"
version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21163e139fa306126e6eedaf49ecdb4588f939600f0b1e770f4205ee4b7fa868"
checksum = "ca0bae1fe9752cf7fd9b0064c674ae63f97b37bc714d745cbde0afb7ec4e6765"
[[package]]
name = "futures-task"
version = "0.3.21"
version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a"
checksum = "842fc63b931f4056a24d59de13fb1272134ce261816e063e634ad0c15cdc5306"
[[package]]
name = "futures-util"
version = "0.3.21"
version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a"
checksum = "f0828a5471e340229c11c77ca80017937ce3c58cb788a17e5f1c2d5c485a9577"
dependencies = [
"futures-channel",
"futures-core",
@ -1372,17 +1265,6 @@ dependencies = [
"version_check",
]
[[package]]
name = "getrandom"
version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce"
dependencies = [
"cfg-if 1.0.0",
"libc",
"wasi 0.9.0+wasi-snapshot-preview1",
]
[[package]]
name = "getrandom"
version = "0.2.7"
@ -1444,7 +1326,7 @@ version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
dependencies = [
"ahash 0.7.6",
"ahash",
]
[[package]]
@ -1570,12 +1452,12 @@ dependencies = [
[[package]]
name = "iana-time-zone"
version = "0.1.41"
version = "0.1.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1779539f58004e5dba1c1f093d44325ebeb244bfc04b791acdc0aaeca9c04570"
checksum = "808cf7d67cf4a22adc5be66e75ebdf769b3f2ea032041437a7061f97a63dad4b"
dependencies = [
"android_system_properties",
"core-foundation",
"core-foundation-sys",
"js-sys",
"wasm-bindgen",
"winapi 0.3.9",
@ -1803,9 +1685,9 @@ dependencies = [
[[package]]
name = "libc"
version = "0.2.129"
version = "0.2.131"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64de3cc433455c14174d42e554d4027ee631c4d046d43e3ecc6efc4636cdc7a7"
checksum = "04c3b4822ccebfa39c02fc03d1534441b22ead323fa0f48bb7ddd8e6ba076a40"
[[package]]
name = "libsqlite3-sys"
@ -1874,27 +1756,12 @@ version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"
[[package]]
name = "maybe-uninit"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
[[package]]
name = "memchr"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]]
name = "memoffset"
version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa"
dependencies = [
"autocfg",
]
[[package]]
name = "mime"
version = "0.3.16"
@ -2150,9 +2017,9 @@ dependencies = [
[[package]]
name = "os_str_bytes"
version = "6.2.0"
version = "6.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "648001efe5d5c0102d8cea768e348da85d90af8ba91f0bea908f157951493cd4"
checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff"
[[package]]
name = "paris"
@ -2221,7 +2088,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700"
dependencies = [
"base64ct",
"rand_core 0.6.3",
"rand_core",
"subtle",
]
@ -2327,12 +2194,6 @@ dependencies = [
"version_check",
]
[[package]]
name = "proc-macro-hack"
version = "0.5.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
[[package]]
name = "proc-macro2"
version = "1.0.43"
@ -2357,19 +2218,6 @@ version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fee2dce59f7a43418e3382c766554c614e06a552d53a8f07ef499ea4b332c0f"
[[package]]
name = "rand"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
dependencies = [
"getrandom 0.1.16",
"libc",
"rand_chacha 0.2.2",
"rand_core 0.5.1",
"rand_hc",
]
[[package]]
name = "rand"
version = "0.8.5"
@ -2377,18 +2225,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
dependencies = [
"libc",
"rand_chacha 0.3.1",
"rand_core 0.6.3",
]
[[package]]
name = "rand_chacha"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
dependencies = [
"ppv-lite86",
"rand_core 0.5.1",
"rand_chacha",
"rand_core",
]
[[package]]
@ -2398,16 +2236,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
dependencies = [
"ppv-lite86",
"rand_core 0.6.3",
]
[[package]]
name = "rand_core"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
dependencies = [
"getrandom 0.1.16",
"rand_core",
]
[[package]]
@ -2416,16 +2245,7 @@ version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
dependencies = [
"getrandom 0.2.7",
]
[[package]]
name = "rand_hc"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
dependencies = [
"rand_core 0.5.1",
"getrandom",
]
[[package]]
@ -2443,7 +2263,7 @@ version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b"
dependencies = [
"getrandom 0.2.7",
"getrandom",
"redox_syscall",
"thiserror",
]
@ -2806,13 +2626,13 @@ version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c21d3b5e7cadfe9ba7cdc1295f72cc556c750b4419c27c219c0693198901f8e"
dependencies = [
"ahash 0.7.6",
"ahash",
"atoi",
"bitflags",
"byteorder",
"bytes",
"crc",
"crossbeam-queue 0.3.6",
"crossbeam-queue",
"dotenvy",
"either",
"event-listener",
@ -2985,15 +2805,6 @@ version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42657b1a6f4d817cda8e7a0ace261fe0cc946cf3a80314390b22cc61ae080792"
[[package]]
name = "tiny-keccak"
version = "2.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237"
dependencies = [
"crunchy",
]
[[package]]
name = "tinyvec"
version = "1.6.0"
@ -3195,11 +3006,11 @@ dependencies = [
[[package]]
name = "uuid"
version = "0.8.2"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7"
checksum = "dd6469f4314d5f1ffec476e05f17cc9a78bc7a27a6a857842170bdf8d6f98d2f"
dependencies = [
"getrandom 0.2.7",
"getrandom",
]
[[package]]
@ -3251,12 +3062,6 @@ dependencies = [
"try-lock",
]
[[package]]
name = "wasi"
version = "0.9.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
[[package]]
name = "wasi"
version = "0.10.0+wasi-snapshot-preview1"
@ -3471,22 +3276,22 @@ dependencies = [
[[package]]
name = "zeromq"
version = "0.3.3"
source = "git+https://github.com/zeromq/zmq.rs.git#a726e8766b6071028eca966e090b9d62d85fcf6d"
source = "git+https://github.com/zeromq/zmq.rs.git#6ca89efadd00d1cb3541c52094f4c92ce016ce11"
dependencies = [
"async-std",
"async-trait",
"asynchronous-codec",
"bytes",
"crossbeam",
"crossbeam-queue",
"dashmap",
"enum-primitive-derive",
"futures",
"futures-util",
"lazy_static",
"log",
"num-traits",
"parking_lot 0.11.2",
"rand 0.7.3",
"once_cell",
"parking_lot 0.12.1",
"rand",
"regex",
"thiserror",
"uuid",

View File

@ -4,7 +4,7 @@ description = "Rest API for ffplayout"
license = "GPL-3.0"
authors = ["Jonathan Baecker jonbae77@gmail.com"]
readme = "README.md"
version = "0.5.2"
version = "0.5.3"
edition = "2021"
[dependencies]

View File

@ -9,7 +9,7 @@ use crate::utils::GlobalSettings;
// Token lifetime
const JWT_EXPIRATION_DAYS: i64 = 7;
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
#[derive(Clone, Debug, Serialize, Deserialize, Eq, PartialEq)]
pub struct Claims {
pub id: i64,
pub username: String,

View File

@ -29,7 +29,7 @@ use crate::utils::{
};
use ffplayout_lib::utils::PlayoutConfig;
#[derive(PartialEq, Clone)]
#[derive(Clone, Eq, PartialEq)]
pub enum Role {
Admin,
User,

View File

@ -125,12 +125,12 @@ pub async fn login(credentials: web::Json<User>) -> impl Responder {
}
Err(e) => {
error!("Login {} failed! {e}", credentials.username);
return web::Json(UserObj {
web::Json(UserObj {
message: format!("Login {} failed!", credentials.username),
user: None,
})
.customize()
.with_status(StatusCode::BAD_REQUEST);
.with_status(StatusCode::BAD_REQUEST)
}
}
}
@ -470,7 +470,7 @@ pub async fn send_text_message(
data: web::Json<HashMap<String, String>>,
) -> Result<impl Responder, ServiceError> {
match send_message(*id, data.into_inner()).await {
Ok(res) => return Ok(res.text().await.unwrap_or_else(|_| "Success".into())),
Ok(res) => Ok(res.text().await.unwrap_or_else(|_| "Success".into())),
Err(e) => Err(e),
}
}
@ -492,7 +492,7 @@ pub async fn control_playout(
control: web::Json<Process>,
) -> Result<impl Responder, ServiceError> {
match control_state(*id, control.command.clone()).await {
Ok(res) => return Ok(res.text().await.unwrap_or_else(|_| "Success".into())),
Ok(res) => Ok(res.text().await.unwrap_or_else(|_| "Success".into())),
Err(e) => Err(e),
}
}
@ -531,7 +531,7 @@ pub async fn control_playout(
#[has_any_role("Role::Admin", "Role::User", type = "Role")]
pub async fn media_current(id: web::Path<i64>) -> Result<impl Responder, ServiceError> {
match media_info(*id, "current".into()).await {
Ok(res) => return Ok(res.text().await.unwrap_or_else(|_| "Success".into())),
Ok(res) => Ok(res.text().await.unwrap_or_else(|_| "Success".into())),
Err(e) => Err(e),
}
}
@ -545,7 +545,7 @@ pub async fn media_current(id: web::Path<i64>) -> Result<impl Responder, Service
#[has_any_role("Role::Admin", "Role::User", type = "Role")]
pub async fn media_next(id: web::Path<i64>) -> Result<impl Responder, ServiceError> {
match media_info(*id, "next".into()).await {
Ok(res) => return Ok(res.text().await.unwrap_or_else(|_| "Success".into())),
Ok(res) => Ok(res.text().await.unwrap_or_else(|_| "Success".into())),
Err(e) => Err(e),
}
}
@ -560,7 +560,7 @@ pub async fn media_next(id: web::Path<i64>) -> Result<impl Responder, ServiceErr
#[has_any_role("Role::Admin", "Role::User", type = "Role")]
pub async fn media_last(id: web::Path<i64>) -> Result<impl Responder, ServiceError> {
match media_info(*id, "last".into()).await {
Ok(res) => return Ok(res.text().await.unwrap_or_else(|_| "Success".into())),
Ok(res) => Ok(res.text().await.unwrap_or_else(|_| "Success".into())),
Err(e) => Err(e),
}
}

View File

@ -4,11 +4,12 @@ description = "24/7 playout based on rust and ffmpeg"
license = "GPL-3.0"
authors = ["Jonathan Baecker jonbae77@gmail.com"]
readme = "README.md"
version = "0.14.0"
version = "0.14.1"
edition = "2021"
[dependencies]
ffplayout-lib = { path = "../lib" }
chrono = "0.4"
clap = { version = "3.2", features = ["derive"] }
crossbeam-channel = "0.5"
futures = "0.3"

View File

@ -352,7 +352,7 @@ impl Iterator for CurrentProgram {
if !self.config.playlist.infinit
&& last_playlist == self.json_path
&& total_delta.abs() > self.config.general.stop_threshold
&& total_delta.abs() > 1.0
{
// Test if playlist is to early finish,
// and if we have to fill it with a placeholder.
@ -383,6 +383,7 @@ impl Iterator for CurrentProgram {
return Some(self.current_node.clone());
}
// Get first clip from next playlist.
self.index.store(0, Ordering::SeqCst);
self.current_node = gen_source(
&self.config,
@ -552,7 +553,10 @@ fn handle_list_end(
let mut out = if node.seek > 0.0 {
node.seek + total_delta
} else {
if node.duration > total_delta {
warn!("Clip length is not in time, new duration is: <yellow>{total_delta:.2}</>");
}
total_delta
};

View File

@ -6,6 +6,8 @@ use std::{
thread,
};
#[cfg(debug_assertions)]
use chrono::prelude::*;
use serde::{Deserialize, Serialize};
use serde_json::json;
use simplelog::*;
@ -29,6 +31,12 @@ use ffplayout_lib::utils::{
ProcessControl,
};
#[cfg(debug_assertions)]
use utils::Args;
#[cfg(debug_assertions)]
use ffplayout_lib::utils::{mock_time, time_now};
#[derive(Serialize, Deserialize)]
struct StatusData {
time_shift: f64,
@ -69,8 +77,22 @@ fn status_file(stat_file: &str, playout_stat: &PlayoutStatus) {
}
}
#[cfg(debug_assertions)]
fn fake_time(args: &Args) {
if let Some(fake_time) = &args.fake_time {
mock_time::set_mock_time(fake_time);
} else {
let local: DateTime<Local> = time_now();
mock_time::set_mock_time(&local.format("%Y-%m-%dT%H:%M:%S").to_string());
}
}
fn main() {
let args = get_args();
#[cfg(debug_assertions)]
fake_time(&args);
let config = get_config(args);
let config_clone = config.clone();
let play_control = PlayerControl::new();

View File

@ -186,14 +186,7 @@ pub fn write_hls(
node.source
);
let mut enc_prefix = vec_strings![
"-hide_banner",
"-nostats",
"-v",
&ff_log_format,
"-ignore_chapters",
"1"
];
let mut enc_prefix = vec_strings!["-hide_banner", "-nostats", "-v", &ff_log_format];
enc_prefix.append(&mut cmd);
let enc_filter = node.filter.unwrap();
let enc_cmd = prepare_output_cmd(

View File

@ -99,14 +99,7 @@ pub fn player(
);
let mut filter = node.filter.unwrap();
let mut dec_cmd = vec_strings![
"-hide_banner",
"-nostats",
"-v",
&ff_log_format,
"-ignore_chapters",
"1"
];
let mut dec_cmd = vec_strings!["-hide_banner", "-nostats", "-v", &ff_log_format];
dec_cmd.append(&mut cmd);
if filter.len() > 1 {

View File

@ -55,6 +55,10 @@ pub struct Args {
#[clap(short, long, help = "Set audio volume")]
pub volume: Option<f64>,
#[cfg(debug_assertions)]
#[clap(long, help = "fake date time, for debugging")]
pub fake_time: Option<String>,
}
/// Get arguments from command line, and return them.

View File

@ -4,7 +4,7 @@ description = "Library for ffplayout"
license = "GPL-3.0"
authors = ["Jonathan Baecker jonbae77@gmail.com"]
readme = "README.md"
version = "0.14.0"
version = "0.14.1"
edition = "2021"
[dependencies]

View File

@ -452,7 +452,12 @@ pub fn seek_and_length(node: &Media) -> Vec<String> {
source_cmd.append(&mut vec_strings!["-ss", node.seek])
}
source_cmd.append(&mut vec_strings!["-i", node.source.clone()]);
source_cmd.append(&mut vec_strings![
"-ignore_chapters",
"1",
"-i",
node.source.clone()
]);
if Path::new(&node.audio).is_file() {
let audio_probe = MediaProbe::new(&node.audio);
@ -744,14 +749,14 @@ fn home_dir_inner() -> Option<PathBuf> {
env::home_dir()
}
/// Get system time, in non test case.
#[cfg(not(test))]
/// Get system time, in non test/debug case.
#[cfg(not(any(test, debug_assertions)))]
pub fn time_now() -> DateTime<Local> {
Local::now()
}
/// Get mocked system time, in test case.
#[cfg(test)]
/// Get mocked system time, in test/debug case.
#[cfg(any(test, debug_assertions))]
pub mod mock_time {
use super::*;
use std::cell::RefCell;
@ -776,5 +781,5 @@ pub mod mock_time {
}
}
#[cfg(test)]
#[cfg(any(test, debug_assertions))]
pub use mock_time::time_now;