diff --git a/ffplayout-frontend b/ffplayout-frontend new file mode 160000 index 00000000..e8532ba8 --- /dev/null +++ b/ffplayout-frontend @@ -0,0 +1 @@ +Subproject commit e8532ba8d095ae83886df39ba53e9595b124f9c0 diff --git a/ffplayout/src/utils/args_parse.rs b/ffplayout/src/utils/args_parse.rs index 191da0c7..c5c0d733 100644 --- a/ffplayout/src/utils/args_parse.rs +++ b/ffplayout/src/utils/args_parse.rs @@ -18,8 +18,12 @@ use crate::ARGS; about = "REST API for ffplayout", long_about = None)] pub struct Args { - #[clap(short, long, help = "ask for user credentials")] - pub ask: bool, + #[clap( + short, + long, + help = "Initialize defaults: global admin, paths, settings, etc." + )] + pub init: bool, #[clap(long, env, help = "path to database file")] pub db: Option, @@ -93,22 +97,21 @@ pub struct Args { pub async fn run_args(pool: &Pool) -> Result<(), i32> { let mut args = ARGS.clone(); - if args.ask { + if args.init { let mut user = String::new(); - print!("Username: "); + let mut mail = String::new(); + let mut storage = String::new(); + let mut playlist = String::new(); + let mut hls = String::new(); + + print!("Global admin: "); stdout().flush().unwrap(); stdin() .read_line(&mut user) .expect("Did not enter a correct name?"); - if let Some('\n') = user.chars().next_back() { - user.pop(); - } - if let Some('\r') = user.chars().next_back() { - user.pop(); - } - args.username = Some(user); + args.username = Some(user.trim().to_string()); print!("Password: "); stdout().flush().unwrap(); @@ -116,21 +119,29 @@ pub async fn run_args(pool: &Pool) -> Result<(), i32> { args.password = password.ok(); - let mut mail = String::new(); print!("Mail: "); stdout().flush().unwrap(); stdin() .read_line(&mut mail) .expect("Did not enter a correct name?"); - if let Some('\n') = mail.chars().next_back() { - mail.pop(); - } - if let Some('\r') = mail.chars().next_back() { - mail.pop(); + + args.mail = Some(mail.trim().to_string()); + + print!("Storage path [/var/lib/ffplayout/tv-media]: "); + stdout().flush().unwrap(); + + stdin() + .read_line(&mut storage) + .expect("Did not enter a correct path?"); + + if storage.trim().is_empty() { + args.storage_path = Some(PathBuf::from("/var/lib/ffplayout/tv-media")); + } else { + args.storage_path = Some(PathBuf::from(storage.trim())); } - args.mail = Some(mail); + println!("{args:?}"); } if let Some(username) = args.username { diff --git a/ffplayout/src/utils/config.rs b/ffplayout/src/utils/config.rs index e9ae902d..0c25bb16 100644 --- a/ffplayout/src/utils/config.rs +++ b/ffplayout/src/utils/config.rs @@ -303,8 +303,6 @@ pub struct Processing { pub help_text: String, pub mode: ProcessMode, pub audio_only: bool, - #[serde(default = "default_track_index")] - pub audio_track_index: i32, pub copy_audio: bool, pub copy_video: bool, pub width: i64, @@ -317,6 +315,8 @@ pub struct Processing { pub logo_opacity: f64, pub logo_position: String, pub audio_tracks: i32, + #[serde(default = "default_track_index")] + pub audio_track_index: i32, pub audio_channels: u8, pub volume: f64, pub custom_filter: String, diff --git a/migrations/00001_create_tables.sql b/migrations/00001_create_tables.sql index 057bbd82..1e70fdf7 100644 --- a/migrations/00001_create_tables.sql +++ b/migrations/00001_create_tables.sql @@ -80,7 +80,7 @@ CREATE TABLE logging_help TEXT NOT NULL DEFAULT "If 'log_to_file' is true, log to file, when is false log to console. \n'local_time' to false will set log timestamps to UTC. Path to /var/log/ only if you run this program as daemon.\n'level' can be DEBUG, INFO, WARNING, ERROR.\n'ffmpeg_level/ingest_level' can be INFO, WARNING, ERROR.\n'detect_silence' logs an error message if the audio line is silent for 15 seconds during the validation process.\n'ignore_lines' makes logging to ignore strings that contains matched lines, in frontend is a semicolon separated list.", logging_ffmpeg_level TEXT NOT NULL DEFAULT "ERROR", logging_ingest_level TEXT NOT NULL DEFAULT "ERROR", - logging_detect_silence INTEGER NOT NULL DEFAULT 1, + logging_detect_silence INTEGER NOT NULL DEFAULT 0, logging_ignore TEXT NOT NULL DEFAULT "P sub_mb_type 4 out of range at;error while decoding MB;negative number of zero coeffs at;out of range intra chroma pred mode;non-existing SPS 0 referenced in buffering period", processing_help TEXT NOT NULL DEFAULT "Default processing for all clips, to have them unique. Mode can be playlist or folder.\n'aspect' must be a float number.'logo' is only used if the path exist, path is relative to your storage folder.\n'logo_scale' scale the logo to target size, leave it blank when no scaling is needed, format is 'width:height', for example '100:-1' for proportional scaling. With 'logo_opacity' logo can become transparent.\nWith 'audio_tracks' it is possible to configure how many audio tracks should be processed.\n'audio_channels' can be use, if audio has more channels then only stereo.\nWith 'logo_position' in format 'x:y' you set the logo position.\nWith 'custom_filter' it is possible, to apply further filters. The filter outputs should end with [c_v_out] for video filter, and [c_a_out] for audio filter.", processing_mode TEXT NOT NULL DEFAULT "playlist",