Skip to content

Commit

Permalink
escape special glob characters
Browse files Browse the repository at this point in the history
  • Loading branch information
elbeardmorez committed Sep 3, 2017
1 parent 98f43ea commit 4db718a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion quodlibet/quodlibet/qltk/renamefiles.py
Expand Up @@ -352,8 +352,15 @@ def __moveart(self, art_sets, pathfile_old, pathfile_new, song):
else:
art_sets[path_old] = images
# generate art set for path
def glob_escape(s):
for c in ['[', '*', '?']:
s = s.replace(c, '[' + c + ']')
return s

path_old_escaped = glob_escape(path_old)
for suffix in self.IMAGE_EXTENSIONS:
images.extend(glob.glob(os.path.join(path_old, "*." + suffix)))
images.extend(glob.glob(os.path.join(path_old_escaped,
"*." + suffix)))
if len(images) > 0:
# set not empty yet, (re)process
filenames = config.getstringlist("albumart", "filenames")
Expand Down

0 comments on commit 4db718a

Please sign in to comment.