Browse Source

songdir minor refactoring

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

8
patacrep/content/cwd.py

@ -28,16 +28,14 @@ def parse(keyword, config, argument):
The 'path' is added: The 'path' is added:
- first as a relative path to the *.yaml file directory; - first as a relative path to the *.yaml file directory;
- then as a relative path to every path already present in - then as a relative path to every path already present in
config['songdir']. config['songdir'] (which are actuel song dir inside the datadir).
""" """
subpath = argument['path'] subpath = argument['path']
old_songdir = config['_songdir'] old_songdir = config['_songdir']
songdirs = [] config['_songdir'] = [path.clone().join(subpath) for path in config['_songdir']]
if '_songbookfile_dir' in config: if '_songbookfile_dir' in config:
songdirs.extend([DataSubpath(config['_songbookfile_dir'], subpath)]) config['_songdir'].insert(0, DataSubpath(config['_songbookfile_dir'], subpath))
songdirs.extend(path.clone().join(subpath) for path in config['_songdir'])
config['_songdir'] = songdirs
processed_content = process_content(argument.get('content'), config) processed_content = process_content(argument.get('content'), config)
config['_songdir'] = old_songdir 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. :return: Songbook, as a dictionary.
""" """
songbook['_songbookfile_dir'] = songbookfile_dir
songbook['_outputdir'] = outputdir songbook['_outputdir'] = outputdir
songbook['_outputname'] = outputname songbook['_outputname'] = outputname
if songbookfile_dir:
songbook['_songbookfile_dir'] = songbookfile_dir
songbook = _add_songbook_defaults(songbook) songbook = _add_songbook_defaults(songbook)

Loading…
Cancel
Save