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