Browse Source

songdir minor refactoring

pull/203/head
Oliverpool 9 years ago
parent
commit
534c9472fc
  1. 12
      patacrep/content/cwd.py
  2. 3
      patacrep/songbook/__init__.py

12
patacrep/content/cwd.py

@ -26,18 +26,16 @@ def parse(keyword, config, argument):
for, and then processes the content.
The 'path' is added:
- first as a relative path to the *.yaml file directory;
- then as a relative path to every path already present in
config['songdir'].
- first as a relative path to the *.yaml file directory;
- then as a relative path to every path already present in
config['songdir'] (which are actuel song dir inside the datadir).
"""
subpath = argument['path']
old_songdir = config['_songdir']
songdirs = []
config['_songdir'] = [path.clone().join(subpath) for path in config['_songdir']]
if '_songbookfile_dir' in config:
songdirs.extend([DataSubpath(config['_songbookfile_dir'], subpath)])
songdirs.extend(path.clone().join(subpath) for path in config['_songdir'])
config['_songdir'] = songdirs
config['_songdir'].insert(0, DataSubpath(config['_songbookfile_dir'], subpath))
processed_content = process_content(argument.get('content'), config)
config['_songdir'] = old_songdir

3
patacrep/songbook/__init__.py

@ -56,9 +56,10 @@ def prepare_songbook(songbook, outputdir, outputname, songbookfile_dir=None, dat
:return: Songbook, as a dictionary.
"""
songbook['_songbookfile_dir'] = songbookfile_dir
songbook['_outputdir'] = outputdir
songbook['_outputname'] = outputname
if songbookfile_dir:
songbook['_songbookfile_dir'] = songbookfile_dir
songbook = _add_songbook_defaults(songbook)

Loading…
Cancel
Save