Browse Source

Files located in the same directory as the song have priority over other files

pull/122/head
Louis 9 years ago
parent
commit
93b0fdde24
  1. 10
      patacrep/songs/__init__.py

10
patacrep/songs/__init__.py

@ -228,16 +228,16 @@ class Song:
if directories is None:
directories = self.config['datadir']
for directory in directories:
for extension in extensions:
if os.path.isfile(os.path.join(directory, filename + extension)):
return directory, filename, extension
songdir = os.path.dirname(self.fullpath)
for extension in extensions:
if os.path.isfile(os.path.join(songdir, filename + extension)):
return "", os.path.join(songdir, filename), extension
for directory in directories:
for extension in extensions:
if os.path.isfile(os.path.join(directory, filename + extension)):
return directory, filename, extension
raise FileNotFoundError(filename)
def search_file(self, filename, extensions=None, *, datadirs=None):

Loading…
Cancel
Save