Skip to content

Commit

Permalink
fix bug where trackartist matchers were reading releaseartists
Browse files Browse the repository at this point in the history
  • Loading branch information
azuline committed May 6, 2024
1 parent 866becb commit 7bd796b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 14 deletions.
28 changes: 14 additions & 14 deletions rose/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,13 @@ def filter_track_false_positives_using_tags(
match = match or (field == "secondarygenre" and any(matches_pattern(matcher.pattern, x) for x in tags.secondarygenre))
match = match or (field == "descriptor" and any(matches_pattern(matcher.pattern, x) for x in tags.descriptor))
match = match or (field == "label" and any(matches_pattern(matcher.pattern, x) for x in tags.label))
match = match or (field == "trackartist[main]" and any(matches_pattern(matcher.pattern, x.name) for x in tags.releaseartists.main))
match = match or (field == "trackartist[guest]" and any(matches_pattern(matcher.pattern, x.name) for x in tags.releaseartists.guest))
match = match or (field == "trackartist[remixer]" and any(matches_pattern(matcher.pattern, x.name) for x in tags.releaseartists.remixer))
match = match or (field == "trackartist[producer]" and any(matches_pattern(matcher.pattern, x.name) for x in tags.releaseartists.producer))
match = match or (field == "trackartist[composer]" and any(matches_pattern(matcher.pattern, x.name) for x in tags.releaseartists.composer))
match = match or (field == "trackartist[conductor]" and any(matches_pattern(matcher.pattern, x.name) for x in tags.releaseartists.conductor))
match = match or (field == "trackartist[djmixer]" and any(matches_pattern(matcher.pattern, x.name) for x in tags.releaseartists.djmixer))
match = match or (field == "trackartist[main]" and any(matches_pattern(matcher.pattern, x.name) for x in tags.trackartists.main))
match = match or (field == "trackartist[guest]" and any(matches_pattern(matcher.pattern, x.name) for x in tags.trackartists.guest))
match = match or (field == "trackartist[remixer]" and any(matches_pattern(matcher.pattern, x.name) for x in tags.trackartists.remixer))
match = match or (field == "trackartist[producer]" and any(matches_pattern(matcher.pattern, x.name) for x in tags.trackartists.producer))
match = match or (field == "trackartist[composer]" and any(matches_pattern(matcher.pattern, x.name) for x in tags.trackartists.composer))
match = match or (field == "trackartist[conductor]" and any(matches_pattern(matcher.pattern, x.name) for x in tags.trackartists.conductor))
match = match or (field == "trackartist[djmixer]" and any(matches_pattern(matcher.pattern, x.name) for x in tags.trackartists.djmixer))
match = match or (field == "releaseartist[main]" and any(matches_pattern(matcher.pattern, x.name) for x in tags.releaseartists.main))
match = match or (field == "releaseartist[guest]" and any(matches_pattern(matcher.pattern, x.name) for x in tags.releaseartists.guest))
match = match or (field == "releaseartist[remixer]" and any(matches_pattern(matcher.pattern, x.name) for x in tags.releaseartists.remixer))
Expand Down Expand Up @@ -282,13 +282,13 @@ def filter_track_false_positives_using_tags(
skip = skip or (field == "secondarygenre" and any(matches_pattern(i.pattern, x) for x in tags.secondarygenre))
skip = skip or (field == "descriptor" and any(matches_pattern(i.pattern, x) for x in tags.descriptor))
skip = skip or (field == "label" and any(matches_pattern(i.pattern, x) for x in tags.label))
skip = skip or (field == "trackartist[main]" and any(matches_pattern(i.pattern, x.name) for x in tags.releaseartists.main))
skip = skip or (field == "trackartist[guest]" and any(matches_pattern(i.pattern, x.name) for x in tags.releaseartists.guest))
skip = skip or (field == "trackartist[remixer]" and any(matches_pattern(i.pattern, x.name) for x in tags.releaseartists.remixer))
skip = skip or (field == "trackartist[producer]" and any(matches_pattern(i.pattern, x.name) for x in tags.releaseartists.producer))
skip = skip or (field == "trackartist[composer]" and any(matches_pattern(i.pattern, x.name) for x in tags.releaseartists.composer))
skip = skip or (field == "trackartist[conductor]" and any(matches_pattern(i.pattern, x.name) for x in tags.releaseartists.conductor))
skip = skip or (field == "trackartist[djmixer]" and any(matches_pattern(i.pattern, x.name) for x in tags.releaseartists.djmixer))
skip = skip or (field == "trackartist[main]" and any(matches_pattern(i.pattern, x.name) for x in tags.trackartists.main))
skip = skip or (field == "trackartist[guest]" and any(matches_pattern(i.pattern, x.name) for x in tags.trackartists.guest))
skip = skip or (field == "trackartist[remixer]" and any(matches_pattern(i.pattern, x.name) for x in tags.trackartists.remixer))
skip = skip or (field == "trackartist[producer]" and any(matches_pattern(i.pattern, x.name) for x in tags.trackartists.producer))
skip = skip or (field == "trackartist[composer]" and any(matches_pattern(i.pattern, x.name) for x in tags.trackartists.composer))
skip = skip or (field == "trackartist[conductor]" and any(matches_pattern(i.pattern, x.name) for x in tags.trackartists.conductor))
skip = skip or (field == "trackartist[djmixer]" and any(matches_pattern(i.pattern, x.name) for x in tags.trackartists.djmixer))
skip = skip or (field == "releaseartist[main]" and any(matches_pattern(i.pattern, x.name) for x in tags.releaseartists.main))
skip = skip or (field == "releaseartist[guest]" and any(matches_pattern(i.pattern, x.name) for x in tags.releaseartists.guest))
skip = skip or (field == "releaseartist[remixer]" and any(matches_pattern(i.pattern, x.name) for x in tags.releaseartists.remixer))
Expand Down
12 changes: 12 additions & 0 deletions rose/rules_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,3 +400,15 @@ def test_ignore_values(config: Config, source_dir: Path) -> None:
execute_metadata_rule(config, rule, confirm_yes=False)
af = AudioTags.from_file(source_dir / "Test Release 1" / "01.m4a")
assert af.tracktitle == "Track 1"


def test_artist_matcher_on_trackartist_only(config: Config, source_dir: Path) -> None:
af = AudioTags.from_file(source_dir / "Test Release 1" / "01.m4a")
af.trackartists.main = [Artist("BIGBANG & 2NE1")]
af.releaseartists.main = [Artist("BIGBANG"), Artist("2NE1")]
af.flush()
update_cache(config)
rule = MetadataRule.parse("artist: & ", ["split: & "])
execute_metadata_rule(config, rule, confirm_yes=False)
af = AudioTags.from_file(source_dir / "Test Release 1" / "01.m4a")
assert af.trackartists.main == [Artist("BIGBANG"), Artist("2NE1")]

0 comments on commit 7bd796b

Please sign in to comment.