Skip to content
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

Try to match a list of genres in rescan #282

Merged
merged 3 commits into from
Jan 15, 2022
Merged

Try to match a list of genres in rescan #282

merged 3 commits into from
Jan 15, 2022

Conversation

robbevp
Copy link
Member

@robbevp robbevp commented Jan 15, 2022

This PR improves the way the rescan runner handles the genre tag and allows creating multiple genres from one tag.

Since ID3 tag and vorbis tags only allow one genre field, there are a lot of files that have a list of genres inside that one tag. Up until now we created a genre with the literal string inside the tag, often resulting in genres like Folk/Rock or Rock, Folk, Folk-Rock - which then need a manual conversion to multiple genres.

With this PR, this logic is changed so that we pick up a list of genres and create a genre for each item in the list.

The logic is now as follows:
If the genre is already in the database (even if it is a list), we match this genre. (So that a user can use the separator inside a genre name if they want).
Otherwise, we split the string by , or / and try to match each part (normalized and stripped of whitespace to allow Genre 1, Genre 2) or create new genre for each part

There might be some other separators used or relevant, but these two seemed to be the two most common in our library. A combination of both is also possible (however unlikely/messy that sounds)

  • I've added tests relevant to my changes.
    The new file in the test contains the genre tag genre 1, genre 2 / genre 3

@robbevp robbevp added the enhancement New feature or request label Jan 15, 2022
@robbevp robbevp requested a review from chvp January 15, 2022 10:22
@robbevp robbevp self-assigned this Jan 15, 2022
app/models/rescan_runner.rb Outdated Show resolved Hide resolved
@chvp chvp enabled auto-merge (squash) January 15, 2022 10:25
@chvp chvp merged commit b871650 into main Jan 15, 2022
@chvp chvp deleted the enhc/rescan-genres branch January 15, 2022 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants