bis 10 kontrolliert
This commit is contained in:
50
mp3/compare_name.py
Normal file
50
mp3/compare_name.py
Normal file
@@ -0,0 +1,50 @@
|
||||
import os
|
||||
import sys
|
||||
from unicodedata import normalize
|
||||
|
||||
REPLACEMENTS = [
|
||||
("_", " "),
|
||||
("?", ""),
|
||||
("!", ""),
|
||||
(".", ""),
|
||||
("-", " "),
|
||||
(",", ""),
|
||||
]
|
||||
|
||||
name_new = ""
|
||||
i = 1
|
||||
|
||||
def compare(s1: str, s2: str) -> bool:
|
||||
return normalize("NFKC", s1).casefold() == normalize("NFKC", s2).casefold()
|
||||
|
||||
|
||||
|
||||
|
||||
file = open(sys.argv[1])
|
||||
for line in file:
|
||||
line = line[:-1]
|
||||
for old, new in REPLACEMENTS:
|
||||
line = line.replace(old, new)
|
||||
name_new = line
|
||||
#if "sed" in name_new:
|
||||
# print("new: ", name_new)
|
||||
for name in os.listdir(sys.argv[2]):
|
||||
name = ((name.split(".")[0]).lower())
|
||||
name = name.replace("_", " ")
|
||||
# if "sed" in name:
|
||||
# print ("pin 1 ",name)
|
||||
name = name.replace("-", " ")
|
||||
#if "sed" in name:
|
||||
# print ("pin 2 ",name)
|
||||
if compare(name, name_new):
|
||||
print(i, ": ", line)
|
||||
|
||||
i = i + 1
|
||||
|
||||
|
||||
|
||||
#print ("File name: ", name.split(".")[0], "---> Aus Datei: ", line)
|
||||
#
|
||||
#
|
||||
#else:
|
||||
# print(line[:-1], " ist nicht vorhanden")
|
||||
Reference in New Issue
Block a user