try to create log path, if not exists. expose state file in config (important for multi channels)
This commit is contained in:
parent
aced7053cb
commit
6cd092c30f
@ -6,6 +6,7 @@ general:
|
||||
on linux. 'stop_threshold' stop ffplayout, if it is async in time above this
|
||||
value. A number below 3 can cause unexpected errors.
|
||||
stop_threshold: 11
|
||||
stat_file: .ffp_status
|
||||
|
||||
rpc_server:
|
||||
help_text: Run a JSON RPC server, for getting infos about current playing and
|
||||
|
@ -16,7 +16,7 @@ RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \
|
||||
|
||||
FROM base
|
||||
|
||||
ARG FFPLAYOUT_VERSION=0.17.0
|
||||
ARG FFPLAYOUT_VERSION=0.17.1
|
||||
COPY README.md *.rpm /tmp/
|
||||
|
||||
RUN dnf update -y && \
|
||||
|
@ -30,10 +30,17 @@ It may be useful to create/link volume for those folders/files.
|
||||
|
||||
## Docker
|
||||
|
||||
How to build the image
|
||||
`docker build -t ffplayout-image .`
|
||||
`docker build -f fromSource.Dockerfile -t ffplayout-image:from-source .`
|
||||
`docker build -f Almalinux.Dockerfile -t ffplayout-image:almalinux .`
|
||||
How to build the image:\
|
||||
```BASH
|
||||
# build default
|
||||
docker build -t ffplayout-image .
|
||||
|
||||
# build ffmpeg from source
|
||||
docker build -f fromSource.Dockerfile -t ffplayout-image:from-source .
|
||||
|
||||
# build with current almalinux image
|
||||
docker build -f Almalinux.Dockerfile -t ffplayout-image:almalinux .
|
||||
```
|
||||
|
||||
example of command to start the container:
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
use std::{
|
||||
fs::{self, File},
|
||||
path::PathBuf,
|
||||
path::{Path, PathBuf},
|
||||
process::exit,
|
||||
sync::{Arc, Mutex},
|
||||
thread,
|
||||
@ -98,6 +98,15 @@ fn main() {
|
||||
let proc_ctl2 = proc_control.clone();
|
||||
let messages = Arc::new(Mutex::new(Vec::new()));
|
||||
|
||||
// try to create logging folder, if not exist
|
||||
if config.logging.log_to_file && !Path::new(&config.logging.log_path).is_dir() {
|
||||
if let Err(e) = fs::create_dir_all(&config.logging.log_path) {
|
||||
println!("Logging path not exists! {e}");
|
||||
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
let logging = init_logging(&config, Some(proc_ctl1), Some(messages.clone()));
|
||||
CombinedLogger::init(logging).unwrap();
|
||||
|
||||
|
@ -146,11 +146,11 @@ pub struct General {
|
||||
pub help_text: String,
|
||||
pub stop_threshold: f64,
|
||||
|
||||
#[serde(skip_serializing, skip_deserializing)]
|
||||
pub generate: Option<Vec<String>>,
|
||||
#[serde(default)]
|
||||
pub stat_file: String,
|
||||
|
||||
#[serde(skip_serializing, skip_deserializing)]
|
||||
pub stat_file: String,
|
||||
pub generate: Option<Vec<String>>,
|
||||
|
||||
#[serde(skip_serializing, skip_deserializing)]
|
||||
pub ffmpeg_filters: Vec<String>,
|
||||
@ -336,11 +336,14 @@ impl PlayoutConfig {
|
||||
let mut config: PlayoutConfig =
|
||||
serde_yaml::from_reader(f).expect("Could not read config file.");
|
||||
config.general.generate = None;
|
||||
config.general.stat_file = home_dir()
|
||||
.unwrap_or_else(env::temp_dir)
|
||||
.join(".ffp_status")
|
||||
.display()
|
||||
.to_string();
|
||||
|
||||
if config.general.stat_file.is_empty() {
|
||||
config.general.stat_file = home_dir()
|
||||
.unwrap_or_else(env::temp_dir)
|
||||
.join(".ffp_status")
|
||||
.display()
|
||||
.to_string();
|
||||
}
|
||||
|
||||
if config.logging.ingest_level.is_none() {
|
||||
config.logging.ingest_level = Some(config.logging.ffmpeg_level.clone())
|
||||
|
Loading…
Reference in New Issue
Block a user