Skip to content

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

Merged
merged 8 commits into from
Aug 1, 2024

Conversation

leon332157
Copy link
Contributor

@leon332157 leon332157 commented Jul 23, 2024

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 :)

@leon332157
Copy link
Contributor Author

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.

saved: bool,
) -> Result<Vec<u8>> {
let configs = config::get_config();
let hashedname = crate::utils::hash_filename(filename);
Copy link
Owner

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

Copy link
Contributor Author

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

@leon332157 leon332157 requested a review from aome510 July 25, 2024 02:23
Copy link
Owner

@aome510 aome510 left a 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?

@leon332157 leon332157 changed the title Use hash instead of artist, album name to cache cover image Use album id as hash to store album covers Jul 30, 2024
@aome510 aome510 merged commit 314631f into aome510:master Aug 1, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OS error: file name too long
2 participants