"""
DO NOT MODIFY THIS FILE DIRECTLY!
It is automatically generated by regen.sh
"""


from dataclasses import dataclass
import re


@dataclass(frozen=True)
class FilterRule(object):
    source: re.Pattern
    target: str = ""
    count: int = 0


CLEAN_EXPLICIT_FILTER_RULES = (
    # (Explicit) or [Explicit]
    FilterRule(
        source=re.compile(r"""\s[([]Explicit[)\]]""", flags=re.IGNORECASE),
        count=1,
    ),
    # (Clean) or [Clean]
    FilterRule(
        source=re.compile(r"""\s[([]Clean[)\]]""", flags=re.IGNORECASE),
        count=1,
    ),
)

FEATURE_FILTER_RULES = (
    # [Feat. Artist] or (Feat. Artist)
    FilterRule(
        source=re.compile(r"""\s[([]feat. .+[)\]]""", flags=re.IGNORECASE),
        count=1,
    ),
)

LIVE_FILTER_RULES = (
    # Track - Live
    # Track - Live at
    FilterRule(
        source=re.compile(r"""\s-\sLive(\s.+)?$"""),
        count=1,
    ),
    # Track (Live)
    FilterRule(
        source=re.compile(r"""\s[([]Live[)\]]$"""),
        count=1,
    ),
)

NORMALIZE_FEATURE_FILTER_RULES = (
    # [Feat. Artist] or (Feat. Artist) -> Feat. Artist
    FilterRule(
        source=re.compile(r"""\s[([](feat. .+)[)\]]""", flags=re.IGNORECASE),
        target=r""" \1""",
        count=1,
    ),
)

PARODY_FILTER_RULES = (
    # Party In the CIA (Parody of "Party In The U.S.A." by Miley Cyrus)
    FilterRule(
        source=re.compile(r"""\s\(Parody of ".*" by .*\)$"""),
        count=1,
    ),
    # White & Nerdy (Parody of "Ridin'" by Chamillionaire feat. Krayzie Bone)
    FilterRule(
        source=re.compile(r"""\s\(Parody of ".*" by .* feat\. .*\)$"""),
        count=1,
    ),
    # The Saga Begins (Lyrical Adaption of "American Pie")
    FilterRule(
        source=re.compile(r"""\s\(Lyrical Adaption of ".*"\)$"""),
        count=1,
    ),
)

REISSUE_FILTER_RULES = (
    # Album Title Re-issue
    FilterRule(
        source=re.compile(r"""\sRe-?issue$""", flags=re.IGNORECASE),
        count=1,
    ),
    # Album Title [Whatever Re-issue Whatever]
    FilterRule(
        source=re.compile(r"""\s\[.*?Re-?issue.*?\]""", flags=re.IGNORECASE),
        count=1,
    ),
    # Album Title (Whatever Re-issue Whatever)
    FilterRule(
        source=re.compile(r"""\s\(.*?Re-?issue.*?\)""", flags=re.IGNORECASE),
        count=1,
    ),
)

REMASTERED_FILTER_RULES = (
    # Ticket To Ride - Live / Remastered
    FilterRule(
        source=re.compile(r"""Live\s\/\sRemastered"""),
        target=r"""Live""",
        count=1,
    ),
    # Mothership (Remastered)
    # Let It Be (Remastered 2009)
    # How The West Was Won [Remastered]
    # Ride the Lightning (Deluxe Remaster)
    # ...And Justice For All (Remastered Deluxe Box Set)
    FilterRule(
        source=re.compile(r"""\s[([].*Re-?[Mm]aster(ed)?.*[)\]]$"""),
        count=1,
    ),
    # Outside The Wall - 2011 - Remaster
    # China Grove - 2006 Remaster
    # Easy Living - 2003 Remastered
    # Learning To Fly - 2001 Digital Remaster
    # Red Right Hand - 2011 Remastered Version
    FilterRule(
        source=re.compile(r"""\s-\s\d{4}(\s-)?\s.*Re-?[Mm]aster(ed)?.*$"""),
        count=1,
    ),
    # Here Comes The Sun - Remastered
    # 1979 - Remastered 2012
    # 1979 - Remastered Version
    FilterRule(
        source=re.compile(r"""\s-\sRe-?[Mm]aster(ed)?.*$"""),
        count=1,
    ),
    # Wish You Were Here [Remastered] (Remastered Version)
    FilterRule(
        source=re.compile(r"""\s\[Remastered\]\s\(Remastered\sVersion\)$"""),
        count=1,
    ),
)

SUFFIX_FILTER_RULES = (
    # "- X Remix" -> "(X Remix)" and similar
    FilterRule(
        source=re.compile(r"""-\s(.+?)\s((Re)?mix|edit|dub|mix|vip|version)$""", flags=re.IGNORECASE),
        target=r"""(\1 \2)""",
        count=1,
    ),
    FilterRule(
        source=re.compile(r"""-\s(Remix|VIP|Instrumental)$""", flags=re.IGNORECASE),
        target=r"""(\1)""",
        count=1,
    ),
)

TRIM_SYMBOLS_FILTER_RULES = (
    # Leftovers after e.g. (official video)
    FilterRule(
        source=re.compile(r"""\(+\s*\)+"""),
        count=1,
    ),
    # trim starting white chars and dash
    FilterRule(
        source=re.compile(r"""^[/,:;~\s"-]+"""),
        count=1,
    ),
    # trim trailing white chars and dash
    FilterRule(
        source=re.compile(r"""[/,:;~\s"-]+$"""),
        count=1,
    ),
    # remove multiple spaces
    FilterRule(
        source=re.compile(r"""\s{1,}"""),
        target=r""" """,
        count=1,
    ),
)

VERSION_FILTER_RULES = (
    # Love Will Come To You (Album Version)
    FilterRule(
        source=re.compile(r"""\s[([]Album Version[)\]]$"""),
        count=1,
    ),
    # I Melt With You (Rerecorded)
    # When I Need You [Re-Recorded]
    FilterRule(
        source=re.compile(r"""\s[([]Re-?recorded[)\]]$"""),
        count=1,
    ),
    # Your Cheatin' Heart (Single Version)
    FilterRule(
        source=re.compile(r"""\s[([]Single Version[)\]]$"""),
        count=1,
    ),
    # All Over Now (Edit)
    FilterRule(
        source=re.compile(r"""\s[([]Edit[)\]]$"""),
        count=1,
    ),
    # (I Can't Get No) Satisfaction - Mono Version
    FilterRule(
        source=re.compile(r"""\s-\sMono Version$"""),
        count=1,
    ),
    # Ruby Tuesday - Stereo Version
    FilterRule(
        source=re.compile(r"""\s-\sStereo Version$"""),
        count=1,
    ),
    # Pure McCartney (Deluxe Edition)
    FilterRule(
        source=re.compile(r"""\s\(Deluxe Edition\)$"""),
        count=1,
    ),
    # Ace of Spades (Expanded Edition)
    # Overkill (Expanded Bonus Track Edition)
    # On Parole (Expanded and Remastered)
    FilterRule(
        source=re.compile(r"""\s[([]Expanded.*[)\]]$"""),
        count=1,
    ),
    # Sound of White Noise - Expanded Edition
    FilterRule(
        source=re.compile(r"""\s-\sExpanded Edition$"""),
        count=1,
    ),
    # 6 Foot 7 Foot (Explicit Version)
    FilterRule(
        source=re.compile(r"""\s[([]Explicit Version[)\]]""", flags=re.IGNORECASE),
        count=1,
    ),
    # No Remorse (Bonus Track Edition)
    FilterRule(
        source=re.compile(r"""\s[([]Bonus Track Edition[)\]]""", flags=re.IGNORECASE),
        count=1,
    ),
    # Peace Sells...But Who's Buying (25th Anniversary)
    # Persistence of Time (30th Anniversary Remaster)
    FilterRule(
        source=re.compile(r"""\s[([]\d+th\sAnniversary.*[)\]]""", flags=re.IGNORECASE),
        count=1,
    ),
    # 6 Foot 7 Foot - Original
    FilterRule(
        source=re.compile(r"""\s-\sOriginal$""", flags=re.IGNORECASE),
        count=1,
    ),
    # California Love - Original Version
    # Personal Jesus - Original Single Version
    # Prince of the Moment - Original 7" Version
    # YMCA - Original Version 1978
    FilterRule(
        source=re.compile(r"""\s-\sOriginal.*Version(\s\d{4})?$""", flags=re.IGNORECASE),
        count=1,
    ),
)

YOUTUBE_TRACK_FILTER_RULES = (
    # Trim whitespaces
    FilterRule(
        source=re.compile(r"""^\s+|\s+$"""),
    ),
    # **NEW**
    FilterRule(
        source=re.compile(r"""\*+\s?\S+\s?\*+$"""),
        count=1,
    ),
    # [Whatever]
    FilterRule(
        source=re.compile(r"""\[[^\]]+\]"""),
        count=1,
    ),
    # (Whatever Version)
    FilterRule(
        source=re.compile(r"""\([^)]*version\)$""", flags=re.IGNORECASE),
        count=1,
    ),
    # Video extensions
    FilterRule(
        source=re.compile(r"""\.(avi|wmv|mpg|mpeg|flv)$""", flags=re.IGNORECASE),
        count=1,
    ),
    # (Lyrics Video)
    FilterRule(
        source=re.compile(r"""\(.*lyrics?\s*(video)?\)""", flags=re.IGNORECASE),
        count=1,
    ),
    # ((Official)? (Track)? Stream)
    FilterRule(
        source=re.compile(r"""\((of+icial\s*)?(track\s*)?stream\)""", flags=re.IGNORECASE),
        count=1,
    ),
    # ((Official)? (Music)? Video|Audio)
    FilterRule(
        source=re.compile(r"""\((of+icial\s*)?(music\s*)?(video|audio)\)""", flags=re.IGNORECASE),
        count=1,
    ),
    # - (Official)? (Music)? Video|Audio
    FilterRule(
        source=re.compile(r"""-\s(of+icial\s*)?(music\s*)?(video|audio)$""", flags=re.IGNORECASE),
        count=1,
    ),
    # ((Whatever)? Album Track)
    FilterRule(
        source=re.compile(r"""\(.*Album\sTrack\)""", flags=re.IGNORECASE),
        count=1,
    ),
    # (Official)
    FilterRule(
        source=re.compile(r"""\(\s*of+icial\s*\)""", flags=re.IGNORECASE),
        count=1,
    ),
    # (1999)
    FilterRule(
        source=re.compile(r"""\(\s*[0-9]{4}\s*\)""", flags=re.IGNORECASE),
        count=1,
    ),
    # (HD) / (HQ)
    FilterRule(
        source=re.compile(r"""\(\s*(HD|HQ)\s*\)$"""),
        count=1,
    ),
    # HD / HQ
    FilterRule(
        source=re.compile(r"""(HD|HQ)\s?$"""),
        count=1,
    ),
    # Video Clip Officiel / Video Clip Official
    FilterRule(
        source=re.compile(r"""(vid[\u00E9e]o)?\s?clip\sof+ici[ae]l""", flags=re.IGNORECASE),
        count=1,
    ),
    # Offizielles
    FilterRule(
        source=re.compile(r"""of+iziel+es\s*video""", flags=re.IGNORECASE),
        count=1,
    ),
    # Video Clip
    FilterRule(
        source=re.compile(r"""vid[\u00E9e]o\s?clip""", flags=re.IGNORECASE),
        count=1,
    ),
    # Clip
    FilterRule(
        source=re.compile(r"""\sclip""", flags=re.IGNORECASE),
        count=1,
    ),
    # Full Album
    FilterRule(
        source=re.compile(r"""full\s*album""", flags=re.IGNORECASE),
        count=1,
    ),
    # (Live)
    FilterRule(
        source=re.compile(r"""\(live.*?\)$""", flags=re.IGNORECASE),
        count=1,
    ),
    # | Something
    FilterRule(
        source=re.compile(r"""\|.*$""", flags=re.IGNORECASE),
        count=1,
    ),
    # Artist - The new "Track title" featuring someone
    FilterRule(
        source=re.compile(r"""^(|.*\s)"(.{5,})"(\s.*|)$"""),
        target=r"""\2""",
        count=1,
    ),
    # 'Track title'
    FilterRule(
        source=re.compile(r"""^(|.*\s)'(.{5,})'(\s.*|)$"""),
        target=r"""\2""",
        count=1,
    ),
    # (*01/01/1999*)
    FilterRule(
        source=re.compile(r"""\(.*[0-9]{1,2}\/[0-9]{1,2}\/[0-9]{2,4}.*\)""", flags=re.IGNORECASE),
        count=1,
    ),
    # Sub Español
    FilterRule(
        source=re.compile(r"""sub\s*español""", flags=re.IGNORECASE),
        count=1,
    ),
    # (Letra)
    FilterRule(
        source=re.compile(r"""\s\(Letra\)""", flags=re.IGNORECASE),
        count=1,
    ),
    # (En vivo)
    FilterRule(
        source=re.compile(r"""\s\(En\svivo\)""", flags=re.IGNORECASE),
        count=1,
    ),
    # Sub Español
    FilterRule(
        source=re.compile(r"""sub\s*español""", flags=re.IGNORECASE),
        count=1,
    ),
)


__all__ = (
    "FilterRule",
    "CLEAN_EXPLICIT_FILTER_RULES",
    "FEATURE_FILTER_RULES",
    "LIVE_FILTER_RULES",
    "NORMALIZE_FEATURE_FILTER_RULES",
    "PARODY_FILTER_RULES",
    "REISSUE_FILTER_RULES",
    "REMASTERED_FILTER_RULES",
    "SUFFIX_FILTER_RULES",
    "TRIM_SYMBOLS_FILTER_RULES",
    "VERSION_FILTER_RULES",
    "YOUTUBE_TRACK_FILTER_RULES",
)
