Misc changes
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user