test removing
This commit is contained in:
parent
3a363ee4be
commit
0611fb73e8
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user