Skip to content

Commit

Permalink
fixup! internal: clean up Album logic
Browse files Browse the repository at this point in the history
  • Loading branch information
snejus committed Apr 28, 2024
1 parent 0649df3 commit 3c6f762
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions beetsplug/bandcamp/album.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class AlbumName:
_series = r"(?i:\b(part|volume|pt|vol)\b\.?)"
SERIES = re.compile(rf"{_series}[ ]?[A-Z\d.-]+\b")
SERIES_FMT = re.compile(rf"^(.+){_series} *0*")
REMIX_IN_TITLE = re.compile(r"[^][\w]*(with re|inc|\+)[^()]*mix[^()-]*\W?", re.I)
REMIX_IN_TITLE = re.compile(r"[\( :]+(with re|inc|\+).*mix(\)|.*$)", re.I)
CLEAN_EPLP = re.compile(r"(?:[([]|Double ){0,2}(\b[EL]P\b)\S?", re.I)
EPLP_ALBUM = re.compile(
r"\b((?:(?!VA|Various|-)[^: ]+ )+)([EL]P(?! *\d)(?: [\w#][^ ]+$)?)"
Expand Down Expand Up @@ -82,7 +82,7 @@ def name(self) -> str:
return next(iter(self.album_names))

@cached_property
def series(self) -> Optional[str]:
def series_part(self) -> Optional[str]:
"""Return series if it is found in any of the album names."""
for name in self.album_names:
if m := self.SERIES.search(name):
Expand All @@ -107,7 +107,7 @@ def format_series(m: re.Match) -> str: # type: ignore[type-arg]

def standardize_series(self, album: str) -> str:
"""Standardize 'Vol', 'Part' etc. format."""
series = self.series
series = self.series_part
if not series:
return album

Expand Down Expand Up @@ -178,7 +178,7 @@ def clean(cls, name: str, to_clean: List[str], label: str = "") -> str:
name = PATTERNS["ft"].sub("", name)
name = cls.remove_va(name)
name = cls.remove_label(Helpers.clean_name(name), label)
name = cls.REMIX_IN_TITLE.sub("", name).strip("- ")
name = cls.REMIX_IN_TITLE.sub(" ", name).strip("- ")

# uppercase EP and LP, and remove surrounding parens / brackets
name = cls.CLEAN_EPLP.sub(lambda x: x.group(1).upper(), name)
Expand Down

0 comments on commit 3c6f762

Please sign in to comment.