test removing
Some checks failed
dl / lint (push) Failing after 1m25s
dl / docker (push) Has been skipped

This commit is contained in:
Michel Roux 2023-10-02 09:39:57 +02:00
parent 3a363ee4be
commit 0611fb73e8

View File

@ -60,18 +60,57 @@ updates = drive_list("nsz/updates")
print("Updates OK") print("Updates OK")
for base in bases: def get_title_shortid(name):
re_id = re.search(r"\[([0-9A-F]*)\]", base) re_id = re.search(r"\[([0-9A-F]*)\]", name)
if not re_id: if not re_id:
continue continue
id = re_id.group(1) id = re_id.group(1)
if id not in titles: return id[0:-4] if id in titles else None
continue
id = id[0:-4]
def remove(path):
to_remove = []
for name in os.listdir(path):
if os.path.isfile(name):
print(name)
id = get_title_shortid(name)
if not id:
to_remove.append(name)
if len(to_remove) > 100:
print("Too much to delete, this is the list:")
for be_removed in to_remove:
print(be_removed)
else:
for be_removed in to_remove:
print(f"Removing {be_removed}")
# os.remove(be_removed)
remove("nsz/base")
remove("nsz/dlc")
remove("nsz/updates")
try:
subprocess.run(
["rclone", "sync", "-P", "-v", f"{remote}:nsz/homebrew", f"nsz/homebrew/"],
check=True,
stdout=sys.stdout,
)
except subprocess.CalledProcessError:
pass
for base in bases:
id = get_title_shortid(base)
if not id:
continue
download("nsz/base", base) download("nsz/base", base)