delete unnecessary files from repo
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,5 +1,7 @@
|
||||
/*
|
||||
*.DS_Store
|
||||
*.py
|
||||
|
||||
|
||||
!.gitignore
|
||||
!/Translated
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
import os
|
||||
import shutil
|
||||
import re
|
||||
|
||||
ch4F = "./ch4"
|
||||
files = os.listdir(ch4F)
|
||||
prefixes = {f[:-6] for f in files if f.endswith("_1.png")}
|
||||
|
||||
for prefix in prefixes:
|
||||
dest_dir = os.path.join(ch4F, prefix)
|
||||
os.makedirs(dest_dir, exist_ok=True)
|
||||
for fname in list(files):
|
||||
if fname.startswith(prefix + "_") or fname == f"{prefix}.png":
|
||||
shutil.move(os.path.join(ch4F, fname),
|
||||
os.path.join(dest_dir, fname))
|
||||
files = os.listdir(ch4F)
|
||||
|
||||
pattern0 = re.compile(r"^(.+)_0\.png$")
|
||||
for fname in files:
|
||||
m = pattern0.match(fname)
|
||||
if not m:
|
||||
continue
|
||||
prefix = m.group(1)
|
||||
variants = [f for f in files if f.startswith(prefix + "_") and f != fname]
|
||||
if not variants:
|
||||
src = os.path.join(ch4F, fname)
|
||||
dst = os.path.join(ch4F, f"{prefix}.png")
|
||||
os.rename(src, dst)
|
||||
files = os.listdir(ch4F)
|
||||
@@ -1,25 +0,0 @@
|
||||
import os
|
||||
import shutil
|
||||
|
||||
ch4F = "./ch4"
|
||||
files = os.listdir(ch4F)
|
||||
|
||||
os.mkdir(f"{ch4F}/TEMPwo0")
|
||||
|
||||
for sprite in files:
|
||||
if ".png" in sprite and sprite and f"{sprite[:-6]}_1.png" in files:
|
||||
if "TEMP" not in files:
|
||||
os.mkdir(f"{ch4F}/TEMP")
|
||||
for finds in files:
|
||||
if sprite[:-6] in finds and sprite in files:
|
||||
shutil.move(f"{ch4F}/{finds}", f"{ch4F}/TEMP/{finds}")
|
||||
os.rename(f"{ch4F}/TEMP", f"{ch4F}/{sprite[:-6]}")
|
||||
else:
|
||||
shutil.move(f"{ch4F}/{sprite}", f"{ch4F}/TEMPwo0/{sprite}")
|
||||
os.rename(f"{ch4F}/TEMPwo0/{sprite}", f"{ch4F}/TEMPwo0/{sprite[:-6]}.png")
|
||||
files = os.listdir(ch4F)
|
||||
|
||||
shutil.move(f"{ch4F}/TEMPwo0", f"{ch4F}")
|
||||
os.remove(f"{ch4F}/TEMPwo0")
|
||||
|
||||
print(files)
|
||||
Reference in New Issue
Block a user