fix ./space in rename episodes

This commit is contained in:
Lucas Vivohost committed 2026-09-14 12:43:38 +02:00
1 parent c310e57035
commit 0dca4be1f3
1 file changed
+13 -6
+13 -6
View File
@@ -10,7 +10,7 @@ from serverlibary import safe_rename,safe_delete
VIDEO_EXTENSIONS = {".mpg", ".avi", ".mkv", ".mp4", ".m4v", ".srt"}
UNWANTED_PATTERNS_POST = [
r"MULTi", r"TV\ Series", r"[a-z]264", r"10bit", r"\[.*?\]",
r"\d{2,3}k", r"MULTi", r"TV\ Series", r"[a-z]264", r"10bit", r"\[.*?\]",
r"320kbps", r"AC3", r"NF\.WEB", r"bdrip", r"RERIP",
r"DUAL-", r"LostFilm", r"readnfo", r"BluRay",
r"720p", r"1080p", r"WEB", r"AMZN", r"HDTV",
@@ -67,7 +67,7 @@ def clean_name(name: Path, search=None, replace=None):
base = re.sub(r'[^A-Za-z0-9)]+$', '', base)
base = re.sub(r"\.+", ".", base)
base = re.sub(r" +", " ", base)
base = re.sub(r" ", ".", base)
#base = re.sub(r" ", ".", base)
base = base.strip(".")
@@ -168,11 +168,18 @@ def main():
print("Invalid path")
return
home = Path.home().resolve()
# block exactly home OR anything inside it (safer)
home = Path.home()
if base == home or home in base.parents:
print(f"Refusing to run on home directory: {base}")
sys.exit(1)
answer = input(
f"You are about to run on your home directory:\n"
f" {base}\n\n"
"This may process many files. Continue? [y/N]: "
).strip().lower()
if answer not in ("y", "yes"):
print("Aborted.")
sys.exit(1)
#video_files = []
#for file in iter_media_files(base):