catch remote playlist error and get empty playlist

This commit is contained in:
jb-alvarado 2024-04-21 21:23:06 +02:00
parent d077f5aa09
commit 586a5a91e6
3 changed files with 13 additions and 7 deletions

8
Cargo.lock generated
View File

@ -1217,7 +1217,7 @@ checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984"
[[package]]
name = "ffplayout"
version = "0.21.2"
version = "0.21.3"
dependencies = [
"chrono",
"clap",
@ -1239,7 +1239,7 @@ dependencies = [
[[package]]
name = "ffplayout-api"
version = "0.21.2"
version = "0.21.3"
dependencies = [
"actix-files",
"actix-multipart",
@ -1278,7 +1278,7 @@ dependencies = [
[[package]]
name = "ffplayout-lib"
version = "0.21.2"
version = "0.21.3"
dependencies = [
"chrono",
"crossbeam-channel",
@ -3458,7 +3458,7 @@ dependencies = [
[[package]]
name = "tests"
version = "0.21.2"
version = "0.21.3"
dependencies = [
"chrono",
"crossbeam-channel",

View File

@ -4,7 +4,7 @@ default-members = ["ffplayout-api", "ffplayout-engine", "tests"]
resolver = "2"
[workspace.package]
version = "0.21.2"
version = "0.21.3"
license = "GPL-3.0"
repository = "https://github.com/ffplayout/ffplayout"
authors = ["Jonathan Baecker <jonbae77@gmail.com>"]

View File

@ -126,8 +126,14 @@ pub fn read_json(
let headers = resp.headers().clone();
if let Ok(body) = resp.text() {
let mut playlist: JsonPlaylist =
serde_json::from_str(&body).expect("Could't read remote json playlist.");
let mut playlist: JsonPlaylist = match serde_json::from_str(&body) {
Ok(p) => p,
Err(e) => {
error!("Could't read remote json playlist. {e:?}");
JsonPlaylist::new(date.clone(), start_sec)
}
};
playlist.path = Some(current_file);
playlist.start_sec = Some(start_sec);