With the updates in the caching mechanism we check if the file exists in
cache if yes then extractedImagePath now points to that path else
we generate the name for the image and pass the image to extractImage
and it passes the default value if no embedded image was found and
checks in the lastfm api and the rest works the same.
Instead of Caching by maintaining a cache file as mentioned here https://github.com/aditya-K2/goMP/issues/14#issuecomment-989141798
We can directly check if the file exists if it exists then we can just
pass the path to it else we can copy the default image to the path of
the imagePath
This fixes The Issue when a song with unknown duration was played then the percentage was
calculated wrong and the slice was getting out of bound.
fix : I have added a check for the duration.
Sometimes the image is not found and for those artist/albums there is no
way for pointing the image path to default image path so some helper
functions have been added so that we can point them to default Image.
Now before rendering the image the image is checked in the cache if it
exists then the image is rendered else it is added to the cache and then
rendered.
Following Functions have been added :
1. SetCacheDir : Sets the Cache Directory
2. CHANGE AddToCache the image path is now the Cache Directory +
image Path
The Following New Functions have been added
1. AddToCache Adds to the CACHE_LIST map
2. GetFromCache Retrieves path from CACHE_LIST map
3. Rename WriteToCache -> WriteCache()
4. GenerateName now replaces spaces with underscores.