use std::{env, fs, path::PathBuf}; pub const HELP_STR: &str = include_str!("./help.str"); pub const YT_DLP_FLAGS: [&str; 13] = [ // Ignore errors arising of unavailable sponsor block API "--ignore-errors", "--format", "bestvideo[height<=?1080]+bestaudio/best", "--embed-chapters", "--progress", "--write-comments", "--extractor-args", "youtube:max_comments=150,all,100;comment_sort=top", "--write-info-json", "--sponsorblock-mark", "default", "--sponsorblock-remove", "sponsor", ]; pub const MPV_FLAGS: [&str; 2] = ["--speed=2.7", "--volume=75"]; pub const CONCURRENT: u32 = 5; pub const DOWNLOAD_DIR: &str = "/tmp/ytcc"; fn get_runtime_path(component: &'static str) -> anyhow::Result { let out: PathBuf = format!( "{}/{}", env::var("XDG_RUNTIME_DIR").expect("This should always exist"), component ) .into(); fs::create_dir_all(out.parent().expect("Parent should exist"))?; Ok(out) } const STATUS_PATH: &str = "ytcc/running"; pub fn status_path() -> anyhow::Result { get_runtime_path(STATUS_PATH) } const LAST_SELECT: &str = "ytcc/selected.yts"; pub fn last_select() -> anyhow::Result { get_runtime_path(LAST_SELECT) }