mps-youtube / yewtube

yewtube, forked from mps-youtube , is a Terminal based YouTube player and downloader. No Youtube API key required.
GNU General Public License v3.0
8.07k stars 645 forks source link

How to fix any cache issue on mps #1106

Closed ciciolina closed 1 year ago

ciciolina commented 4 years ago

Hi, i found problems with the cache file on mpsyt, always needed to put this line on the terminal before use mpsyt:

**rm ~/.config/mps-youtube/cachepy***

I found this very hard to digest for that reason and after try to put this line in my bash to execute automatically when i run terminal and found this only works 30% of the times i made other approximation to the problem, what about a line to search, validate and delete dynamically the cachepy* file? and the code works directly on bash and works 100%.

After many search and try, i found the cache file its the only one without an extension in the location and that make more easy my approach, making a code to delete the files without extensions and leave the others (config files, history and others).

based on one post i found online (link below) i made one line for mpsyt cache delete and amazing this fix any cache related issue, include:

This is the code you can put on your ~bash file:

*find /home/YOUR USER/.config/mps-youtube -type f -regextype posix-extended -iregex '..(.?)$' -delete**

if you have your installation folder on other place:

*find PATH/TO/FILES/mps-youtube -type f -regextype posix-extended -iregex '..(.?)$' -delete**

This is the explanation of the code i base this approach if you like to look in deep:

Remove all files that does not follow the following extensions

The code its secure you can tested before delete anything running it without the "-delete" part and the terminal show you the files that you can delete before do it in this case cache_py* remember put "-delete" after that test.

I found this line more efficient and works always independent of the name of the cache file, independent of any update that change the name of the file this line will work always, i suggest to put it in the ~bash file in that way you run mpsyt without the cache file and this dont have any repercussion on the history of search or the configuration of mpsyt. Run clear and flawless anytime.

Thanks and excuse my for the bad English.

spooky-soft commented 2 years ago

Unfortunately, this also deletes your YouTube API key, which you kind of need to run mpsyt. Once you've added this line to your .bashrc/.zshrc, I'd suggest adding the following line below it:

mpsyt set api_key YOUTUBE_API_KEY

This way, after your cache is cleared, your api key is still automatically set, and you don't need to dig it up every time you open a terminal.