extract album version into separate file

This commit is contained in:
mungai-njoroge 2023-08-14 11:01:53 +03:00
parent 27c4924327
commit 2471f51d86
2 changed files with 60 additions and 57 deletions

View File

@ -0,0 +1,58 @@
from enum import Enum
class AlbumVersionEnum(Enum):
"""
Enum for album versions.
"""
Explicit = ("explicit",)
ANNIVERSARY_EDITION = ("anniversary",)
DIAMOND_EDITION = ("diamond",)
Centennial_EDITION = ("centennial",)
GOLDEN_EDITION = ("gold",)
PLATINUM_EDITION = ("platinum",)
SILVER_EDITION = ("silver",)
ULTIMATE_EDITION = ("ultimate",)
EXPANDED = ("expanded",)
EXTENDED = ("extended",)
DELUXE = ("deluxe",)
SUPER_DELUXE = ("super deluxe",)
COMPLETE = ("complete",)
LEGACY_EDITION = ("legacy",)
SPECIAL_EDITION = ("special",)
COLLECTORS_EDITION = ("collector",)
ARCHIVE_EDITION = ("archive",)
Acoustic = ("acoustic",)
DOUBLE_DISC = ("double disc", "double disk")
SUMMER_EDITION = ("summer",)
WINTER_EDITION = ("winter",)
SPRING_EDITION = ("spring",)
FALL_EDITION = ("fall",)
BONUS_EDITION = ("bonus",)
BONUS_TRACK = ("bonus track",)
ORIGINAL = ("original",)
INTL_VERSION = ("international",)
UK_VERSION = ("uk version",)
US_VERSION = ("us version",)
PARENTAL_ADVISORY = ("PA version",)
Limited_EDITION = ("limited",)
MONO = ("mono",)
STEREO = ("stereo",)
HI_RES = ("Hi-Res",)
RE_MIX = ("re-mix",)
RE_RECORDED = ("re-recorded", "rerecorded")
REISSUE = ("reissue",)
REMASTERED = ("remaster",)
TAYLORS_VERSION = ("taylor's version",)

View File

@ -1,5 +1,6 @@
import re
from enum import Enum
from app.enums.album_versions import AlbumVersionEnum
def split_artists(src: str, custom_seps: set[str] = {}):
@ -113,62 +114,6 @@ def get_base_album_title(string) -> tuple[str, str | None]:
return string, None
class AlbumVersionEnum(Enum):
"""
Enum for album versions.
"""
Explicit = ("explicit",)
ANNIVERSARY_EDITION = ("anniversary",)
DIAMOND_EDITION = ("diamond",)
Centennial_EDITION = ("centennial",)
GOLDEN_EDITION = ("gold",)
PLATINUM_EDITION = ("platinum",)
SILVER_EDITION = ("silver",)
ULTIMATE_EDITION = ("ultimate",)
EXPANDED = ("expanded",)
EXTENDED = ("extended",)
DELUXE = ("deluxe",)
SUPER_DELUXE = ("super deluxe",)
COMPLETE = ("complete",)
LEGACY_EDITION = ("legacy",)
SPECIAL_EDITION = ("special",)
COLLECTORS_EDITION = ("collector",)
ARCHIVE_EDITION = ("archive",)
Acoustic = ("acoustic",)
DOUBLE_DISC = ("double disc", "double disk")
SUMMER_EDITION = ("summer",)
WINTER_EDITION = ("winter",)
SPRING_EDITION = ("spring",)
FALL_EDITION = ("fall",)
BONUS_EDITION = ("bonus",)
BONUS_TRACK = ("bonus track",)
ORIGINAL = ("original",)
INTL_VERSION = ("international",)
UK_VERSION = ("uk version",)
US_VERSION = ("us version",)
Limited_EDITION = ("limited",)
MONO = ("mono",)
STEREO = ("stereo",)
HI_RES = ("Hi-Res",)
RE_MIX = ("re-mix",)
RE_RECORDED = ("re-recorded", "rerecorded")
REISSUE = ("reissue",)
REMASTERED = ("remaster",)
TAYLORS_VERSION = ("taylor's version",)
def get_anniversary(text: str) -> str | None:
"""
Extracts anniversary from text using regex.