cleanup and update docker files, migrate to notify 6.0

This commit is contained in:
jb-alvarado 2023-06-18 00:43:23 +02:00
parent d93180e040
commit 5502c45420
10 changed files with 351 additions and 782 deletions

208
Cargo.lock generated
View File

@ -322,6 +322,12 @@ dependencies = [
"alloc-no-stdlib", "alloc-no-stdlib",
] ]
[[package]]
name = "allocator-api2"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56fc6cf8dc8c4158eed8649f9b8b0ea1518eb62b544fe9490d66fa0b349eafe9"
[[package]] [[package]]
name = "android-tzdata" name = "android-tzdata"
version = "0.1.1" version = "0.1.1"
@ -762,9 +768,9 @@ checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa"
[[package]] [[package]]
name = "cpufeatures" name = "cpufeatures"
version = "0.2.7" version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e4c1eaa2012c47becbbad2ab175484c2a84d1185b566fb2cc5b8707343dfe58" checksum = "03e69e28e9f7f77debdedbaafa2866e1de9ba56df55a8bd7cfc724c25a09987c"
dependencies = [ dependencies = [
"libc", "libc",
] ]
@ -815,9 +821,9 @@ dependencies = [
[[package]] [[package]]
name = "crossbeam-utils" name = "crossbeam-utils"
version = "0.8.15" version = "0.8.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
] ]
@ -955,7 +961,7 @@ dependencies = [
[[package]] [[package]]
name = "ffplayout" name = "ffplayout"
version = "0.18.3" version = "0.19.0"
dependencies = [ dependencies = [
"chrono", "chrono",
"clap", "clap",
@ -963,7 +969,8 @@ dependencies = [
"ffplayout-lib", "ffplayout-lib",
"futures", "futures",
"jsonrpc-http-server", "jsonrpc-http-server",
"notify", "notify 6.0.1",
"notify-debouncer-full",
"openssl", "openssl",
"regex", "regex",
"reqwest", "reqwest",
@ -975,7 +982,7 @@ dependencies = [
[[package]] [[package]]
name = "ffplayout-api" name = "ffplayout-api"
version = "0.18.3" version = "0.19.0"
dependencies = [ dependencies = [
"actix-files", "actix-files",
"actix-multipart", "actix-multipart",
@ -1008,7 +1015,7 @@ dependencies = [
[[package]] [[package]]
name = "ffplayout-lib" name = "ffplayout-lib"
version = "0.18.3" version = "0.19.0"
dependencies = [ dependencies = [
"chrono", "chrono",
"crossbeam-channel", "crossbeam-channel",
@ -1017,7 +1024,7 @@ dependencies = [
"jsonrpc-http-server", "jsonrpc-http-server",
"lettre", "lettre",
"log", "log",
"notify", "notify 4.0.17",
"openssl", "openssl",
"rand", "rand",
"regex", "regex",
@ -1042,6 +1049,15 @@ dependencies = [
"serde_json", "serde_json",
] ]
[[package]]
name = "file-id"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e13be71e6ca82e91bc0cb862bebaac0b2d1924a5a1d970c822b2f98b63fda8c3"
dependencies = [
"winapi-util",
]
[[package]] [[package]]
name = "file-rotate" name = "file-rotate"
version = "0.7.5" version = "0.7.5"
@ -1123,7 +1139,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ab7d1bd1bd33cc98b0889831b72da23c0aa4df9cec7e0702f46ecea04b35db6" checksum = "5ab7d1bd1bd33cc98b0889831b72da23c0aa4df9cec7e0702f46ecea04b35db6"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"fsevent-sys", "fsevent-sys 2.0.1",
] ]
[[package]] [[package]]
@ -1135,6 +1151,15 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "fsevent-sys"
version = "4.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76ee7a02da4d231650c7cea31349b889be2f45ddb3ef3032d2ec8185f6313fd2"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "fuchsia-zircon" name = "fuchsia-zircon"
version = "0.3.3" version = "0.3.3"
@ -1339,20 +1364,21 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
[[package]] [[package]]
name = "hashbrown" name = "hashbrown"
version = "0.13.2" version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a"
dependencies = [ dependencies = [
"ahash 0.8.3", "ahash 0.8.3",
"allocator-api2",
] ]
[[package]] [[package]]
name = "hashlink" name = "hashlink"
version = "0.8.2" version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0761a1b9491c4f2e3d66aa0f62d0fba0af9a0e2852e4d48ea506632a4b56e6aa" checksum = "312f66718a2d7789ffef4f4b7b213138ed9f1eb3aa1d0d82fc99f88fb3ffd26f"
dependencies = [ dependencies = [
"hashbrown 0.13.2", "hashbrown 0.14.0",
] ]
[[package]] [[package]]
@ -1546,6 +1572,17 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "inotify"
version = "0.9.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8069d3ec154eb856955c1c0fbffefbf5f3c40a104ec912d4797314c1801abff"
dependencies = [
"bitflags",
"inotify-sys",
"libc",
]
[[package]] [[package]]
name = "inotify-sys" name = "inotify-sys"
version = "0.1.5" version = "0.1.5"
@ -1616,9 +1653,9 @@ dependencies = [
[[package]] [[package]]
name = "js-sys" name = "js-sys"
version = "0.3.63" version = "0.3.64"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f37a4a5928311ac501dee68b3c7613a1037d0edb30c8e5427bd832d55d1b790" checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a"
dependencies = [ dependencies = [
"wasm-bindgen", "wasm-bindgen",
] ]
@ -1696,6 +1733,26 @@ dependencies = [
"winapi-build", "winapi-build",
] ]
[[package]]
name = "kqueue"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c8fc60ba15bf51257aa9807a48a61013db043fcf3a78cb0d916e8e396dcad98"
dependencies = [
"kqueue-sys",
"libc",
]
[[package]]
name = "kqueue-sys"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8367585489f01bc55dd27404dcf56b95e6da061a256a666ab23be9ba96a2e587"
dependencies = [
"bitflags",
"libc",
]
[[package]] [[package]]
name = "kv-log-macro" name = "kv-log-macro"
version = "1.0.7" version = "1.0.7"
@ -1933,9 +1990,9 @@ dependencies = [
[[package]] [[package]]
name = "net2" name = "net2"
version = "0.2.38" version = "0.2.39"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74d0df99cfcd2530b2e694f6e17e7f37b8e26bb23983ac530c0c97408837c631" checksum = "b13b648036a2339d06de780866fbdfda0dde886de7b3af2ddeba8b14f4ee34ac"
dependencies = [ dependencies = [
"cfg-if 0.1.10", "cfg-if 0.1.10",
"libc", "libc",
@ -1961,8 +2018,8 @@ dependencies = [
"bitflags", "bitflags",
"filetime", "filetime",
"fsevent", "fsevent",
"fsevent-sys", "fsevent-sys 2.0.1",
"inotify", "inotify 0.7.1",
"libc", "libc",
"mio 0.6.23", "mio 0.6.23",
"mio-extras", "mio-extras",
@ -1970,6 +2027,36 @@ dependencies = [
"winapi 0.3.9", "winapi 0.3.9",
] ]
[[package]]
name = "notify"
version = "6.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5738a2795d57ea20abec2d6d76c6081186709c0024187cd5977265eda6598b51"
dependencies = [
"bitflags",
"crossbeam-channel",
"filetime",
"fsevent-sys 4.1.0",
"inotify 0.9.6",
"kqueue",
"libc",
"mio 0.8.8",
"walkdir",
"windows-sys 0.45.0",
]
[[package]]
name = "notify-debouncer-full"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "416969970ec751a5d702a88c6cd19ac1332abe997fce43f96db0418550426241"
dependencies = [
"file-id",
"notify 6.0.1",
"parking_lot 0.12.1",
"walkdir",
]
[[package]] [[package]]
name = "num-bigint" name = "num-bigint"
version = "0.4.3" version = "0.4.3"
@ -2142,7 +2229,7 @@ dependencies = [
"libc", "libc",
"redox_syscall 0.3.5", "redox_syscall 0.3.5",
"smallvec", "smallvec",
"windows-targets", "windows-targets 0.48.0",
] ]
[[package]] [[package]]
@ -2565,9 +2652,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "1.0.96" version = "1.0.97"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" checksum = "bdf3bf93142acad5821c99197022e170842cdbc1c30482b98750c688c640842a"
dependencies = [ dependencies = [
"itoa", "itoa",
"ryu", "ryu",
@ -2637,9 +2724,9 @@ dependencies = [
[[package]] [[package]]
name = "sha2" name = "sha2"
version = "0.10.6" version = "0.10.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"cpufeatures", "cpufeatures",
@ -2891,7 +2978,7 @@ dependencies = [
[[package]] [[package]]
name = "tests" name = "tests"
version = "0.18.3" version = "0.19.0"
dependencies = [ dependencies = [
"chrono", "chrono",
"crossbeam-channel", "crossbeam-channel",
@ -2902,7 +2989,7 @@ dependencies = [
"jsonrpc-http-server", "jsonrpc-http-server",
"lettre", "lettre",
"log", "log",
"notify", "notify 4.0.17",
"rand", "rand",
"regex", "regex",
"reqwest", "reqwest",
@ -3193,9 +3280,9 @@ dependencies = [
[[package]] [[package]]
name = "uuid" name = "uuid"
version = "1.3.3" version = "1.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "345444e32442451b267fc254ae85a209c64be56d2890e601a0c37ff0c3c5ecd2" checksum = "0fa2982af2eec27de306107c027578ff7f423d65f7250e40ce0fea8f45248b81"
dependencies = [ dependencies = [
"getrandom", "getrandom",
] ]
@ -3236,11 +3323,10 @@ dependencies = [
[[package]] [[package]]
name = "want" name = "want"
version = "0.3.0" version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e"
dependencies = [ dependencies = [
"log",
"try-lock", "try-lock",
] ]
@ -3258,9 +3344,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]] [[package]]
name = "wasm-bindgen" name = "wasm-bindgen"
version = "0.2.86" version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5bba0e8cb82ba49ff4e229459ff22a191bbe9a1cb3a341610c9c33efc27ddf73" checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"wasm-bindgen-macro", "wasm-bindgen-macro",
@ -3268,9 +3354,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-backend" name = "wasm-bindgen-backend"
version = "0.2.86" version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19b04bc93f9d6bdee709f6bd2118f57dd6679cf1176a1af464fca3ab0d66d8fb" checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd"
dependencies = [ dependencies = [
"bumpalo", "bumpalo",
"log", "log",
@ -3283,9 +3369,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-futures" name = "wasm-bindgen-futures"
version = "0.4.36" version = "0.4.37"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d1985d03709c53167ce907ff394f5316aa22cb4e12761295c5dc57dacb6297e" checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"js-sys", "js-sys",
@ -3295,9 +3381,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-macro" name = "wasm-bindgen-macro"
version = "0.2.86" version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14d6b024f1a526bb0234f52840389927257beb670610081360e5a03c5df9c258" checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d"
dependencies = [ dependencies = [
"quote", "quote",
"wasm-bindgen-macro-support", "wasm-bindgen-macro-support",
@ -3305,9 +3391,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-macro-support" name = "wasm-bindgen-macro-support"
version = "0.2.86" version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8" checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -3318,15 +3404,15 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-shared" name = "wasm-bindgen-shared"
version = "0.2.86" version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1"
[[package]] [[package]]
name = "web-sys" name = "web-sys"
version = "0.3.63" version = "0.3.64"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3bdd9ef4e984da1187bf8110c5cf5b845fbc87a23602cdf912386a76fcd3a7c2" checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b"
dependencies = [ dependencies = [
"js-sys", "js-sys",
"wasm-bindgen", "wasm-bindgen",
@ -3400,7 +3486,7 @@ version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f"
dependencies = [ dependencies = [
"windows-targets", "windows-targets 0.48.0",
] ]
[[package]] [[package]]
@ -3418,13 +3504,37 @@ dependencies = [
"windows_x86_64_msvc 0.42.2", "windows_x86_64_msvc 0.42.2",
] ]
[[package]]
name = "windows-sys"
version = "0.45.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
dependencies = [
"windows-targets 0.42.2",
]
[[package]] [[package]]
name = "windows-sys" name = "windows-sys"
version = "0.48.0" version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [ dependencies = [
"windows-targets", "windows-targets 0.48.0",
]
[[package]]
name = "windows-targets"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"
dependencies = [
"windows_aarch64_gnullvm 0.42.2",
"windows_aarch64_msvc 0.42.2",
"windows_i686_gnu 0.42.2",
"windows_i686_msvc 0.42.2",
"windows_x86_64_gnu 0.42.2",
"windows_x86_64_gnullvm 0.42.2",
"windows_x86_64_msvc 0.42.2",
] ]
[[package]] [[package]]

View File

@ -3,7 +3,7 @@ members = ["ffplayout-api", "ffplayout-engine", "lib", "tests"]
default-members = ["ffplayout-api", "ffplayout-engine", "tests"] default-members = ["ffplayout-api", "ffplayout-engine", "tests"]
[workspace.package] [workspace.package]
version = "0.18.3" version = "0.19.0"
license = "GPL-3.0" license = "GPL-3.0"
repository = "https://github.com/ffplayout/ffplayout" repository = "https://github.com/ffplayout/ffplayout"
authors = ["Jonathan Baecker <jonbae77@gmail.com>"] authors = ["Jonathan Baecker <jonbae77@gmail.com>"]

View File

@ -1,43 +0,0 @@
FROM almalinux:9 AS base
ENV container docker
RUN dnf -y install libgomp && \
dnf clean all;
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \
systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*; \
rm -f /etc/systemd/system/*.wants/*; \
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*; \
rm -f /lib/systemd/system/anaconda.target.wants/*
FROM base
ARG FFPLAYOUT_VERSION=0.18.1
COPY README.md *.rpm /tmp/
RUN dnf update -y && \
dnf install -y epel-release && \
dnf install -y 'dnf-command(config-manager)' && \
dnf config-manager --set-enabled crb && \
dnf install -y --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-$(rpm -E %rhel).noarch.rpm && \
dnf install -y --nogpgcheck https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-$(rpm -E %rhel).noarch.rpm && \
dnf install -y ffmpeg ffmpeg-devel wget dejavu-sans-fonts sudo && \
dnf clean all
RUN [[ -f /tmp/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm ]] || wget -q "https://github.com/ffplayout/ffplayout/releases/download/v${FFPLAYOUT_VERSION}/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm" -P /tmp/ && \
dnf install -y /tmp/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm && \
rm /tmp/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm && \
mkdir -p /home/ffpu && chown -R ffpu: /home/ffpu && \
systemctl enable ffplayout && \
systemctl enable ffpapi && \
ffpapi -u admin -p admin -m contact@example.com
EXPOSE 8787
VOLUME [ "/sys/fs/cgroup" ]
CMD ["/usr/sbin/init"]

View File

@ -1,8 +1,6 @@
FROM centos:7 AS base FROM almalinux:9 AS base
ENV container docker ENV container docker
RUN yum -y install libgomp && \
yum clean all
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \ RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \
systemd-tmpfiles-setup.service ] || rm -f $i; done); \ systemd-tmpfiles-setup.service ] || rm -f $i; done); \
@ -14,247 +12,27 @@ RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \
rm -f /lib/systemd/system/basic.target.wants/*; \ rm -f /lib/systemd/system/basic.target.wants/*; \
rm -f /lib/systemd/system/anaconda.target.wants/* rm -f /lib/systemd/system/anaconda.target.wants/*
FROM base AS build
WORKDIR /tmp/workdir
ENV FFMPEG_VERSION=5.1.2 \
AOM_VERSION=v1.0.0 \
LIBASS_VERSION=0.13.7 \
FREETYPE_VERSION=2.10.4 \
FRIBIDI_VERSION=0.19.7 \
FONTCONFIG_VERSION=2.12.4 \
SRC=/usr/local
ARG LIBASS_SHA256SUM="8fadf294bf701300d4605e6f1d92929304187fca4b8d8a47889315526adbafd7 0.13.7.tar.gz"
ARG FREETYPE_SHA256SUM="5eab795ebb23ac77001cfb68b7d4d50b5d6c7469247b0b01b2c953269f658dac freetype-2.10.4.tar.gz"
ARG FRIBIDI_SHA256SUM="3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 0.19.7.tar.gz"
ARG LD_LIBRARY_PATH=/opt/ffmpeg/lib
ARG MAKEFLAGS="-j2"
ARG PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig"
ARG PREFIX=/opt/ffmpeg
ARG LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64"
RUN buildDeps="autoconf \
automake \
bzip2 \
cmake3 \
diffutils \
expat-devel \
file \
gcc \
gcc-c++ \
git \
gperf \
libtool \
make \
perl \
python3 \
openssl-devel \
tar \
yasm \
which \
zlib-devel" && \
echo "${SRC}/lib" > /etc/ld.so.conf.d/libc.conf && \
yum --enablerepo=extras install -y epel-release && \
yum --enablerepo=epel install -y ${buildDeps} && \
alternatives --install /usr/bin/cmake cmake /usr/bin/cmake3 0 && \
# Install the tools required to build nasm 2.14.02 \
nasmDeps="asciidoc \
perl-Font-TTF \
perl-Sort-Versions \
xmlto" && \
yum --enablerepo=epel install -y ${nasmDeps} && \
# Compile and install nasm 2.14.02 \
DIR=/tmp/nasm && \
mkdir -p ${DIR} && \
curl -LSs https://www.nasm.us/pub/nasm/releasebuilds/2.14.02/nasm-2.14.02.tar.gz | \
tar xzC ${DIR} --strip-components=1 && \
pushd ${DIR} && \
./configure --host=x86_64-redhat-linux-gnu \
--build=x86_64-redhat-linux-gnu \
--prefix=/usr/local \
--exec-prefix=/usr/local \
--bindir=/usr/local/bin \
--sbindir=/usr/local/sbin \
--sysconfdir=/usr/local/etc \
--datadir=/usr/local/share \
--includedir=/usr/local/include \
--libdir=/usr/local/lib \
--libexecdir=/usr/local/libexec \
--enable-sections && \
make all && \
make install && \
make install_rdf && \
popd && rm -rf ${DIR} && \
alternatives --install /usr/bin/nasm nasm /usr/local/bin/nasm 0 && \
# Now that we have a modern nasm build and available, we can undo the last \
# yum transaction as none of those packages are required for the rest of the build \
yum history undo $(yum history info | grep 'Transaction ID' | awk -F: '{print$2}' | tr -d ' ') -y && \
yum autoremove -y
RUN yum -y install \
lame-libs \
openjpeg-libs \
opus \
srt-libs \
libvorbis \
libvpx \
libwebp \
libogg \
x264-libs \
x265-libs \
zeromq
## fridibi https://www.fribidi.org/
RUN \
DIR=/tmp/fribidi && \
mkdir -p ${DIR} && \
cd ${DIR} && \
curl -sLO https://github.com/fribidi/fribidi/archive/${FRIBIDI_VERSION}.tar.gz && \
echo ${FRIBIDI_SHA256SUM} | sha256sum --check && \
tar -zx --strip-components=1 -f ${FRIBIDI_VERSION}.tar.gz && \
sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib bin/' Makefile.am && \
./bootstrap --no-config --auto && \
./configure --prefix="${PREFIX}" --disable-static --enable-shared && \
make -j1 && \
make install && \
rm -rf ${DIR}
## freetype https://www.freetype.org/
RUN \
DIR=/tmp/freetype && \
mkdir -p ${DIR} && \
cd ${DIR} && \
curl -sLO https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \
echo ${FREETYPE_SHA256SUM} | sha256sum --check && \
tar -zx --strip-components=1 -f freetype-${FREETYPE_VERSION}.tar.gz && \
./configure --prefix="${PREFIX}" --disable-static --enable-shared && \
make -j $(nproc | awk '{print $1 / 2}') && \
make install && \
rm -rf ${DIR}
## fontconfig https://www.freedesktop.org/wiki/Software/fontconfig/
RUN \
DIR=/tmp/fontconfig && \
mkdir -p ${DIR} && \
cd ${DIR} && \
curl -sLO https://www.freedesktop.org/software/fontconfig/release/fontconfig-${FONTCONFIG_VERSION}.tar.bz2 && \
tar -jx --strip-components=1 -f fontconfig-${FONTCONFIG_VERSION}.tar.bz2 && \
./configure --prefix="${PREFIX}" --disable-static --enable-shared && \
make -j $(nproc | awk '{print $1 / 2}') && \
make install && \
rm -rf ${DIR}
## libass https://github.com/libass/libass
RUN \
DIR=/tmp/libass && \
mkdir -p ${DIR} && \
cd ${DIR} && \
curl -sLO https://github.com/libass/libass/archive/${LIBASS_VERSION}.tar.gz && \
echo ${LIBASS_SHA256SUM} | sha256sum --check && \
tar -zx --strip-components=1 -f ${LIBASS_VERSION}.tar.gz && \
./autogen.sh && \
./configure --prefix="${PREFIX}" --disable-static --enable-shared && \
make -j $(nproc | awk '{print $1 / 2}') && \
make install && \
rm -rf ${DIR}
RUN \
DIR=/tmp/aom && \
git clone --branch ${AOM_VERSION} --depth 1 https://aomedia.googlesource.com/aom ${DIR} ; \
cd ${DIR} ; \
rm -rf CMakeCache.txt CMakeFiles ; \
mkdir -p ./aom_build ; \
cd ./aom_build ; \
cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 ..; \
make ; \
make install ; \
rm -rf ${DIR}
## Download ffmpeg https://ffmpeg.org/
RUN \
DIR=/tmp/ffmpeg && mkdir -p ${DIR} && cd ${DIR} && \
curl -sLO https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \
tar -jx --strip-components=1 -f ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \
./configure --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-gpl --extra-libs=-ldl && \
make ; make install
## Build ffmpeg https://ffmpeg.org/
RUN \
DIR=/tmp/ffmpeg && cd ${DIR} && \
./configure \
--disable-debug \
--disable-doc \
--disable-ffplay \
--enable-gpl \
--enable-libaom \
--enable-libass \
--enable-libfreetype \
--enable-libmp3lame \
--enable-libopenjpeg \
--enable-libopus \
--enable-libsrt \
--enable-libvorbis \
--enable-libvpx \
--enable-libwebp \
--enable-libx264 \
--enable-libx265 \
--enable-libzmq \
--enable-nonfree \
--enable-fontconfig \
--enable-postproc \
--enable-shared \
--enable-version3 \
--extra-cflags="-I${PREFIX}/include" \
--extra-ldflags="-L${PREFIX}/lib" \
--extra-libs=-ldl \
--extra-libs=-lpthread \
--prefix="${PREFIX}" && \
make clean && \
make -j $(nproc | awk '{print $1 / 2}') && \
make install && \
make tools/zmqsend && cp tools/zmqsend ${PREFIX}/bin/ && \
make distclean && \
hash -r && \
cd tools && \
make qt-faststart && cp qt-faststart ${PREFIX}/bin/
RUN \
ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp {} /usr/local/lib64/ && \
for lib in /usr/local/lib64/*.so.*; do ln -s "${lib##*/}" "${lib%%.so.*}".so; done && \
cp ${PREFIX}/bin/* /usr/local/bin/ && \
cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ && \
LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib ffmpeg -buildconf && \
cp -r ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include && \
mkdir -p /usr/local/lib64/pkgconfig && \
for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/libsw*.pc; do \
sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib64/pkgconfig/"${pc##*/}"; \
done
FROM base FROM base
ARG FFPLAYOUT_VERSION=0.18.1 ARG FFPLAYOUT_VERSION=0.18.3
COPY README.md *.rpm /tmp/
ENV LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib RUN dnf update -y && \
dnf install -y epel-release && \
dnf install -y 'dnf-command(config-manager)' && \
dnf config-manager --set-enabled crb && \
dnf install -y --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-$(rpm -E %rhel).noarch.rpm && \
dnf install -y --nogpgcheck https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-$(rpm -E %rhel).noarch.rpm && \
dnf install -y ffmpeg ffmpeg-devel wget dejavu-sans-fonts sudo && \
dnf clean all
COPY --from=build /usr/local/ /usr/local/ RUN [[ -f /tmp/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm ]] || wget -q "https://github.com/ffplayout/ffplayout/releases/download/v${FFPLAYOUT_VERSION}/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm" -P /tmp/ && \
dnf install -y /tmp/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm && \
ADD ./overide.conf /etc/systemd/system/ffplayout.service.d/overide.conf rm /tmp/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm && \
ADD ./overide.conf /etc/systemd/system/ffpapi.service.d/overide.conf mkdir -p /home/ffpu && chown -R ffpu: /home/ffpu && \
systemctl enable ffplayout && \
RUN \ systemctl enable ffpapi && \
yum update -y \ ffpapi -u admin -p admin -m contact@example.com
&& yum install -y wget dejavu-sans-fonts sudo \
&& wget -q -O /tmp/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm "https://github.com/ffplayout/ffplayout/releases/download/v${FFPLAYOUT_VERSION}/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm" \
&& yum install -y /tmp/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm \
&& yum clean all \
&& rm /tmp/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm \
&& mkdir -p /home/ffpu && chown -R ffpu: /home/ffpu \
&& systemctl enable ffplayout \
&& systemctl enable ffpapi \
&& ffpapi -u admin -p admin -m contact@example.com
EXPOSE 8787 EXPOSE 8787

View File

@ -3,14 +3,13 @@
## Base Image ## Base Image
Use of [centos image](https://hub.docker.com/_/centos) as base image as it offer the possibility to use systemd. Use of [CentOS image](https://hub.docker.com/_/centos) as base image as it offer the possibility to use systemd.
In order to run systemd in a container it has to run in privileged mode and bind to the `cgroup` of the host. In order to run systemd in a container it has to run in privileged mode and bind to the `cgroup` of the host.
## Image ## Image
In addition to the base image, there is the compilation of ffmpeg and all lib from source based on https://github.com/jrottenberg/ffmpeg. In addition to the base image, there is the compilation of ffmpeg and all lib from source based on https://github.com/jrottenberg/ffmpeg.
We can't use directly the image from `jrottenberg/ffmpeg` as it compile ffmpeg with the flag `--enable-small` that remove some part of the json from the ffprobe command. We can't use directly the image from `jrottenberg/ffmpeg` as it compile ffmpeg with the flag `--enable-small` that remove some part of the json from the ffprobe command.
There is also a conf file to override the ffplayout.service as the libs for ffmpeg are not in the defauft place which is copied to `/etc/systemd/system/ffplayout.service.d/overide.conf`.
The image is build with a default user/pass `admin/admin`. The image is build with a default user/pass `admin/admin`.
@ -46,7 +45,7 @@ example of command to start the container:
`docker run -ti -v /sys/fs/cgroup:/sys/fs/cgroup:ro --cap-add SYS_ADMIN -p 8787:8787 ffplayout-image` `docker run -ti -v /sys/fs/cgroup:/sys/fs/cgroup:ro --cap-add SYS_ADMIN -p 8787:8787 ffplayout-image`
Note from centos docker hub page Note from CentOS docker hub page
` `
There have been reports that if you're using an Ubuntu host, you will need to add -v /tmp/$(mktemp -d):/run in addition to the cgroups mount. There have been reports that if you're using an Ubuntu host, you will need to add -v /tmp/$(mktemp -d):/run in addition to the cgroups mount.
` `

View File

@ -1,8 +1,6 @@
FROM centos:7 AS base FROM almalinux:9 AS base
ENV container docker ENV container docker
RUN yum -y install libgomp && \
yum clean all;
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \ RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \
systemd-tmpfiles-setup.service ] || rm -f $i; done); \ systemd-tmpfiles-setup.service ] || rm -f $i; done); \
@ -18,422 +16,123 @@ FROM base AS build
WORKDIR /tmp/workdir WORKDIR /tmp/workdir
ENV FFMPEG_VERSION=5.1.2 \ ENV SRC=/usr/local \
AOM_VERSION=v1.0.0 \ BUILD=/tmp/build
FDKAAC_VERSION=0.1.5 \
FONTCONFIG_VERSION=2.12.4 \
FREETYPE_VERSION=2.10.4 \
FRIBIDI_VERSION=0.19.7 \
KVAZAAR_VERSION=2.0.0 \
LAME_VERSION=3.100 \
LIBASS_VERSION=0.13.7 \
LIBPTHREAD_STUBS_VERSION=0.4 \
OGG_VERSION=1.3.2 \
OPUS_VERSION=1.2 \
OPENJPEG_VERSION=2.1.2 \
VORBIS_VERSION=1.3.5 \
VPX_VERSION=1.8.0 \
WEBP_VERSION=1.0.2 \
X264_VERSION=20170226-2245-stable \
X265_VERSION=3.4 \
LIBZMQ_VERSION=4.3.2 \
LIBSRT_VERSION=1.4.1 \
LIBPNG_VERSION=1.6.9 \
SRC=/usr/local
ARG FREETYPE_SHA256SUM="5eab795ebb23ac77001cfb68b7d4d50b5d6c7469247b0b01b2c953269f658dac freetype-2.10.4.tar.gz"
ARG FRIBIDI_SHA256SUM="3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 0.19.7.tar.gz"
ARG LIBASS_SHA256SUM="8fadf294bf701300d4605e6f1d92929304187fca4b8d8a47889315526adbafd7 0.13.7.tar.gz"
ARG OGG_SHA256SUM="e19ee34711d7af328cb26287f4137e70630e7261b17cbe3cd41011d73a654692 libogg-1.3.2.tar.gz"
ARG OPUS_SHA256SUM="77db45a87b51578fbc49555ef1b10926179861d854eb2613207dc79d9ec0a9a9 opus-1.2.tar.gz"
ARG VORBIS_SHA256SUM="6efbcecdd3e5dfbf090341b485da9d176eb250d893e3eb378c428a2db38301ce libvorbis-1.3.5.tar.gz"
ARG LIBZMQ_SHA256SUM="02ecc88466ae38cf2c8d79f09cfd2675ba299a439680b64ade733e26a349edeb v4.3.2.tar.gz"
ARG LD_LIBRARY_PATH=/opt/ffmpeg/lib ARG LD_LIBRARY_PATH=/opt/ffmpeg/lib
ARG MAKEFLAGS="-j2" ARG PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig:/lib64/pkgconfig"
ARG PKG_CONFIG_PATH="/opt/ffmpeg/share/pkgconfig:/opt/ffmpeg/lib/pkgconfig:/opt/ffmpeg/lib64/pkgconfig" ARG LOCALDESTDIR=/opt/ffmpeg
ARG PREFIX=/opt/ffmpeg
ARG LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64" ARG LD_LIBRARY_PATH="/opt/ffmpeg/lib:/opt/ffmpeg/lib64"
RUN buildDeps="autoconf \ RUN \
automake \ buildDeps="bzip2 gperf which libticonv autoconf automake cmake diffutils file gcc \
bzip2 \ ninja-build wget nasm gcc-c++ git libtool make perl yasm meson x264-devel zlib-devel \
cmake3 \ expat-devel fontconfig-devel libxml2-devel lame-devel libpng-devel numactl-devel \
diffutils \ fribidi-devel zeromq-devel freetype-devel opus-devel libass-devel openssl-devel" && \
expat-devel \
file \
gcc \
gcc-c++ \
git \
gperf \
libtool \
make \
perl \
python3 \
openssl-devel \
tar \
yasm \
which \
zlib-devel" && \
echo "${SRC}/lib" > /etc/ld.so.conf.d/libc.conf && \ echo "${SRC}/lib" > /etc/ld.so.conf.d/libc.conf && \
yum --enablerepo=extras install -y epel-release && \ dnf install -y epel-release && \
yum --enablerepo=epel install -y ${buildDeps} && \ dnf install -y 'dnf-command(config-manager)' && \
alternatives --install /usr/bin/cmake cmake /usr/bin/cmake3 0 && \ dnf config-manager --set-enabled crb && \
# Install the tools required to build nasm 2.14.02 \ dnf install -y --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-$(rpm -E %rhel).noarch.rpm && \
nasmDeps="asciidoc \ dnf install -y --nogpgcheck https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-$(rpm -E %rhel).noarch.rpm && \
perl-Font-TTF \ dnf install -y ${buildDeps} && \
perl-Sort-Versions \ mkdir -p ${BUILD}
xmlto" && \
yum --enablerepo=epel install -y ${nasmDeps} && \
# Compile and install nasm 2.14.02 \
DIR=/tmp/nasm && \
mkdir -p ${DIR} && \
curl -LSs https://www.nasm.us/pub/nasm/releasebuilds/2.14.02/nasm-2.14.02.tar.gz | \
tar xzC ${DIR} --strip-components=1 && \
pushd ${DIR} && \
./configure --host=x86_64-redhat-linux-gnu \
--build=x86_64-redhat-linux-gnu \
--prefix=/usr/local \
--exec-prefix=/usr/local \
--bindir=/usr/local/bin \
--sbindir=/usr/local/sbin \
--sysconfdir=/usr/local/etc \
--datadir=/usr/local/share \
--includedir=/usr/local/include \
--libdir=/usr/local/lib \
--libexecdir=/usr/local/libexec \
--enable-sections && \
make all && \
make install && \
make install_rdf && \
popd && rm -rf ${DIR} && \
alternatives --install /usr/bin/nasm nasm /usr/local/bin/nasm 0 && \
# Now that we have a modern nasm build and available, we can undo the last \
# yum transaction as none of those packages are required for the rest of the build \
yum history undo $(yum history info | grep 'Transaction ID' | awk -F: '{print$2}' | tr -d ' ') -y && \
yum autoremove -y
## x264 http://www.videolan.org/developers/x264.html
RUN \ RUN \
DIR=/tmp/x264 && \ cd ${BUILD} && \
mkdir -p ${DIR} && \ git clone --depth 1 "https://github.com/Haivision/srt.git" && \
cd ${DIR} && \ cd srt && \
curl -sL https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-${X264_VERSION}.tar.bz2 | \ mkdir build && \
tar -jx --strip-components=1 && \ cd build && \
./configure --prefix="${PREFIX}" --enable-shared --enable-pic --disable-cli && \ cmake .. -DCMAKE_INSTALL_PREFIX="$LOCALDESTDIR" -DENABLE_SHARED:BOOLEAN=OFF -DUSE_STATIC_LIBSTDCXX:BOOLEAN=ON \
-DENABLE_CXX11:BOOLEAN=OFF -DCMAKE_INSTALL_BINDIR="bin" -DCMAKE_INSTALL_LIBDIR="lib" -DCMAKE_INSTALL_INCLUDEDIR="include" && \
make -j $(nproc | awk '{print $1 / 2}') && \ make -j $(nproc | awk '{print $1 / 2}') && \
make install && \ make install
rm -rf ${DIR}
### x265 http://x265.org/
RUN \ RUN \
DIR=/tmp/x265 && \ cd ${BUILD} && \
mkdir -p ${DIR} && \ git clone --depth 1 "https://code.videolan.org/rist/librist.git" && \
cd ${DIR} && \ cd librist && \
curl -sL https://github.com/videolan/x265/archive/refs/tags/${X265_VERSION}.tar.gz | \ mkdir build && \
tar -zx && \ cd build && \
cd x265-${X265_VERSION}/build/linux && \ meson setup --default-library=static --prefix "$LOCALDESTDIR" --libdir="$LOCALDESTDIR/lib" .. && \
sed -i "/-DEXTRA_LIB/ s/$/ -DCMAKE_INSTALL_PREFIX=\${PREFIX}/" multilib.sh && \ ninja && \
sed -i "/^cmake/ s/$/ -DENABLE_CLI=OFF/" multilib.sh && \ ninja install
./multilib.sh && \
make -C 8bit install && \
rm -rf ${DIR}
### libogg https://www.xiph.org/ogg/
RUN \ RUN \
DIR=/tmp/ogg && \ cd ${BUILD} && \
mkdir -p ${DIR} && \ git clone --depth 1 "https://github.com/mstorsjo/fdk-aac" && \
cd ${DIR} && \ cd fdk-aac && \
curl -sLO http://downloads.xiph.org/releases/ogg/libogg-${OGG_VERSION}.tar.gz && \
echo ${OGG_SHA256SUM} | sha256sum --check && \
tar -zx --strip-components=1 -f libogg-${OGG_VERSION}.tar.gz && \
./configure --prefix="${PREFIX}" --enable-shared && \
make -j $(nproc | awk '{print $1 / 2}') && \
make install && \
rm -rf ${DIR}
### libopus https://www.opus-codec.org/
RUN \
DIR=/tmp/opus && \
mkdir -p ${DIR} && \
cd ${DIR} && \
curl -sLO https://archive.mozilla.org/pub/opus/opus-${OPUS_VERSION}.tar.gz && \
echo ${OPUS_SHA256SUM} | sha256sum --check && \
tar -zx --strip-components=1 -f opus-${OPUS_VERSION}.tar.gz && \
autoreconf -fiv && \
./configure --prefix="${PREFIX}" --enable-shared && \
make -j $(nproc | awk '{print $1 / 2}') && \
make install && \
rm -rf ${DIR}
### libvorbis https://xiph.org/vorbis/
RUN \
DIR=/tmp/vorbis && \
mkdir -p ${DIR} && \
cd ${DIR} && \
curl -sLO http://downloads.xiph.org/releases/vorbis/libvorbis-${VORBIS_VERSION}.tar.gz && \
echo ${VORBIS_SHA256SUM} | sha256sum --check && \
tar -zx --strip-components=1 -f libvorbis-${VORBIS_VERSION}.tar.gz && \
./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \
make -j $(nproc | awk '{print $1 / 2}') && \
make install && \
rm -rf ${DIR}
### libvpx https://www.webmproject.org/code/
RUN \
DIR=/tmp/vpx && \
mkdir -p ${DIR} && \
cd ${DIR} && \
curl -sL https://codeload.github.com/webmproject/libvpx/tar.gz/v${VPX_VERSION} | \
tar -zx --strip-components=1 && \
./configure --prefix="${PREFIX}" --enable-vp8 --enable-vp9 --enable-vp9-highbitdepth --enable-pic --enable-shared \
--disable-debug --disable-examples --disable-docs --disable-install-bins && \
make -j $(nproc | awk '{print $1 / 2}') && \
make install && \
rm -rf ${DIR}
### libwebp https://developers.google.com/speed/webp/
RUN \
DIR=/tmp/vebp && \
mkdir -p ${DIR} && \
cd ${DIR} && \
curl -sL https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-${WEBP_VERSION}.tar.gz | \
tar -zx --strip-components=1 && \
./configure --prefix="${PREFIX}" --enable-shared && \
make -j $(nproc | awk '{print $1 / 2}') && \
make install && \
rm -rf ${DIR}
### libmp3lame http://lame.sourceforge.net/
RUN \
DIR=/tmp/lame && \
mkdir -p ${DIR} && \
cd ${DIR} && \
curl -sL https://sourceforge.net/projects/lame/files/lame/${LAME_VERSION}/lame-${LAME_VERSION}.tar.gz/download | \
tar -zx --strip-components=1 && \
./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --enable-shared --enable-nasm --disable-frontend && \
make -j $(nproc | awk '{print $1 / 2}') && \
make install && \
rm -rf ${DIR}
### fdk-aac https://github.com/mstorsjo/fdk-aac
RUN \
DIR=/tmp/fdk-aac && \
mkdir -p ${DIR} && \
cd ${DIR} && \
curl -sL https://github.com/mstorsjo/fdk-aac/archive/v${FDKAAC_VERSION}.tar.gz | \
tar -zx --strip-components=1 && \
autoreconf -fiv && \
./configure --prefix="${PREFIX}" --enable-shared --datadir="${DIR}" && \
make -j $(nproc | awk '{print $1 / 2}') && \
make install && \
rm -rf ${DIR}
## openjpeg https://github.com/uclouvain/openjpeg
RUN \
DIR=/tmp/openjpeg && \
mkdir -p ${DIR} && \
cd ${DIR} && \
curl -sL https://github.com/uclouvain/openjpeg/archive/v${OPENJPEG_VERSION}.tar.gz | \
tar -zx --strip-components=1 && \
cmake -DBUILD_THIRDPARTY:BOOL=ON -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \
make -j $(nproc | awk '{print $1 / 2}') && \
make install && \
rm -rf ${DIR}
## freetype https://www.freetype.org/
RUN \
DIR=/tmp/freetype && \
mkdir -p ${DIR} && \
cd ${DIR} && \
curl -sLO https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \
echo ${FREETYPE_SHA256SUM} | sha256sum --check && \
tar -zx --strip-components=1 -f freetype-${FREETYPE_VERSION}.tar.gz && \
./configure --prefix="${PREFIX}" --disable-static --enable-shared && \
make -j $(nproc | awk '{print $1 / 2}') && \
make install && \
rm -rf ${DIR}
## fridibi https://www.fribidi.org/
RUN \
DIR=/tmp/fribidi && \
mkdir -p ${DIR} && \
cd ${DIR} && \
curl -sLO https://github.com/fribidi/fribidi/archive/${FRIBIDI_VERSION}.tar.gz && \
echo ${FRIBIDI_SHA256SUM} | sha256sum --check && \
tar -zx --strip-components=1 -f ${FRIBIDI_VERSION}.tar.gz && \
sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib bin/' Makefile.am && \
./bootstrap --no-config --auto && \
./configure --prefix="${PREFIX}" --disable-static --enable-shared && \
make -j1 && \
make install && \
rm -rf ${DIR}
## fontconfig https://www.freedesktop.org/wiki/Software/fontconfig/
RUN \
DIR=/tmp/fontconfig && \
mkdir -p ${DIR} && \
cd ${DIR} && \
curl -sLO https://www.freedesktop.org/software/fontconfig/release/fontconfig-${FONTCONFIG_VERSION}.tar.bz2 && \
tar -jx --strip-components=1 -f fontconfig-${FONTCONFIG_VERSION}.tar.bz2 && \
./configure --prefix="${PREFIX}" --disable-static --enable-shared && \
make -j $(nproc | awk '{print $1 / 2}') && \
make install && \
rm -rf ${DIR}
## libass https://github.com/libass/libass
RUN \
DIR=/tmp/libass && \
mkdir -p ${DIR} && \
cd ${DIR} && \
curl -sLO https://github.com/libass/libass/archive/${LIBASS_VERSION}.tar.gz && \
echo ${LIBASS_SHA256SUM} | sha256sum --check && \
tar -zx --strip-components=1 -f ${LIBASS_VERSION}.tar.gz && \
./autogen.sh && \ ./autogen.sh && \
./configure --prefix="${PREFIX}" --disable-static --enable-shared && \ ./configure --prefix="$LOCALDESTDIR" --enable-shared=no && \
make -j $(nproc | awk '{print $1 / 2}') && \ make -j $(nproc | awk '{print $1 / 2}') && \
make install && \ make install
rm -rf ${DIR}
## kvazaar https://github.com/ultravideo/kvazaar
RUN \ RUN \
DIR=/tmp/kvazaar && \ cd ${BUILD} && \
mkdir -p ${DIR} && \ git clone --depth 1 "https://gitlab.com/AOMediaCodec/SVT-AV1.git" && \
cd ${DIR} && \ cd SVT-AV1/Build && \
curl -sLO https://github.com/ultravideo/kvazaar/archive/v${KVAZAAR_VERSION}.tar.gz && \ rm -rf * && \
tar -zx --strip-components=1 -f v${KVAZAAR_VERSION}.tar.gz && \ cmake .. -G"Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$LOCALDESTDIR" -DCMAKE_BUILD_TYPE=Release \
./autogen.sh && \ -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_BINDIR="bin" -DCMAKE_INSTALL_LIBDIR="lib" -DCMAKE_INSTALL_INCLUDEDIR="include" && \
./configure --prefix="${PREFIX}" --disable-static --enable-shared && \
make -j $(nproc | awk '{print $1 / 2}') && \ make -j $(nproc | awk '{print $1 / 2}') && \
make install && \ make install
rm -rf ${DIR}
RUN \ RUN \
DIR=/tmp/aom && \ cd ${BUILD} && \
git clone --branch ${AOM_VERSION} --depth 1 https://aomedia.googlesource.com/aom ${DIR} && \ git clone --depth 1 "https://code.videolan.org/videolan/dav1d.git" && \
cd ${DIR} && \ cd dav1d && \
rm -rf CMakeCache.txt CMakeFiles && \ mkdir build && \
mkdir -p ./aom_build && \ cd build && \
cd ./aom_build && \ meson setup -Denable_tools=false -Denable_tests=false --default-library=static .. --prefix "$LOCALDESTDIR" --libdir="$LOCALDESTDIR/lib" && \
cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 .. && \ ninja && \
make && \ ninja install
make install && \
rm -rf ${DIR}
RUN \ RUN \
DIR=/tmp/libpthread-stubs && \ cd ${BUILD} && \
mkdir -p ${DIR} && \ git clone "https://github.com/webmproject/libvpx.git" && \
cd ${DIR} && \ cd libvpx && \
curl -sLO https://xcb.freedesktop.org/dist/libpthread-stubs-${LIBPTHREAD_STUBS_VERSION}.tar.gz && \ ./configure --prefix="$LOCALDESTDIR" --disable-shared --enable-static --disable-unit-tests --disable-docs --enable-postproc --enable-vp9-postproc --enable-runtime-cpu-detect && \
tar -zx --strip-components=1 -f libpthread-stubs-${LIBPTHREAD_STUBS_VERSION}.tar.gz && \ make -j $(nproc | awk '{print $1 / 2}') && \
./configure --prefix="${PREFIX}" && \ make install
RUN \
cd ${BUILD} && \
git clone "https://bitbucket.org/multicoreware/x265_git.git" x265 && \
cd x265/build && \
rm -rf * && \
cmake ../source -DCMAKE_INSTALL_PREFIX="$LOCALDESTDIR" -DENABLE_SHARED:BOOLEAN=OFF -DCMAKE_CXX_FLAGS_RELEASE:STRING="-O3 -DNDEBUG" && \
make -j $(nproc | awk '{print $1 / 2}') && \ make -j $(nproc | awk '{print $1 / 2}') && \
make install && \ make install
rm -rf ${DIR}
## libzmq https://github.com/zeromq/libzmq/
RUN \ RUN \
DIR=/tmp/libzmq && \ cd ${BUILD} && \
mkdir -p ${DIR} && \ wget "https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2" && \
cd ${DIR} && \ tar xfvj ffmpeg-snapshot.tar.bz2 && \
curl -sLO https://github.com/zeromq/libzmq/archive/v${LIBZMQ_VERSION}.tar.gz && \ rm -rf ffmpeg-snapshot.tar.bz2 && \
echo ${LIBZMQ_SHA256SUM} | sha256sum --check && \ cd ffmpeg && \
tar -xz --strip-components=1 -f v${LIBZMQ_VERSION}.tar.gz && \ ./configure --prefix="$LOCALDESTDIR" --enable-pthreads --extra-libs=-lpthread \
./autogen.sh && \ --disable-debug --disable-shared --disable-doc --enable-gpl --enable-version3 --pkg-config-flags=--static \
./configure --prefix="${PREFIX}" && \ --enable-nonfree --enable-runtime-cpudetect --enable-fontconfig \
--enable-openssl --enable-libass --enable-libfdk-aac --enable-libfreetype \
--enable-libfribidi --enable-libmp3lame --enable-libopus --enable-libvpx --enable-librist \
--enable-libsrt --enable-libx264 --enable-libx265 --enable-libzmq --enable-libsvtav1 --enable-libdav1d && \
make -j $(nproc | awk '{print $1 / 2}') && \ make -j $(nproc | awk '{print $1 / 2}') && \
make check && \ make install
make install && \
rm -rf ${DIR}
## libsrt https://github.com/Haivision/srt
RUN \
DIR=/tmp/srt && \
mkdir -p ${DIR} && \
cd ${DIR} && \
curl -sLO https://github.com/Haivision/srt/archive/v${LIBSRT_VERSION}.tar.gz && \
tar -xz --strip-components=1 -f v${LIBSRT_VERSION}.tar.gz && \
cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \
make -j $(nproc | awk '{print $1 / 2}') && \
make install && \
rm -rf ${DIR}
## libpng
RUN \
DIR=/tmp/png && \
mkdir -p ${DIR} && \
cd ${DIR} && \
git clone https://git.code.sf.net/p/libpng/code ${DIR} -b v${LIBPNG_VERSION} --depth 1 && \
./autogen.sh && \
./configure --prefix="${PREFIX}" && \
make check && \
make install && \
rm -rf ${DIR}
## Download ffmpeg https://ffmpeg.org/
RUN \
DIR=/tmp/ffmpeg && mkdir -p ${DIR} && cd ${DIR} && \
curl -sLO https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \
tar -jx --strip-components=1 -f ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \
./configure --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-gpl --extra-libs=-ldl && \
make && make install
## Build ffmpeg https://ffmpeg.org/
RUN \
DIR=/tmp/ffmpeg && cd ${DIR} && \
./configure \
--disable-debug \
--disable-doc \
--disable-ffplay \
--enable-gpl \
--enable-libaom \
--enable-libass \
--enable-libfdk_aac \
--enable-libfreetype \
--enable-libmp3lame \
--enable-libopenjpeg \
--enable-libopus \
--enable-libsrt \
--enable-libvorbis \
--enable-libvpx \
--enable-libwebp \
--enable-libx264 \
--enable-libx265 \
--enable-libzmq \
--enable-nonfree \
--enable-fontconfig \
--enable-postproc \
--enable-shared \
--enable-version3 \
--extra-cflags="-I${PREFIX}/include" \
--extra-ldflags="-L${PREFIX}/lib" \
--extra-libs=-ldl \
--extra-libs=-lpthread \
--prefix="${PREFIX}" && \
make clean && \
make -j $(nproc | awk '{print $1 / 2}') && \
make install && \
make tools/zmqsend && cp tools/zmqsend ${PREFIX}/bin/ && \
make distclean && \
hash -r && \
cd tools && \
make qt-faststart && cp qt-faststart ${PREFIX}/bin/
RUN \ RUN \
ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp {} /usr/local/lib64/ && \ cd / && \
for lib in /usr/local/lib64/*.so.*; do ln -s "${lib##*/}" "${lib%%.so.*}".so; done && \ cp /opt/ffmpeg/bin/ff* /usr/local/bin/ && \
cp ${PREFIX}/bin/* /usr/local/bin/ && \ rm -rf $BUILD $LOCALDESTDIR && \
cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ && \ dnf -y remove autoconf automake cmake diffutils file gcc ninja-build nasm gcc-c++ git libtool make perl yasm meson \
LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib ffmpeg -buildconf && \ x264-devel zlib-devel expat-devel fontconfig-devel libxml2-devel lame-devel libpng-devel numactl-devel \
cp -r ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include && \ fribidi-devel zeromq-devel freetype-devel opus-devel libass-devel openssl-devel && \
mkdir -p /usr/local/lib64/pkgconfig && \ dnf autoremove -y && \
for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/libsw*.pc; do \ dnf clean all
sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib64/pkgconfig/"${pc##*/}"; \
done
FROM base FROM base
ARG FFPLAYOUT_VERSION=0.18.1 ARG FFPLAYOUT_VERSION=0.18.3
ENV LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib ENV LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib
@ -443,16 +142,21 @@ ADD ./overide.conf /etc/systemd/system/ffplayout.service.d/overide.conf
ADD ./overide.conf /etc/systemd/system/ffpapi.service.d/overide.conf ADD ./overide.conf /etc/systemd/system/ffpapi.service.d/overide.conf
RUN \ RUN \
yum update -y \ dnf update -y \
&& yum install -y wget dejavu-sans-fonts sudo \ dnf install -y epel-release && \
&& wget -q -O /tmp/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm "https://github.com/ffplayout/ffplayout/releases/download/v${FFPLAYOUT_VERSION}/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm" \ dnf install -y 'dnf-command(config-manager)' && \
&& yum install -y /tmp/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm \ dnf config-manager --set-enabled crb && \
&& yum clean all \ dnf install -y --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-$(rpm -E %rhel).noarch.rpm && \
&& rm /tmp/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm \ dnf install -y --nogpgcheck https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-$(rpm -E %rhel).noarch.rpm && \
&& mkdir -p /home/ffpu && chown -R ffpu: /home/ffpu \ dnf install -y wget dejavu-sans-fonts sudo x264-libs fontconfig lame libpng numactl fribidi zeromq freetype opus libass && \
&& systemctl enable ffplayout \ wget -q -O /tmp/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm "https://github.com/ffplayout/ffplayout/releases/download/v${FFPLAYOUT_VERSION}/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm" && \
&& systemctl enable ffpapi \ dnf install -y /tmp/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm && \
&& ffpapi -u admin -p admin -m contact@example.com dnf clean all && \
rm /tmp/ffplayout-${FFPLAYOUT_VERSION}-1.x86_64.rpm && \
mkdir -p /home/ffpu && chown -R ffpu: /home/ffpu && \
systemctl enable ffplayout && \
systemctl enable ffpapi && \
ffpapi -u admin -p admin -m contact@example.com
EXPOSE 8787 EXPOSE 8787

View File

@ -77,7 +77,7 @@ ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig
RUN curl -fsSLO https://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2 \ RUN curl -fsSLO https://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2 \
&& tar -xjf ffmpeg-$FFMPEG_VERSION.tar.bz2 \ && tar -xjf ffmpeg-$FFMPEG_VERSION.tar.bz2 \
&& cd ffmpeg-$FFMPEG_VERSION \ && cd ffmpeg-$FFMPEG_VERSION \
&& ./configure --enable-nvenc --enable-libx264 --enable-gpl --enable-libfdk_aac --enable-libx264 --enable-nonfree --enable-postproc --enable-shared --enable-version3 \ && ./configure --enable-nvenc --enable-libx264 --enable-gpl --enable-libfdk_aac --enable-nonfree --enable-postproc --enable-shared --enable-version3 \
&& make -j$(nproc) \ && make -j$(nproc) \
&& make install && make install
@ -95,11 +95,11 @@ RUN echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
RUN yum update -y \ RUN yum update -y \
&& yum install -y dejavu-sans-fonts sudo wget \ && yum install -y dejavu-sans-fonts sudo wget \
&& wget -q -O /tmp/ffplayout-0.18.1-1.x86_64.rpm "https://github.com/ffplayout/ffplayout/releases/download/v0.18.1/ffplayout-0.18.1-1.x86_64.rpm" \ && wget -q -O /tmp/ffplayout-0.18.3-1.x86_64.rpm "https://github.com/ffplayout/ffplayout/releases/download/v0.18.1/ffplayout-0.18.3-1.x86_64.rpm" \
&& yum install -y /tmp/ffplayout-0.18.1-1.x86_64.rpm \ && yum install -y /tmp/ffplayout-0.18.3-1.x86_64.rpm \
&& yum clean all \ && yum clean all \
&& echo 'Docker!' | passwd --stdin root \ && echo 'Docker!' | passwd --stdin root \
&& rm /tmp/ffplayout-0.18.1-1.x86_64.rpm \ && rm /tmp/ffplayout-0.18.3-1.x86_64.rpm \
&& mkdir -p /home/ffpu && chown -R ffpu: /home/ffpu \ && mkdir -p /home/ffpu && chown -R ffpu: /home/ffpu \
&& systemctl enable ffplayout \ && systemctl enable ffplayout \
&& systemctl enable ffpapi && systemctl enable ffpapi

View File

@ -1,2 +0,0 @@
[Service]
Environment="LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib"

View File

@ -17,7 +17,8 @@ clap = { version = "3.2", features = ["derive"] }
crossbeam-channel = "0.5" crossbeam-channel = "0.5"
futures = "0.3" futures = "0.3"
jsonrpc-http-server = "18.0" jsonrpc-http-server = "18.0"
notify = "4.0" notify = "6.0"
notify-debouncer-full = { version = "*", default-features = false }
regex = "1" regex = "1"
reqwest = { version = "0.11", features = ["blocking", "json"] } reqwest = { version = "0.11", features = ["blocking", "json"] }
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }

View File

@ -10,9 +10,11 @@ use std::{
}; };
use notify::{ use notify::{
DebouncedEvent::{Create, Remove, Rename}, event::{CreateKind, ModifyKind, RemoveKind, RenameMode},
{watcher, RecursiveMode, Watcher}, EventKind::{Create, Modify, Remove},
RecursiveMode, Watcher,
}; };
use notify_debouncer_full::new_debouncer;
use simplelog::*; use simplelog::*;
use ffplayout_lib::utils::{include_file, Media, PlayoutConfig}; use ffplayout_lib::utils::{include_file, Media, PlayoutConfig};
@ -25,56 +27,76 @@ pub fn watchman(
is_terminated: Arc<AtomicBool>, is_terminated: Arc<AtomicBool>,
sources: Arc<Mutex<Vec<Media>>>, sources: Arc<Mutex<Vec<Media>>>,
) { ) {
let (tx, rx) = channel(); let path = Path::new(&config.storage.path);
let path = config.storage.path.clone(); if !path.exists() {
error!("Folder path not exists: '{path:?}'");
if !Path::new(&path).exists() { panic!("Folder path not exists: '{path:?}'");
error!("Folder path not exists: '{path}'");
panic!("Folder path not exists: '{path}'");
} }
let mut watcher = watcher(tx, Duration::from_secs(1)).unwrap(); // let (tx, rx) = channel();
watcher.watch(path, RecursiveMode::Recursive).unwrap(); let (tx, rx) = channel();
let mut debouncer = new_debouncer(Duration::from_secs(1), None, tx).unwrap();
debouncer
.watcher()
.watch(path, RecursiveMode::Recursive)
.unwrap();
debouncer.cache().add_root(path, RecursiveMode::Recursive);
while !is_terminated.load(Ordering::SeqCst) { while !is_terminated.load(Ordering::SeqCst) {
if let Ok(res) = rx.try_recv() { if let Ok(result) = rx.try_recv() {
match res { match result {
Create(new_path) => { Ok(events) => events.iter().for_each(|event| match event.kind {
let index = sources.lock().unwrap().len(); Create(CreateKind::File) | Modify(ModifyKind::Name(RenameMode::To)) => {
let media = Media::new(index, &new_path.to_string_lossy(), false); let new_path = &event.paths[0];
if include_file(config.clone(), &new_path) { if new_path.is_file() && include_file(config.clone(), new_path) {
sources.lock().unwrap().push(media); let index = sources.lock().unwrap().len();
info!("Create new file: <b><magenta>{new_path:?}</></b>"); let media = Media::new(index, &new_path.to_string_lossy(), false);
sources.lock().unwrap().push(media);
info!("Create new file: <b><magenta>{new_path:?}</></b>");
}
} }
} Remove(RemoveKind::File) | Modify(ModifyKind::Name(RenameMode::From)) => {
Remove(old_path) => { let old_path = &event.paths[0];
if include_file(config.clone(), &old_path) {
sources if !old_path.is_file() && include_file(config.clone(), old_path) {
.lock() sources
.unwrap() .lock()
.retain(|x| x.source != old_path.display().to_string()); .unwrap()
info!("Remove file: <b><magenta>{old_path:?}</></b>"); .retain(|x| x.source != old_path.to_string_lossy());
info!("Remove file: <b><magenta>{old_path:?}</></b>");
}
} }
} Modify(ModifyKind::Name(RenameMode::Both)) => {
Rename(old_path, new_path) => { let old_path = &event.paths[0];
let index = sources let new_path = &event.paths[1];
.lock()
.unwrap() let mut media_list = sources.lock().unwrap();
if let Some(index) = media_list
.iter() .iter()
.position(|x| *x.source == old_path.display().to_string()) .position(|x| *x.source == old_path.display().to_string()) {
.unwrap(); let media = Media::new(index, &new_path.to_string_lossy(), false);
media_list[index] = media;
info!("Move file: <b><magenta>{old_path:?}</></b> to <b><magenta>{new_path:?}</></b>");
} else if include_file(config.clone(), new_path) {
let index = media_list.len();
let media = Media::new(index, &new_path.to_string_lossy(), false);
let media = Media::new(index, &new_path.to_string_lossy(), false); media_list.push(media);
sources.lock().unwrap()[index] = media; info!("Create new file: <b><magenta>{new_path:?}</></b>");
}
info!("Rename file: <b><magenta>{old_path:?}</></b> to <b><magenta>{new_path:?}</></b>"); }
} _ => debug!("Not tracked file event: {event:?}")
_ => (), }),
Err(errors) => errors.iter().for_each(|error| error!("{error:?}")),
} }
} }
sleep(Duration::from_secs(5)); sleep(Duration::from_secs(3));
} }
} }