diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-05-23 13:26:22 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-05-23 13:26:22 +0200 |
commit | 204731c0a69136c9cebcb54f1afecf5145e26bbe (patch) | |
tree | fc9132e5dc74e4a8e1327cdd411839a90f9410aa /pkgs/sources/yt/src/constants.rs | |
parent | refactor(sys): Modularize and move to `modules/system` or `pkgs` (diff) | |
download | nixos-config-204731c0a69136c9cebcb54f1afecf5145e26bbe.tar.gz nixos-config-204731c0a69136c9cebcb54f1afecf5145e26bbe.zip |
refactor(pkgs): Categorize into `by-name` shards
This might not be the perfect way to organize a package set -- especially if the set is not nearly the size of nixpkgs -- but it is _at_ least a way of organization.
Diffstat (limited to 'pkgs/sources/yt/src/constants.rs')
-rw-r--r-- | pkgs/sources/yt/src/constants.rs | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/pkgs/sources/yt/src/constants.rs b/pkgs/sources/yt/src/constants.rs deleted file mode 100644 index 5e233656..00000000 --- a/pkgs/sources/yt/src/constants.rs +++ /dev/null @@ -1,51 +0,0 @@ -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; 4] = [ - "--speed=2.7", - "--volume=75", - "--keep-open=yes", - "--msg-level=osd/libass=fatal", -]; - -pub const CONCURRENT: u32 = 5; - -pub const DOWNLOAD_DIR: &str = "/tmp/ytcc"; - -fn get_runtime_path(component: &'static str) -> anyhow::Result<PathBuf> { - 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<PathBuf> { - get_runtime_path(STATUS_PATH) -} - -const LAST_SELECT: &str = "ytcc/selected.yts"; -pub fn last_select() -> anyhow::Result<PathBuf> { - get_runtime_path(LAST_SELECT) -} |