Skip to content

Commit

Permalink
If regex for local cover art is empty, skip and do nothing
Browse files Browse the repository at this point in the history
  • Loading branch information
zas committed Oct 13, 2021
1 parent 2896944 commit 30e72c6
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions picard/coverart/providers/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,18 @@ class CoverArtProviderLocal(CoverArtProvider):

def queue_images(self):
config = get_config()
_match_re = re.compile(config.setting['local_cover_regex'], re.IGNORECASE)
dirs_done = set()

for file in self.album.iterfiles():
current_dir = os.path.dirname(file.filename)
if current_dir in dirs_done:
continue
dirs_done.add(current_dir)
for image in self.find_local_images(current_dir, _match_re):
self.queue_put(image)
regex = config.setting['local_cover_regex']
if regex:
_match_re = re.compile(regex, re.IGNORECASE)
dirs_done = set()

for file in self.album.iterfiles():
current_dir = os.path.dirname(file.filename)
if current_dir in dirs_done:
continue
dirs_done.add(current_dir)
for image in self.find_local_images(current_dir, _match_re):
self.queue_put(image)
return CoverArtProvider.FINISHED

def get_types(self, string):
Expand Down

0 comments on commit 30e72c6

Please sign in to comment.