From 1e5e8088f365f82a58bc9865578c6f8a9aee71e6 Mon Sep 17 00:00:00 2001 From: Salt Date: Fri, 20 Mar 2020 22:50:03 -0500 Subject: [PATCH] Make regex better, shut eyed3 up --- badwitch.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/badwitch.py b/badwitch.py index 7b02ab1..2fc9a90 100755 --- a/badwitch.py +++ b/badwitch.py @@ -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()