update frontend, change playlist update response

- fix advertisement checkbox, add audio to source
- response playlist update message, instead of generic write success
This commit is contained in:
jb-alvarado 2022-08-19 13:37:06 +02:00
parent 9e0f3ed63c
commit bff1797733
4 changed files with 14 additions and 4 deletions

2
Cargo.lock generated
View File

@ -961,7 +961,7 @@ dependencies = [
[[package]] [[package]]
name = "ffplayout-api" name = "ffplayout-api"
version = "0.5.3" version = "0.5.4"
dependencies = [ dependencies = [
"actix-files", "actix-files",
"actix-multipart", "actix-multipart",

View File

@ -4,7 +4,7 @@ description = "Rest API for ffplayout"
license = "GPL-3.0" license = "GPL-3.0"
authors = ["Jonathan Baecker jonbae77@gmail.com"] authors = ["Jonathan Baecker jonbae77@gmail.com"]
readme = "README.md" readme = "README.md"
version = "0.5.3" version = "0.5.4"
edition = "2021" edition = "2021"
[dependencies] [dependencies]

View File

@ -53,12 +53,14 @@ pub async fn write_playlist(id: i64, json_data: JsonPlaylist) -> Result<String,
.join(d[1]) .join(d[1])
.join(date.clone()) .join(date.clone())
.with_extension("json"); .with_extension("json");
let mut file_exists = false;
if let Some(p) = playlist_path.parent() { if let Some(p) = playlist_path.parent() {
fs::create_dir_all(p)?; fs::create_dir_all(p)?;
} }
if playlist_path.is_file() { if playlist_path.is_file() {
file_exists = true;
if let Ok(existing_data) = json_reader(&playlist_path) { if let Ok(existing_data) = json_reader(&playlist_path) {
if json_data == existing_data { if json_data == existing_data {
return Err(ServiceError::Conflict(format!( return Err(ServiceError::Conflict(format!(
@ -69,7 +71,15 @@ pub async fn write_playlist(id: i64, json_data: JsonPlaylist) -> Result<String,
} }
match json_writer(&playlist_path, json_data) { match json_writer(&playlist_path, json_data) {
Ok(_) => return Ok(format!("Write playlist from {date} success!")), Ok(_) => {
let mut msg = format!("Write playlist from {date} success!");
if file_exists {
msg = format!("Update playlist from {date} success!");
}
return Ok(msg);
}
Err(e) => { Err(e) => {
error!("{e}"); error!("{e}");
} }

@ -1 +1 @@
Subproject commit d0a2fa6921172d667ce718e9362d4076fc16c23c Subproject commit ec78765c0bfbe583ff9b5cbdcd6d011ecb89ac62