diff --git a/commands/tinfoil.py b/commands/tinfoil.py index df4568b..9f6224b 100755 --- a/commands/tinfoil.py +++ b/commands/tinfoil.py @@ -73,13 +73,14 @@ updates = drive_list("nsz/updates") print("Updates OK") -def get_title_shortid(name): +def get_title_fullid(name): re_id = re.search(r"\[([0-9A-F]*)\]", name) - if not re_id: - return + return re_id.group(1) if re_id else None - id = re_id.group(1) + +def get_title_shortid(name): + id = get_title_fullid(name) return id[0:-4] if id in titles else None @@ -100,25 +101,28 @@ except subprocess.CalledProcessError: for base in bases: - id = get_title_shortid(base) + shortid = get_title_shortid(base) - if id: + if shortid: download("nsz/base", base) for dlc in dlcs: - if id in dlc: + if shortid in dlc: download("nsz/dlc", dlc) for update in updates: - if id in update: + if shortid in update: download("nsz/updates", update) else: remove("nsz/base", base) + fullid = get_title_fullid(base) + shortid = fullid[0:-4] + for dlc in dlcs: - if id in dlc: + if fullid in dlc: remove("nsz/dlc", dlc) for update in updates: - if id in update: + if fullid in update: remove("nsz/updates", update)