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

This commit is contained in:
Michel Roux 2023-10-02 09:39:57 +02:00
parent 3a363ee4be
commit 0611fb73e8
1 changed files with 44 additions and 5 deletions

View File

@ -60,18 +60,57 @@ updates = drive_list("nsz/updates")
print("Updates OK")
for base in bases:
re_id = re.search(r"\[([0-9A-F]*)\]", base)
def get_title_shortid(name):
re_id = re.search(r"\[([0-9A-F]*)\]", name)
if not re_id:
continue
id = re_id.group(1)
if id not in titles:
continue
return id[0:-4] if id in titles else None
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)