Browse Source

Add a method to list valid datadirectories of a song

pull/98/head
Oliverpool 9 years ago
parent
commit
6353a9da38
  1. 11
      patacrep/songs/__init__.py

11
patacrep/songs/__init__.py

@ -216,6 +216,17 @@ class Song:
# raise FileNotFoundError()
return default
def get_datadirs(self, subdir=None):
"""Return a list of existing datadirs (with eventually a subdir)
"""
directories = []
for directory in self.config['datadir']:
fullpath = os.path.join(directory, subdir)
if os.path.isdir(fullpath):
directories.append(fullpath)
return directories
def search_file(self, filename, extensions=None, directories=None):
"""Search for a file name.

Loading…
Cancel
Save