fix deadlock, on playlist generation, fix playlist init
This commit is contained in:
parent
4d3df70a2e
commit
c7529d3d5b
@ -255,7 +255,7 @@ async fn main() -> std::io::Result<()> {
|
||||
|
||||
Ok(())
|
||||
} else {
|
||||
error!("Run ffplayout with listen parameter!");
|
||||
error!("Run ffplayout with parameters! Run ffplayout -h for more information.");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -76,6 +76,7 @@ impl ChannelManager {
|
||||
is_alive: Arc::new(AtomicBool::new(false)),
|
||||
channel: Arc::new(Mutex::new(channel)),
|
||||
config: Arc::new(Mutex::new(config)),
|
||||
list_init: Arc::new(AtomicBool::new(true)),
|
||||
current_media: Arc::new(Mutex::new(None)),
|
||||
current_list: Arc::new(Mutex::new(vec![Media::new(0, "", false)])),
|
||||
filler_list: Arc::new(Mutex::new(vec![])),
|
||||
|
@ -150,7 +150,7 @@ impl CurrentProgram {
|
||||
}
|
||||
|
||||
trace!(
|
||||
"delta: {delta} | total_delta: {total_delta}, index: {node_index} \nnext_start: {next_start} | end_sec: {} | source {}",
|
||||
"delta: {delta} | total_delta: {total_delta}, index: {node_index} \n next_start: {next_start} | end_sec: {} | source {}",
|
||||
self.end_sec,
|
||||
self.current_node.source
|
||||
);
|
||||
@ -501,8 +501,14 @@ fn timed_source(
|
||||
let mut new_node = node.clone();
|
||||
new_node.process = Some(false);
|
||||
|
||||
trace!("Node begin: {}", node.begin.unwrap());
|
||||
trace!("timed source is last: {last}");
|
||||
trace!(
|
||||
"Node - begin: {} | source: {}",
|
||||
node.begin.unwrap(),
|
||||
node.source
|
||||
);
|
||||
trace!(
|
||||
"timed source is last: {last} | current_date: {current_date} | last_date: {last_date:?} | time_shift: {time_shift}"
|
||||
);
|
||||
|
||||
if config.playlist.length.contains(':') {
|
||||
if Some(current_date) == last_date && time_shift != 0.0 {
|
||||
|
@ -28,6 +28,11 @@ impl FolderSource {
|
||||
let mut media_list = vec![];
|
||||
let mut index: usize = 0;
|
||||
|
||||
debug!(
|
||||
"generate: {:?}, paths: {:?}",
|
||||
config.general.generate, config.storage.paths
|
||||
);
|
||||
|
||||
if config.general.generate.is_some() && !config.storage.paths.is_empty() {
|
||||
for path in &config.storage.paths {
|
||||
path_list.push(path)
|
||||
|
@ -17,7 +17,7 @@ use crate::ARGS;
|
||||
|
||||
#[derive(Parser, Debug, Clone)]
|
||||
#[clap(version,
|
||||
about = "REST API for ffplayout",
|
||||
about = "ffplayout - 24/7 broadcasting solution",
|
||||
long_about = None)]
|
||||
pub struct Args {
|
||||
#[clap(
|
||||
|
@ -176,6 +176,7 @@ pub struct Global {
|
||||
pub playlist_path: PathBuf,
|
||||
pub storage_path: PathBuf,
|
||||
pub logging_path: PathBuf,
|
||||
pub shared_storage: bool,
|
||||
}
|
||||
|
||||
impl Global {
|
||||
@ -185,6 +186,7 @@ impl Global {
|
||||
playlist_path: PathBuf::from(config.playlist_path.clone()),
|
||||
storage_path: PathBuf::from(config.storage_path.clone()),
|
||||
logging_path: PathBuf::from(config.logging_path.clone()),
|
||||
shared_storage: config.shared_storage,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -551,7 +553,7 @@ impl PlayoutConfig {
|
||||
.await
|
||||
.expect("Can't read advanced config");
|
||||
|
||||
let global = Global::new(&global);
|
||||
let mut global = Global::new(&global);
|
||||
let advanced = AdvancedConfig::new(adv_config);
|
||||
let general = General::new(&config);
|
||||
let mail = Mail::new(&config);
|
||||
@ -564,6 +566,10 @@ impl PlayoutConfig {
|
||||
let task = Task::new(&config);
|
||||
let mut output = Output::new(&config);
|
||||
|
||||
if !global.shared_storage {
|
||||
global.storage_path = global.storage_path.join(channel.to_string());
|
||||
}
|
||||
|
||||
let (filler_path, _, _) = norm_abs_path(&global.storage_path, &config.storage_filler)
|
||||
.expect("Can't get filler path");
|
||||
|
||||
|
@ -200,7 +200,7 @@ pub fn generate_from_template(
|
||||
|
||||
/// Generate playlists
|
||||
pub fn playlist_generator(manager: &ChannelManager) -> Result<Vec<JsonPlaylist>, Error> {
|
||||
let config = manager.config.lock().unwrap();
|
||||
let config = manager.config.lock().unwrap().clone();
|
||||
let channel_name = manager.channel.lock().unwrap().name.clone();
|
||||
|
||||
let total_length = match config.playlist.length_sec {
|
||||
|
@ -233,19 +233,38 @@ impl MailQueue {
|
||||
}
|
||||
|
||||
fn console_formatter(w: &mut dyn Write, _now: &mut DeferredNow, record: &Record) -> io::Result<()> {
|
||||
let level = match record.level() {
|
||||
Level::Debug => "<bright-blue>[DEBUG]</>",
|
||||
Level::Error => "<bright-red>[ERROR]</>",
|
||||
Level::Info => "<bright-green>[ INFO]</>",
|
||||
Level::Trace => "<bright-yellow>[TRACE]</>",
|
||||
Level::Warn => "<yellow>[ WARN]</>",
|
||||
};
|
||||
|
||||
write!(
|
||||
w,
|
||||
"{}",
|
||||
colorize_string(format!("{level} {}", record.args()))
|
||||
)
|
||||
match record.level() {
|
||||
Level::Debug => write!(
|
||||
w,
|
||||
"{}",
|
||||
colorize_string(format!("<bright-blue>[DEBUG]</> {}", record.args()))
|
||||
),
|
||||
Level::Error => write!(
|
||||
w,
|
||||
"{}",
|
||||
colorize_string(format!("<bright-red>[ERROR]</> {}", record.args()))
|
||||
),
|
||||
Level::Info => write!(
|
||||
w,
|
||||
"{}",
|
||||
colorize_string(format!("<bright-green>[ INFO]</> {}", record.args()))
|
||||
),
|
||||
Level::Trace => write!(
|
||||
w,
|
||||
"{}",
|
||||
colorize_string(format!(
|
||||
"<bright-yellow>[TRACE]</> {}{} {}",
|
||||
record.file().unwrap_or_default(),
|
||||
record.line().unwrap_or_default(),
|
||||
record.args()
|
||||
))
|
||||
),
|
||||
Level::Warn => write!(
|
||||
w,
|
||||
"{}",
|
||||
colorize_string(format!("<yellow>[ WARN]</> {}", record.args()))
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
fn file_formatter(
|
||||
@ -411,14 +430,22 @@ pub fn init_logging(mail_queues: Arc<Mutex<Vec<Arc<Mutex<MailQueue>>>>>) -> io::
|
||||
let mut builder = LogSpecification::builder();
|
||||
builder
|
||||
.default(log_level)
|
||||
.module("actix", LevelFilter::Error)
|
||||
.module("actix_files", LevelFilter::Error)
|
||||
.module("actix_web", LevelFilter::Error)
|
||||
.module("actix_web_service", LevelFilter::Error)
|
||||
.module("hyper", LevelFilter::Error)
|
||||
.module("flexi_logger", LevelFilter::Error)
|
||||
.module("libc", LevelFilter::Error)
|
||||
.module("log", LevelFilter::Error)
|
||||
.module("mio", LevelFilter::Error)
|
||||
.module("neli", LevelFilter::Error)
|
||||
.module("reqwest", LevelFilter::Error)
|
||||
.module("rpc", LevelFilter::Error)
|
||||
.module("rustls", LevelFilter::Error)
|
||||
.module("serial_test", LevelFilter::Error)
|
||||
.module("sqlx", LevelFilter::Error);
|
||||
.module("sqlx", LevelFilter::Error)
|
||||
.module("tokio", LevelFilter::Error);
|
||||
|
||||
Logger::with(builder.build())
|
||||
.format(console_formatter)
|
||||
|
Loading…
Reference in New Issue
Block a user