mirror of
https://github.com/beetbox/beets.git
synced 2026-01-08 17:08:12 +01:00
Do not search for Various Artists, split titles by ' / '
This commit is contained in:
parent
39c479fcab
commit
7389f241f4
2 changed files with 16 additions and 5 deletions
|
|
@ -158,10 +158,20 @@ def search_pairs(item):
|
|||
# Remove any featuring artists from the artists name
|
||||
rf"(.*?) {plugins.feat_tokens()}"
|
||||
]
|
||||
artists = generate_alternatives(artist, patterns)
|
||||
|
||||
# Skip various artists
|
||||
artists = []
|
||||
lower_artist = artist.lower()
|
||||
if "various" not in lower_artist:
|
||||
artists.extend(generate_alternatives(artist, patterns))
|
||||
# Use the artist_sort as fallback only if it differs from artist to avoid
|
||||
# repeated remote requests with the same search terms
|
||||
if artist_sort and artist.lower() != artist_sort.lower():
|
||||
artist_sort_lower = artist_sort.lower()
|
||||
if (
|
||||
artist_sort
|
||||
and lower_artist != artist_sort_lower
|
||||
and "various" not in artist_sort_lower
|
||||
):
|
||||
artists.append(artist_sort)
|
||||
|
||||
patterns = [
|
||||
|
|
@ -180,8 +190,8 @@ def search_pairs(item):
|
|||
multi_titles = []
|
||||
for title in titles:
|
||||
multi_titles.append([title])
|
||||
if "/" in title:
|
||||
multi_titles.append([x.strip() for x in title.split("/")])
|
||||
if " / " in title:
|
||||
multi_titles.append([x.strip() for x in title.split(" / ")])
|
||||
|
||||
return itertools.product(artists, multi_titles)
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ class TestLyricsUtils:
|
|||
@pytest.mark.parametrize(
|
||||
"artist, title",
|
||||
[
|
||||
("Various Artists", "Title"),
|
||||
("Artist", ""),
|
||||
("", "Title"),
|
||||
(" ", ""),
|
||||
|
|
@ -81,7 +82,7 @@ class TestLyricsUtils:
|
|||
@pytest.mark.parametrize(
|
||||
"title, expected_extra_titles",
|
||||
[
|
||||
("1/2", ["1", "2"]),
|
||||
("1/2", []),
|
||||
("1 / 2", ["1", "2"]),
|
||||
("Song (live)", ["Song"]),
|
||||
("Song (live) (new)", ["Song"]),
|
||||
|
|
|
|||
Loading…
Reference in a new issue