Merge pull request #179 from jb-alvarado/master

update frontend, change playlist update response
This commit is contained in:
jb-alvarado 2022-08-19 13:40:08 +02:00 committed by GitHub
commit 0b80be1c45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 4 deletions

2
Cargo.lock generated
View File

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

View File

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

View File

@ -53,12 +53,14 @@ pub async fn write_playlist(id: i64, json_data: JsonPlaylist) -> Result<String,
.join(d[1])
.join(date.clone())
.with_extension("json");
let mut file_exists = false;
if let Some(p) = playlist_path.parent() {
fs::create_dir_all(p)?;
}
if playlist_path.is_file() {
file_exists = true;
if let Ok(existing_data) = json_reader(&playlist_path) {
if json_data == existing_data {
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) {
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) => {
error!("{e}");
}

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