-
Notifications
You must be signed in to change notification settings - Fork 247
Use album id as hash to store album covers #514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There is another approach which is by using the album id as the hash input to avoid collision where the same songs with different album covers write to the same hash. I will attempt to implement that. |
spotify_player/src/client/mod.rs
Outdated
saved: bool, | ||
) -> Result<Vec<u8>> { | ||
let configs = config::get_config(); | ||
let hashedname = crate::utils::hash_filename(filename); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can append the hash at the end of the name instead. Also make it shorter, e.g use 6
characters instead of 16
? The main idea to keep the album's name and artist's name is to make it easy for users to find
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used 6 digits of the album id as the hash now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also update the PR's title to reflect the latest change?
Fixes #506
My attempt to address #506, this has been tested working on my windows machine, I do recommend more testing though, because with a small digest size, hash collision could occur. In that case, we could use a multi-folder caching technique.
I'm also new to rust, so hopefully I didn't break anything else :)