make category optional
This commit is contained in:
parent
b9e8261eee
commit
f0ebfb710c
@ -1,5 +1,7 @@
|
||||
[package]
|
||||
name = "ffplayout-rs"
|
||||
description = "24/7 playout based on rust and ffmpeg"
|
||||
license = "GPL-3.0"
|
||||
version = "0.9.1"
|
||||
edition = "2021"
|
||||
|
||||
|
@ -142,7 +142,7 @@ fn fade(node: &mut Media, chain: &mut Filters, codec_type: &str) {
|
||||
fn overlay(node: &mut Media, chain: &mut Filters, config: &GlobalConfig) {
|
||||
if config.processing.add_logo
|
||||
&& Path::new(&config.processing.logo).is_file()
|
||||
&& node.category != "advertisement".to_string()
|
||||
&& &node.category.clone().unwrap_or(String::new()) != "advertisement"
|
||||
{
|
||||
let opacity = format!(
|
||||
"format=rgba,colorchannelmixer=aa={}",
|
||||
|
@ -179,13 +179,15 @@ impl CurrentProgram {
|
||||
let index = *self.index.lock().unwrap();
|
||||
let current_list = self.nodes.lock().unwrap();
|
||||
|
||||
if index + 1 < current_list.len() && ¤t_list[index + 1].category == "advertisement" {
|
||||
if index + 1 < current_list.len()
|
||||
&& ¤t_list[index + 1].category.clone().unwrap_or(String::new()) == "advertisement"
|
||||
{
|
||||
self.current_node.next_ad = Some(true);
|
||||
}
|
||||
|
||||
if index > 0
|
||||
&& index < current_list.len()
|
||||
&& ¤t_list[index - 1].category == "advertisement"
|
||||
&& ¤t_list[index - 1].category.clone().unwrap_or(String::new()) == "advertisement"
|
||||
{
|
||||
self.current_node.last_ad = Some(true);
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
extern crate log;
|
||||
extern crate simplelog;
|
||||
|
||||
use std::{
|
||||
path::PathBuf,
|
||||
{fs, fs::File},
|
||||
};
|
||||
|
||||
extern crate log;
|
||||
extern crate simplelog;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::json;
|
||||
use simplelog::*;
|
||||
|
@ -147,7 +147,7 @@ pub struct Media {
|
||||
pub seek: f64,
|
||||
pub out: f64,
|
||||
pub duration: f64,
|
||||
pub category: String,
|
||||
pub category: Option<String>,
|
||||
pub source: String,
|
||||
pub cmd: Option<Vec<String>>,
|
||||
pub filter: Option<Vec<String>>,
|
||||
@ -177,7 +177,7 @@ impl Media {
|
||||
seek: 0.0,
|
||||
out: duration,
|
||||
duration: duration,
|
||||
category: String::new(),
|
||||
category: None,
|
||||
source: src.clone(),
|
||||
cmd: Some(vec!["-i".to_string(), src]),
|
||||
filter: Some(vec![]),
|
||||
|
Loading…
x
Reference in New Issue
Block a user