Skip to content

Commit

Permalink
albumtype: include remix when number of remixes is one less than tot …
Browse files Browse the repository at this point in the history
…count
  • Loading branch information
snejus committed Nov 3, 2024
1 parent 49e824a commit 02d2bb5
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@

- `albumtype`:
- Improve accuracy of identifying **EP** and **LP** release types from the description.
- Include **remix** albumtype to the release when remixed track count is one less than
the track count.

- `catalognum`:
- Add support for new formats: **`UVB76-023`**, **`SOP 061-1233`**, **`a+w lp029`**,
Expand Down
6 changes: 4 additions & 2 deletions beetsplug/bandcamp/metaguru.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,14 @@ def albumtypes(self) -> List[str]:
albumtypes.add("lp")
if self.is_single_album:
albumtypes.add("single")
if self.albumtype == "single" and len(self.tracks) > 1:

track_count = len(self.tracks)
if self.albumtype == "single" and track_count > 1:
albumtypes.add("album")
for word in ["remix", "rmx", "edits", "live", "soundtrack"]:
if word in self.original_album.lower():
albumtypes.add(word.replace("rmx", "remix").replace("edits", "remix"))
if len(self.tracks.remixers) == len(self.tracks):
if len(self.tracks.remixers) >= max(track_count - 1, 1):
albumtypes.add("remix")

return sorted(albumtypes)
Expand Down
6 changes: 4 additions & 2 deletions tests/json/expected/ep.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"albumstatus": "Official",
"albumtype": "album",
"albumtypes": [
"album"
"album",
"remix"
],
"artist": "DJ DISRESPECT, jeånne",
"artist_credit": null,
Expand Down Expand Up @@ -210,7 +211,8 @@
"albumstatus": "Official",
"albumtype": "album",
"albumtypes": [
"album"
"album",
"remix"
],
"artist": "DJ DISRESPECT, jeånne",
"artist_credit": null,
Expand Down
1 change: 1 addition & 0 deletions tests/json/expected/remix_without_brackets.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"albumtype": "ep",
"albumtypes": [
"ep",
"remix",
"single"
],
"artist": "Aluphobia, Astatine",
Expand Down
2 changes: 2 additions & 0 deletions tests/json/expected/single_with_remixes.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"albumtype": "single",
"albumtypes": [
"album",
"remix",
"single"
],
"artist": "Reece Cox",
Expand Down Expand Up @@ -249,6 +250,7 @@
"albumtype": "single",
"albumtypes": [
"album",
"remix",
"single"
],
"artist": "Reece Cox",
Expand Down

0 comments on commit 02d2bb5

Please sign in to comment.