Skip to content

Commit

Permalink
FIX repack handling in edition
Browse files Browse the repository at this point in the history
Also fix multiple editions, `--edition Director's Cut REPACK`
  • Loading branch information
Audionut committed Oct 25, 2024
1 parent caacf5a commit 0164d9c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/prep.py
Original file line number Diff line number Diff line change
Expand Up @@ -2429,9 +2429,12 @@ def get_edition(self, video, bdinfo, filelist, manual_edition):
edition = edition + " Open Matte"

if manual_edition:
if isinstance(manual_edition, list):
manual_edition = " ".join(manual_edition)
edition = str(manual_edition)
edition = edition.replace(",", " ")

print(f"Edition After Manual Edition: {edition}")
# print(f"Edition After Manual Edition: {edition}")

if "REPACK" in (video or edition.upper()) or "V2" in video:
repack = "REPACK"
Expand All @@ -2444,14 +2447,16 @@ def get_edition(self, video, bdinfo, filelist, manual_edition):
if "RERIP" in (video or edition.upper()):
repack = "RERIP"

print(f"Repack after Checks: {repack}")
# print(f"Repack after Checks: {repack}")

# Only remove REPACK, RERIP, or PROPER from edition if they're not part of manual_edition
edition = re.sub(r"(\bREPACK\d?\b|\bRERIP\b|\bPROPER\b)", "", edition, flags=re.IGNORECASE).strip()
if not manual_edition or all(tag.lower() not in ['repack', 'repack2', 'repack3', 'proper', 'rerip'] for tag in manual_edition.strip().lower().split()):
edition = re.sub(r"(\bREPACK\d?\b|\bRERIP\b|\bPROPER\b)", "", edition, flags=re.IGNORECASE).strip()
print(f"Final Edition: {edition}")
bad = ['internal', 'limited', 'retail']

if edition.lower() in bad:
edition = ""
edition = re.sub(r'\b(?:' + '|'.join(bad) + r')\b', '', edition, flags=re.IGNORECASE).strip()

return edition, repack

Expand Down

0 comments on commit 0164d9c

Please sign in to comment.