Browse Source

Introduction d'un paramètre config['songdir'] ; Peuplement par défaut de content avec le premier des répertoires de songdir non vide.

pull/47/head
Louis 10 years ago
parent
commit
fa8674d6a0
  1. 1
      songbook_core/build.py
  2. 16
      songbook_core/content/song.py

1
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

16
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)

Loading…
Cancel
Save