about summary refs log tree commit diff stats
path: root/src/constants.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/constants.rs74
1 files changed, 0 insertions, 74 deletions
diff --git a/src/constants.rs b/src/constants.rs
index cb8388d..54cae89 100644
--- a/src/constants.rs
+++ b/src/constants.rs
@@ -8,78 +8,4 @@
 // You should have received a copy of the License along with this program.
 // If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
 
-use std::{env::temp_dir, fs, path::PathBuf};
-
-use anyhow::{Context, Result};
-
 pub const HELP_STR: &str = include_str!("./select/selection_file/help.str");
-pub const LOCAL_COMMENTS_LENGTH: usize = 1000;
-
-// NOTE: KEEP THIS IN SYNC WITH THE `mpv_playback_speed` in `cli.rs` <2024-08-20>
-pub const DEFAULT_MPV_PLAYBACK_SPEED: f64 = 2.7;
-pub const DEFAULT_SUBTITLE_LANGS: &str = "";
-
-pub const CONCURRENT_DOWNLOADS: u32 = 5;
-// We download to the temp dir to avoid taxing the disk
-pub fn download_dir(create: bool) -> Result<PathBuf> {
-    const DOWNLOAD_DIR: &str = "/tmp/yt";
-    let dir = PathBuf::from(DOWNLOAD_DIR);
-
-    if !dir.exists() && create {
-        fs::create_dir_all(&dir).context("Failed to create the download directory")?
-    }
-
-    Ok(dir)
-}
-
-const PREFIX: &str = "yt";
-fn get_runtime_path(name: &'static str) -> anyhow::Result<PathBuf> {
-    let xdg_dirs = xdg::BaseDirectories::with_prefix(PREFIX)?;
-    xdg_dirs
-        .place_runtime_file(name)
-        .with_context(|| format!("Failed to place runtime file: '{}'", name))
-}
-fn get_data_path(name: &'static str) -> anyhow::Result<PathBuf> {
-    let xdg_dirs = xdg::BaseDirectories::with_prefix(PREFIX)?;
-    xdg_dirs
-        .place_data_file(name)
-        .with_context(|| format!("Failed to place data file: '{}'", name))
-}
-fn get_config_path(name: &'static str) -> anyhow::Result<PathBuf> {
-    let xdg_dirs = xdg::BaseDirectories::with_prefix(PREFIX)?;
-    xdg_dirs
-        .place_config_file(name)
-        .with_context(|| format!("Failed to place config file: '{}'", name))
-}
-
-pub fn mpv_config_path() -> anyhow::Result<PathBuf> {
-    const MPV_CONFIG_PATH: &str = "mpv.conf";
-    get_config_path(MPV_CONFIG_PATH)
-}
-pub fn mpv_input_path() -> anyhow::Result<PathBuf> {
-    const MPV_INPUT_CONFIG_PATH: &str = "mpv.input.conf";
-    get_config_path(MPV_INPUT_CONFIG_PATH)
-}
-
-pub fn status_path() -> anyhow::Result<PathBuf> {
-    const STATUS_PATH: &str = "running.info.json";
-    get_runtime_path(STATUS_PATH)
-}
-pub fn last_select() -> anyhow::Result<PathBuf> {
-    const LAST_SELECT: &str = "selected.yts";
-    get_runtime_path(LAST_SELECT)
-}
-
-pub fn database() -> anyhow::Result<PathBuf> {
-    const DATABASE: &str = "videos.sqlite";
-    get_data_path(DATABASE)
-}
-pub fn subscriptions() -> anyhow::Result<PathBuf> {
-    const SUBSCRIPTIONS: &str = "subscriptions.json";
-    get_data_path(SUBSCRIPTIONS)
-}
-
-pub fn cache_path() -> PathBuf {
-    let temp_dir = temp_dir();
-    temp_dir.join("ytc")
-}