diff --git a/songbook_core/build.py b/songbook_core/build.py index 86c7433d..5e26a720 100755 --- a/songbook_core/build.py +++ b/songbook_core/build.py @@ -75,6 +75,7 @@ class Songbook(object): abs_datadir.append(__DATADIR__) self.config['datadir'] = abs_datadir + self.config['songdir'] = [os.path.join(path, 'songs') for path in self.config['datadir']] def build_config(self, from_templates): config = DEFAULT_CONFIG diff --git a/songbook_core/content/song.py b/songbook_core/content/song.py index 1aeaf15e..38948e28 100644 --- a/songbook_core/content/song.py +++ b/songbook_core/content/song.py @@ -37,21 +37,17 @@ def parse(keyword, argument, contentlist, config): if 'languages' not in config: config['languages'] = set() songlist = [] - if not contentlist: + for songdir in config['songdir']: + if contentlist: + break contentlist = [ - os.path.relpath( - filename, - os.path.join(config['datadir'][0], 'songs'), - ) + os.path.relpath(filename, songdir) for filename - in recursive_find( - os.path.join(config['datadir'][0], 'songs'), - "*.sg" - ) + in recursive_find(songdir, "*.sg") ] for elem in contentlist: before = len(songlist) - for songdir in [os.path.join(d, 'songs') for d in config['datadir']]: + for songdir in config['songdir']: for filename in glob.iglob(os.path.join(songdir, elem)): LOGGER.debug('Parsing file "{}"…'.format(filename)) song = SongRenderer(filename, config)