Improved tag detection and support

This commit is contained in:
Georges-Antoine Assi
2023-07-28 19:45:58 -04:00
parent 6eda838f83
commit 6f8fc6afed
2 changed files with 5 additions and 3 deletions

View File

@@ -191,4 +191,4 @@ class TwitchAuth():
if not self._is_token_valid():
log.warning("Twitch token invalid: fetching a new one")
self._update_twitch_token()
return self.token
return self.token

View File

@@ -70,7 +70,8 @@ def parse_tags(file_name: str) -> tuple:
reg = REGIONS_BY_SHORTCODE[tag.lower()]
elif tag.lower() in REGIONS_NAME_KEYS:
reg = tag
elif "rev" in tag.lower():
# Explicit support for "Rev A/Rev 1" tags
elif "rev " in tag.lower():
rev = tag.split(" ")[1]
else:
other_tags.append(tag)
@@ -78,7 +79,8 @@ def parse_tags(file_name: str) -> tuple:
def get_file_name_with_no_tags(file_name: str) -> str:
return re.sub("[\(\[].*?[\)\]]", "", file_name.split(".")[0])
# Use .rsplit to remove only the file extension
return re.sub("[\(\[].*?[\)\]]", "", file_name.rsplit(".", 1)[0])
def get_file_extension(rom: dict) -> str: