add update advanced
This commit is contained in:
parent
af5cc0b55c
commit
6de9bb9caa
@ -10,7 +10,7 @@ use tokio::task;
|
||||
|
||||
use super::models::{AdvancedConfiguration, Configuration};
|
||||
use crate::db::models::{Channel, GlobalSettings, Role, TextPreset, User};
|
||||
use crate::utils::{config::PlayoutConfig, local_utc_offset};
|
||||
use crate::utils::{advanced_config::AdvancedConfig, config::PlayoutConfig, local_utc_offset};
|
||||
|
||||
pub async fn db_migrate(conn: &Pool<Sqlite>) -> Result<&'static str, Box<dyn std::error::Error>> {
|
||||
match sqlx::migrate!("../migrations").run(conn).await {
|
||||
@ -252,6 +252,45 @@ pub async fn insert_advanced_configuration(
|
||||
sqlx::query(query).bind(channel_id).execute(conn).await
|
||||
}
|
||||
|
||||
pub async fn update_advanced_configuration(
|
||||
conn: &Pool<Sqlite>,
|
||||
channel_id: i32,
|
||||
config: AdvancedConfig,
|
||||
) -> Result<SqliteQueryResult, sqlx::Error> {
|
||||
let query = "UPDATE advanced_configurations SET decoder_input_param = $2, decoder_output_param = $3, encoder_input_param = $4, ingest_input_param = $5, filter_deinterlace = $6, filter_pad_scale_w = $7, filter_pad_scale_h = $8, filter_pad_video = $9, filter_fps = $10, filter_scale = $11, filter_set_dar = $12, filter_fade_in = $13, filter_fade_out = $14, filter_overlay_logo_scale = $15, filter_overlay_logo_fade_in = $16, filter_overlay_logo_fade_out = $17, filter_overlay_logo = $18, filter_tpad = $19, filter_drawtext_from_file = $20, filter_drawtext_from_zmq = $21, filter_aevalsrc = $22, filter_afade_in = $23, filter_afade_out = $24, filter_apad = $25, filter_volume = $26, filter_split = $27 WHERE channel_id = $1";
|
||||
|
||||
sqlx::query(query)
|
||||
.bind(channel_id)
|
||||
.bind(config.decoder.input_param)
|
||||
.bind(config.decoder.output_param)
|
||||
.bind(config.encoder.input_param)
|
||||
.bind(config.ingest.input_param)
|
||||
.bind(config.filter.deinterlace)
|
||||
.bind(config.filter.pad_scale_w)
|
||||
.bind(config.filter.pad_scale_h)
|
||||
.bind(config.filter.pad_video)
|
||||
.bind(config.filter.fps)
|
||||
.bind(config.filter.scale)
|
||||
.bind(config.filter.set_dar)
|
||||
.bind(config.filter.fade_in)
|
||||
.bind(config.filter.fade_out)
|
||||
.bind(config.filter.overlay_logo_scale)
|
||||
.bind(config.filter.overlay_logo_fade_in)
|
||||
.bind(config.filter.overlay_logo_fade_out)
|
||||
.bind(config.filter.overlay_logo)
|
||||
.bind(config.filter.tpad)
|
||||
.bind(config.filter.drawtext_from_file)
|
||||
.bind(config.filter.drawtext_from_zmq)
|
||||
.bind(config.filter.aevalsrc)
|
||||
.bind(config.filter.afade_in)
|
||||
.bind(config.filter.afade_out)
|
||||
.bind(config.filter.apad)
|
||||
.bind(config.filter.volume)
|
||||
.bind(config.filter.split)
|
||||
.execute(conn)
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn select_advanced_configuration(
|
||||
conn: &Pool<Sqlite>,
|
||||
channel: i32,
|
||||
|
@ -401,26 +401,26 @@ pub struct AdvancedConfiguration {
|
||||
pub decoder_output_param: Option<String>,
|
||||
pub encoder_input_param: Option<String>,
|
||||
pub ingest_input_param: Option<String>,
|
||||
pub deinterlace: Option<String>,
|
||||
pub pad_scale_w: Option<String>,
|
||||
pub pad_scale_h: Option<String>,
|
||||
pub pad_video: Option<String>,
|
||||
pub fps: Option<String>,
|
||||
pub scale: Option<String>,
|
||||
pub set_dar: Option<String>,
|
||||
pub fade_in: Option<String>,
|
||||
pub fade_out: Option<String>,
|
||||
pub overlay_logo_scale: Option<String>,
|
||||
pub overlay_logo_fade_in: Option<String>,
|
||||
pub overlay_logo_fade_out: Option<String>,
|
||||
pub overlay_logo: Option<String>,
|
||||
pub tpad: Option<String>,
|
||||
pub drawtext_from_file: Option<String>,
|
||||
pub drawtext_from_zmq: Option<String>,
|
||||
pub aevalsrc: Option<String>,
|
||||
pub afade_in: Option<String>,
|
||||
pub afade_out: Option<String>,
|
||||
pub apad: Option<String>,
|
||||
pub volume: Option<String>,
|
||||
pub split: Option<String>,
|
||||
pub filter_deinterlace: Option<String>,
|
||||
pub filter_pad_scale_w: Option<String>,
|
||||
pub filter_pad_scale_h: Option<String>,
|
||||
pub filter_pad_video: Option<String>,
|
||||
pub filter_fps: Option<String>,
|
||||
pub filter_scale: Option<String>,
|
||||
pub filter_set_dar: Option<String>,
|
||||
pub filter_fade_in: Option<String>,
|
||||
pub filter_fade_out: Option<String>,
|
||||
pub filter_overlay_logo_scale: Option<String>,
|
||||
pub filter_overlay_logo_fade_in: Option<String>,
|
||||
pub filter_overlay_logo_fade_out: Option<String>,
|
||||
pub filter_overlay_logo: Option<String>,
|
||||
pub filter_tpad: Option<String>,
|
||||
pub filter_drawtext_from_file: Option<String>,
|
||||
pub filter_drawtext_from_zmq: Option<String>,
|
||||
pub filter_aevalsrc: Option<String>,
|
||||
pub filter_afade_in: Option<String>,
|
||||
pub filter_afade_out: Option<String>,
|
||||
pub filter_apad: Option<String>,
|
||||
pub filter_volume: Option<String>,
|
||||
pub filter_split: Option<String>,
|
||||
}
|
||||
|
@ -80,28 +80,28 @@ impl AdvancedConfig {
|
||||
},
|
||||
},
|
||||
filter: FilterConfig {
|
||||
deinterlace: config.deinterlace,
|
||||
pad_scale_w: config.pad_scale_w,
|
||||
pad_scale_h: config.pad_scale_h,
|
||||
pad_video: config.pad_video,
|
||||
fps: config.fps,
|
||||
scale: config.scale,
|
||||
set_dar: config.set_dar,
|
||||
fade_in: config.fade_in,
|
||||
fade_out: config.fade_out,
|
||||
overlay_logo_scale: config.overlay_logo_scale,
|
||||
overlay_logo_fade_in: config.overlay_logo_fade_in,
|
||||
overlay_logo_fade_out: config.overlay_logo_fade_out,
|
||||
overlay_logo: config.overlay_logo,
|
||||
tpad: config.tpad,
|
||||
drawtext_from_file: config.drawtext_from_file,
|
||||
drawtext_from_zmq: config.drawtext_from_zmq,
|
||||
aevalsrc: config.aevalsrc,
|
||||
afade_in: config.afade_in,
|
||||
afade_out: config.afade_out,
|
||||
apad: config.apad,
|
||||
volume: config.volume,
|
||||
split: config.split,
|
||||
deinterlace: config.filter_deinterlace,
|
||||
pad_scale_w: config.filter_pad_scale_w,
|
||||
pad_scale_h: config.filter_pad_scale_h,
|
||||
pad_video: config.filter_pad_video,
|
||||
fps: config.filter_fps,
|
||||
scale: config.filter_scale,
|
||||
set_dar: config.filter_set_dar,
|
||||
fade_in: config.filter_fade_in,
|
||||
fade_out: config.filter_fade_out,
|
||||
overlay_logo_scale: config.filter_overlay_logo_scale,
|
||||
overlay_logo_fade_in: config.filter_overlay_logo_fade_in,
|
||||
overlay_logo_fade_out: config.filter_overlay_logo_fade_out,
|
||||
overlay_logo: config.filter_overlay_logo,
|
||||
tpad: config.filter_tpad,
|
||||
drawtext_from_file: config.filter_drawtext_from_file,
|
||||
drawtext_from_zmq: config.filter_drawtext_from_zmq,
|
||||
aevalsrc: config.filter_aevalsrc,
|
||||
afade_in: config.filter_afade_in,
|
||||
afade_out: config.filter_afade_out,
|
||||
apad: config.filter_apad,
|
||||
volume: config.filter_volume,
|
||||
split: config.filter_split,
|
||||
},
|
||||
ingest: IngestConfig {
|
||||
input_param: config.ingest_input_param.clone(),
|
||||
|
@ -137,28 +137,28 @@ CREATE TABLE
|
||||
decoder_output_param TEXT,
|
||||
encoder_input_param TEXT,
|
||||
ingest_input_param TEXT,
|
||||
deinterlace TEXT,
|
||||
pad_scale_w TEXT,
|
||||
pad_scale_h TEXT,
|
||||
pad_video TEXT,
|
||||
fps TEXT,
|
||||
scale TEXT,
|
||||
set_dar TEXT,
|
||||
fade_in TEXT,
|
||||
fade_out TEXT,
|
||||
overlay_logo_scale TEXT,
|
||||
overlay_logo_fade_in TEXT,
|
||||
overlay_logo_fade_out TEXT,
|
||||
overlay_logo TEXT,
|
||||
tpad TEXT,
|
||||
drawtext_from_file TEXT,
|
||||
drawtext_from_zmq TEXT,
|
||||
aevalsrc TEXT,
|
||||
afade_in TEXT,
|
||||
afade_out TEXT,
|
||||
apad TEXT,
|
||||
volume TEXT,
|
||||
split TEXT,
|
||||
filter_deinterlace TEXT,
|
||||
filter_pad_scale_w TEXT,
|
||||
filter_pad_scale_h TEXT,
|
||||
filter_pad_video TEXT,
|
||||
filter_fps TEXT,
|
||||
filter_scale TEXT,
|
||||
filter_set_dar TEXT,
|
||||
filter_fade_in TEXT,
|
||||
filter_fade_out TEXT,
|
||||
filter_overlay_logo_scale TEXT,
|
||||
filter_overlay_logo_fade_in TEXT,
|
||||
filter_overlay_logo_fade_out TEXT,
|
||||
filter_overlay_logo TEXT,
|
||||
filter_tpad TEXT,
|
||||
filter_drawtext_from_file TEXT,
|
||||
filter_drawtext_from_zmq TEXT,
|
||||
filter_aevalsrc TEXT,
|
||||
filter_afade_in TEXT,
|
||||
filter_afade_out TEXT,
|
||||
filter_apad TEXT,
|
||||
filter_volume TEXT,
|
||||
filter_split TEXT,
|
||||
FOREIGN KEY (channel_id) REFERENCES channels (id) ON UPDATE CASCADE ON DELETE CASCADE
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user