Make regex better, shut eyed3 up

This commit is contained in:
Salt 2020-03-20 22:50:03 -05:00
parent 37c2081627
commit 1e5e8088f3

View File

@ -268,8 +268,10 @@ class BadWitch:
# Parse flags
if self.args.debug:
logging.basicConfig(level=logging.DEBUG)
eyed3.log.level = logging.WARNING
elif self.args.verbose:
logging.basicConfig(level=logging.INFO)
eyed3.log.level = logging.WARNING
# Initialize library
libfile = self.args.library or self.dirs.user_data_dir + '/lib.json'
lib = Library(file=libfile)
@ -353,8 +355,8 @@ class BadWitch:
album = cregex.sub('', album)
# Remove junk from track titles
for regex in [
r'^' + re.escape(artist) + r'[ ]*[-:;~]*[ ]*', # Remove artist from beginning of songs
re.escape('(Audio)') + r'$' # Remove (Audio) from VEVO tracks AUGH
r'^' + re.escape(artist) + r' *[-:;~]* *', # Remove artist from beginning of songs
r' *\(.*(Official|Video|Audio|Audio|Lyric|VEVO).*\)' # Remove (Offical Audio), (Lyric Video), etc.
]:
cregex = re.compile(regex, re.IGNORECASE)
for song, songcontent in playlist.items():
@ -449,5 +451,6 @@ class BadWitch:
print('Closing library')
return
eyed3.log.level = logging.CRITICAL
badwitch = BadWitch()
badwitch.execute()