Misc changes

This commit is contained in:
2026-01-26 21:14:27 +00:00
parent 36a1a73beb
commit 129cce49b1
8 changed files with 215 additions and 78 deletions

View File

@@ -226,23 +226,31 @@ def check_title_songname(x: str, audio):
x = x.rsplit(".",1)[0] # remove the file extension
logging.info("file has extension " + extension + ". removing it from title. New title: " + x)
items = x.split(" - ")
if (len(items) > 2):
logging.info("song title has more than 1 part after the -: " + str(items))
if (items[1].count(".mp3") >= 1):
logging.info("setting TIT2 tag to: " + str(items[1].strip().rstrip().rsplit(".")[0])) # get second part of title and remove the file extension
audio["TIT2"] = TIT2(encoding=3,text=str(items[1].strip().rstrip().rsplit(".")[0]))
elif (items[1].count(".flac") >= 1):
logging.info("setting title tag to " + str(items[1].strip().rstrip().rsplit(".")[0])) # get second part of title and remove the file extension
audio["title"] = str(items[1].strip().rstrip().rsplit(".")[0])
if (" - " in x):
items = x.split(" - ")
if (len(items) > 2):
logging.info("song title has more than 1 part after the -: " + str(items))
if (items[1].count(".mp3") >= 1):
logging.info("setting TIT2 tag to: " + str(items[1].strip().rstrip().rsplit(".")[0])) # get second part of title and remove the file extension
audio["TIT2"] = TIT2(encoding=3,text=str(items[1].strip().rstrip().rsplit(".")[0]))
elif (items[1].count(".flac") >= 1):
logging.info("setting title tag to " + str(items[1].strip().rstrip().rsplit(".")[0])) # get second part of title and remove the file extension
audio["title"] = str(items[1].strip().rstrip().rsplit(".")[0])
else:
logging.info("title: " + str(items[1].strip().rstrip())) # get second part of title and remove the file extension
audio["TIT2"] = TIT2(encoding=3,text=str(items[1].strip().rstrip()))
audio["title"] = TIT2(encoding=3,text=str(items[1].strip().rstrip()))
else:
logging.info("title: " + str(items[1].strip().rstrip())) # get second part of title and remove the file extension
audio["TIT2"] = TIT2(encoding=3,text=str(items[1].strip().rstrip()))
audio["title"] = TIT2(encoding=3,text=str(items[1].strip().rstrip()))
logging.info("song title has only 1 part after the -: " + items[1])
if ("TIT2" not in audio.keys()):
song_title = items[1].strip().rstrip()
logging.info("TIT2 tag not found, creating it. Using song title: " + song_title)
audio["TIT2"] = TIT2(encoding=3,text=song_title)
audio["title"] = TIT2(encoding=3,text=song_title)
else:
logging.info("song title has only 1 part after the -: " + items[0])
logging.info("no - found in title, setting full name as title: " + x)
if ("TIT2" not in audio.keys()):
song_title = items[0].strip().rstrip()
song_title = x.strip().rstrip()
logging.info("TIT2 tag not found, creating it. Using song title: " + song_title)
audio["TIT2"] = TIT2(encoding=3,text=song_title)
audio["title"] = TIT2(encoding=3,text=song_title)