fix remove (again)

This commit is contained in:
Michel Roux 2023-10-03 18:52:59 +02:00
parent 3b971bfda6
commit af864972ed

View File

@ -67,13 +67,14 @@ updates = drive_list("nsz/updates")
print("Updates OK") print("Updates OK")
def get_title_shortid(name): def get_title_fullid(name):
re_id = re.search(r"\[([0-9A-F]*)\]", name) re_id = re.search(r"\[([0-9A-F]*)\]", name)
if not re_id: return re_id.group(1) if re_id else None
return
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 return id[0:-4] if id in titles else None
@ -89,21 +90,27 @@ except subprocess.CalledProcessError:
for base in bases: for base in bases:
id = get_title_shortid(base) shortid = get_title_shortid(base)
if id: if shortid:
download("nsz/base", base) download("nsz/base", base)
for dlc in dlcs:
if shortid in dlc:
download("nsz/dlc", dlc)
for update in updates:
if shortid in update:
download("nsz/updates", update)
else: else:
remove("nsz/base", base) remove("nsz/base", base)
for dlc in dlcs: fullid = get_title_fullid(base)
if id in dlc:
download("nsz/dlc", dlc)
else:
remove("nsz/dlc", dlc)
for update in updates: for dlc in dlcs:
if id in update: if fullid in dlc:
download("nsz/updates", update) remove("nsz/dlc", dlc)
else:
remove("nsz/updates", update) for update in updates:
if fullid in update:
remove("nsz/updates", update)