correct save absolut path, improve infinit mode, fix #643

This commit is contained in:
jb-alvarado 2024-05-15 08:55:35 +02:00
parent 7c8ad52123
commit 6a9d6e22de
5 changed files with 22 additions and 13 deletions

8
Cargo.lock generated
View File

@ -1292,7 +1292,7 @@ checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a"
[[package]] [[package]]
name = "ffplayout" name = "ffplayout"
version = "0.22.2" version = "0.22.3"
dependencies = [ dependencies = [
"chrono", "chrono",
"clap", "clap",
@ -1314,7 +1314,7 @@ dependencies = [
[[package]] [[package]]
name = "ffplayout-api" name = "ffplayout-api"
version = "0.22.2" version = "0.22.3"
dependencies = [ dependencies = [
"actix-files", "actix-files",
"actix-multipart", "actix-multipart",
@ -1357,7 +1357,7 @@ dependencies = [
[[package]] [[package]]
name = "ffplayout-lib" name = "ffplayout-lib"
version = "0.22.2" version = "0.22.3"
dependencies = [ dependencies = [
"chrono", "chrono",
"crossbeam-channel", "crossbeam-channel",
@ -3587,7 +3587,7 @@ dependencies = [
[[package]] [[package]]
name = "tests" name = "tests"
version = "0.22.2" version = "0.22.3"
dependencies = [ dependencies = [
"chrono", "chrono",
"crossbeam-channel", "crossbeam-channel",

View File

@ -4,7 +4,7 @@ default-members = ["ffplayout-api", "ffplayout-engine", "tests"]
resolver = "2" resolver = "2"
[workspace.package] [workspace.package]
version = "0.22.2" version = "0.22.3"
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

@ -118,7 +118,7 @@ help_text = """'filler' is for playing instead of a missing file or fill the end
to pick files randomly.""" to pick files randomly."""
path = "/var/lib/ffplayout/tv-media" path = "/var/lib/ffplayout/tv-media"
filler = "/var/lib/ffplayout/tv-media/filler/filler.mp4" filler = "/var/lib/ffplayout/tv-media/filler/filler.mp4"
extensions = ["mp4", "mkv"] extensions = ["mp4", "mkv", "webm"]
shuffle = true shuffle = true
[text] [text]

View File

@ -35,13 +35,22 @@ pub async fn write_playlist(
) -> Result<String, ServiceError> { ) -> Result<String, ServiceError> {
let (config, _) = playout_config(conn, &id).await?; let (config, _) = playout_config(conn, &id).await?;
let date = json_data.date.clone(); let date = json_data.date.clone();
let mut playlist_path = PathBuf::from(&config.playlist.path); let mut playlist_path = config.playlist.path;
let d: Vec<&str> = date.split('-').collect(); let d: Vec<&str> = date.split('-').collect();
playlist_path = playlist_path
.join(d[0]) if !playlist_path
.join(d[1]) .extension()
.join(date.clone()) .and_then(|ext| ext.to_str())
.with_extension("json"); .map(|ext| ext.eq_ignore_ascii_case("json"))
.unwrap_or(false)
{
playlist_path = playlist_path
.join(d[0])
.join(d[1])
.join(date.clone())
.with_extension("json");
}
let mut file_exists = false; let mut file_exists = false;
if let Some(p) = playlist_path.parent() { if let Some(p) = playlist_path.parent() {

@ -1 +1 @@
Subproject commit 1f236dfe54ab027cbaaf0280e5520f4626291e06 Subproject commit 16bd6a684a9fd4a80e78104282565acec5e466cf