fix playlist routes, add version debug log

This commit is contained in:
jb-alvarado 2024-06-25 17:11:33 +02:00
parent 14f1a18b5b
commit e34562d31e
4 changed files with 20 additions and 14 deletions

4
Cargo.lock generated
View File

@ -1061,7 +1061,7 @@ checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a"
[[package]]
name = "ffplayout"
version = "0.24.0-beta1"
version = "0.24.0-alpha1"
dependencies = [
"actix-files",
"actix-multipart",
@ -3336,7 +3336,7 @@ dependencies = [
[[package]]
name = "tests"
version = "0.24.0-beta1"
version = "0.24.0-alpha1"
dependencies = [
"chrono",
"crossbeam-channel",

View File

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

View File

@ -1016,18 +1016,17 @@ pub async fn save_playlist(
#[protect(
any("Role::GlobalAdmin", "Role::ChannelAdmin", "Role::User"),
ty = "Role",
expr = "user.channels.contains(&*id) || role.has_authority(&Role::GlobalAdmin)"
expr = "user.channels.contains(&params.0) || role.has_authority(&Role::GlobalAdmin)"
)]
pub async fn gen_playlist(
id: web::Path<i32>,
date: web::Path<String>,
params: web::Path<(i32, String)>,
data: Option<web::Json<PathsObj>>,
controllers: web::Data<Mutex<ChannelController>>,
role: AuthDetails<Role>,
user: web::ReqData<UserMeta>,
) -> Result<impl Responder, ServiceError> {
let manager = controllers.lock().unwrap().get(*id).unwrap();
manager.config.lock().unwrap().general.generate = Some(vec![date.clone()]);
let manager = controllers.lock().unwrap().get(params.0).unwrap();
manager.config.lock().unwrap().general.generate = Some(vec![params.1.clone()]);
let storage_path = manager.config.lock().unwrap().global.storage_path.clone();
if let Some(obj) = data {
@ -1068,19 +1067,18 @@ pub async fn gen_playlist(
#[protect(
any("Role::GlobalAdmin", "Role::ChannelAdmin", "Role::User"),
ty = "Role",
expr = "user.channels.contains(&*id) || role.has_authority(&Role::GlobalAdmin)"
expr = "user.channels.contains(&params.0) || role.has_authority(&Role::GlobalAdmin)"
)]
pub async fn del_playlist(
id: web::Path<i32>,
date: web::Path<String>,
params: web::Path<(i32, String)>,
controllers: web::Data<Mutex<ChannelController>>,
role: AuthDetails<Role>,
user: web::ReqData<UserMeta>,
) -> Result<impl Responder, ServiceError> {
let manager = controllers.lock().unwrap().get(*id).unwrap();
let manager = controllers.lock().unwrap().get(params.0).unwrap();
let config = manager.config.lock().unwrap().clone();
match delete_playlist(&config, &date).await {
match delete_playlist(&config, &params.1).await {
Ok(m) => Ok(web::Json(m)),
Err(e) => Err(e),
}

View File

@ -15,7 +15,6 @@ use log::*;
use serde::{Deserialize, Serialize};
use sqlx::{Pool, Sqlite};
use crate::db::{handles, models::Channel};
use crate::player::{
output::{player, write_hls},
utils::{folder::fill_filler_list, Media},
@ -25,6 +24,12 @@ use crate::utils::{
errors::ProcessError,
};
use crate::ARGS;
use crate::{
db::{handles, models::Channel},
utils::logging::Target,
};
const VERSION: &str = env!("CARGO_PKG_VERSION");
/// Defined process units.
#[derive(Clone, Debug, Default, Copy, Eq, Serialize, Deserialize, PartialEq)]
@ -323,6 +328,9 @@ pub fn start_channel(manager: ChannelManager) -> Result<(), ProcessError> {
let config = manager.config.lock()?.clone();
let mode = config.output.mode.clone();
let filler_list = manager.filler_list.clone();
let channel_id = config.general.channel_id;
debug!(target: Target::all(), channel = channel_id; "Start ffplayout v{VERSION}, channel: <yellow>{channel_id}</>");
// Fill filler list, can also be a single file.
thread::spawn(move || {