Commit 7d217a8cc1
7d217a8cc1e17ac8855c580df8c105220f10984d
parent: 1bcc239030
Unsigned
Siriusmart <sirius@siri.ws> · 2025-10-24 07:38 UTC
removed all references to .cache/youtube-tui (except the two commands)
Layout: unified · split
src/exit.rs
+7 −5
| @@ -18,12 +18,12 @@ pub fn exit(framework: &mut Framework) -> Result<(), Box<dyn Error>> { |
| 18 | 18 | let limits = framework.data.global.get::<MainConfig>().unwrap().limits; |
| 19 | 19 | let watchhistory = framework.data.global.get_mut::<WatchHistory>().unwrap(); |
| 20 | 20 | watchhistory.trim(limits.watch_history); |
| 21 | | watchhistory.exit_move(); |
| 21 | // watchhistory.exit_move(); |
| 22 | 22 | let _ = watchhistory.save(); |
| 23 | 23 | let subscriptions = framework.data.global.get::<Subscriptions>().unwrap(); |
| 24 | | subscriptions.exit_move(); |
| 24 | // subscriptions.exit_move(); |
| 25 | 25 | let _ = subscriptions.save(); |
| 26 | | framework.data.global.get::<Library>().unwrap().exit_move(); |
| 26 | // framework.data.global.get::<Library>().unwrap().exit_move(); |
| 27 | 27 | let searchhistory = framework.data.global.get_mut::<SearchHistory>().unwrap(); |
| 28 | 28 | searchhistory.trim(limits.search_history); |
| 29 | 29 | let _ = searchhistory.save(); |
| @@ -31,12 +31,14 @@ pub fn exit(framework: &mut Framework) -> Result<(), Box<dyn Error>> { |
| 31 | 31 | commandhistory.trim(limits.commands_history); |
| 32 | 32 | let _ = commandhistory.save(); |
| 33 | 33 | |
| 34 | | let home_dir = home_dir().unwrap(); |
| 35 | | let cache_path = home_dir.join(".cache/youtube-tui/"); |
| 34 | // let home_dir = home_dir().unwrap(); |
| 35 | // let cache_path = home_dir.join(".cache/youtube-tui/"); |
| 36 | 36 | |
| 37 | /* |
| 37 | 38 | if cache_path.exists() { |
| 38 | 39 | fs::remove_dir_all(cache_path)?; |
| 39 | 40 | } |
| 41 | */ |
| 40 | 42 | |
| 41 | 43 | Ok(()) |
| 42 | 44 | } |
src/global/functions/download_all_images.rs
+1 −1
| @@ -48,7 +48,7 @@ pub fn download_all_images(downloads: Vec<Option<DownloadRequest>>) { |
| 48 | 48 | |
| 49 | 49 | let path = home::home_dir() |
| 50 | 50 | .expect("Cannot get your home directory") |
| 51 | | .join(".cache/youtube-tui/thumbnails/"); |
| 51 | .join(".local/share/youtube-tui/thumbnails/"); |
| 52 | 52 | |
| 53 | 53 | downloads.into_iter().flatten().for_each(|req| { |
| 54 | 54 | let path = path.clone().join(req.id); |
src/global/functions/run_command.rs
+1 −1
| @@ -127,7 +127,7 @@ pub fn run_single_command( |
| 127 | 127 | Ok(serde_json::from_str(&fs::read_to_string( |
| 128 | 128 | home_dir() |
| 129 | 129 | .unwrap() |
| 130 | | .join(format!(".cache/youtube-tui/info/{id}.json")), |
| 130 | .join(format!(".local/share/youtube-tui/info/{id}.json")), |
| 131 | 131 | )?)?) |
| 132 | 132 | })() { |
| 133 | 133 | Ok(item) => { |
src/global/functions/singleitem_load.rs
+1 −1
| @@ -32,7 +32,7 @@ pub fn load_video(id: &str, mainconfig: &MainConfig) -> Result<Item, Box<dyn Err |
| 32 | 32 | |
| 33 | 33 | pub fn load_channel(id: &str, mainconfig: &MainConfig) -> Result<Item, Box<dyn Error>> { |
| 34 | 34 | let home_dir = home_dir().unwrap(); |
| 35 | | let cache_path = home_dir.join(format!(".cache/youtube-tui/channels/{id}.json")); |
| 35 | let cache_path = home_dir.join(format!(".local/share/youtube-tui/channels/{id}.json")); |
| 36 | 36 | |
| 37 | 37 | if cache_path.exists() { |
| 38 | 38 | if let Ok(content) = fs::read_to_string(&cache_path) { |
src/global/structs/subscriptions.rs
+1 −1
| @@ -248,7 +248,7 @@ fn update_channel_cache( |
| 248 | 248 | image_index: usize, |
| 249 | 249 | ) -> Result<(), Box<dyn Error>> { |
| 250 | 250 | let home_dir = home_dir().unwrap(); |
| 251 | | let cache_path = home_dir.join(format!(".cache/youtube-tui/channels/{}.json", channel.id)); |
| 251 | let cache_path = home_dir.join(format!(".local/share/youtube-tui/channels/{}.json", channel.id)); |
| 252 | 252 | |
| 253 | 253 | if let Some(parent) = cache_path.parent() { |
| 254 | 254 | fs::create_dir_all(parent)?; |
src/global/traits/collection.rs
+2 −2
| @@ -55,7 +55,7 @@ where |
| 55 | 55 | |
| 56 | 56 | /// add an item to watch history |
| 57 | 57 | fn push(&mut self, item: T) -> Result<(), Box<dyn Error>> { |
| 58 | | let info = home_dir().unwrap().join(".cache/youtube-tui/info/"); |
| 58 | let info = home_dir().unwrap().join(".local/share/youtube-tui/info/"); |
| 59 | 59 | |
| 60 | 60 | // removes duplicates and place them on top (if exists) |
| 61 | 61 | let id = item.id().unwrap_or("invalid-dump"); |
| @@ -91,7 +91,7 @@ where |
| 91 | 91 | // if res is err, then the file either doesn't exist of has be altered incorrectly, in |
| 92 | 92 | // which case returns Self::default() |
| 93 | 93 | let items = if let Ok(deserialized) = res { |
| 94 | | let info = home_dir().unwrap().join(".cache/youtube-tui/info/"); |
| 94 | let info = home_dir().unwrap().join(".local/share/youtube-tui/info/"); |
| 95 | 95 | deserialized |
| 96 | 96 | .into_iter() |
| 97 | 97 | .filter_map(|id| fs::read_to_string(info.join(format!("{id}.json"))).ok()) |
src/init.rs
+4 −4
| @@ -33,9 +33,9 @@ pub fn init( |
| 33 | 33 | |
| 34 | 34 | // creating files |
| 35 | 35 | [ |
| 36 | | ".cache/youtube-tui/thumbnails/", |
| 37 | | ".cache/youtube-tui/info/", |
| 38 | | ".cache/youtube-tui/channels/", |
| 36 | // ".cache/youtube-tui/thumbnails/", |
| 37 | // ".cache/youtube-tui/info/", |
| 38 | // ".cache/youtube-tui/channels/", |
| 39 | 39 | ".local/share/youtube-tui/thumbnails/", |
| 40 | 40 | ".local/share/youtube-tui/info/", |
| 41 | 41 | ".local/share/youtube-tui/saved/", |
| @@ -48,7 +48,7 @@ pub fn init( |
| 48 | 48 | } |
| 49 | 49 | }); |
| 50 | 50 | |
| 51 | | init_move(); |
| 51 | // init_move(); |
| 52 | 52 | |
| 53 | 53 | load_configs(&mut framework.split_clean().0)?; |
| 54 | 54 | |
src/items/iteminfo.rs
+1 −1
| @@ -55,7 +55,7 @@ impl FrameworkItem for ItemInfo { |
| 55 | 55 | { |
| 56 | 56 | let thumbnail_path = home::home_dir() |
| 57 | 57 | .unwrap() |
| 58 | | .join(".cache/youtube-tui/thumbnails/") |
| 58 | .join(".local/share/youtube-tui/thumbnails/") |
| 59 | 59 | .join(item.thumbnail_id()); |
| 60 | 60 | if thumbnail_path.exists() { |
| 61 | 61 | #[cfg(any(feature = "sixel", feature = "halfblock"))] |
src/items/itemlist.rs
+1 −1
| @@ -165,7 +165,7 @@ impl ItemList { |
| 165 | 165 | let page_to_load = if home_dir() |
| 166 | 166 | .unwrap() |
| 167 | 167 | .join(format!( |
| 168 | | ".cache/youtube-tui/info/{}.json", |
| 168 | ".local/share/youtube-tui/info/{}.json", |
| 169 | 169 | self.items[self.textlist.selected].id().unwrap_or_default() |
| 170 | 170 | )) |
| 171 | 171 | .exists() |
src/items/singleitem.rs
+1 −1
| @@ -746,7 +746,7 @@ impl FrameworkItem for SingleItem { |
| 746 | 746 | let (item, r#type) = match r#type { |
| 747 | 747 | SingleItemPage::Video(id) => { |
| 748 | 748 | let home_dir = home_dir().unwrap(); |
| 749 | | let path = home_dir.join(format!(".cache/youtube-tui/info/{id}.json")); |
| 749 | let path = home_dir.join(format!(".local/youtube-tui/info/{id}.json")); |
| 750 | 750 | |
| 751 | 751 | let video = if path.exists() { |
| 752 | 752 | serde_json::from_str(&fs::read_to_string(path)?)? |