From 534c9472fcbcbdb4dc4caf07b13bb78d43a5406d Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Thu, 11 Feb 2016 23:35:42 +0100 Subject: [PATCH] songdir minor refactoring --- patacrep/content/cwd.py | 12 +++++------- patacrep/songbook/__init__.py | 3 ++- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/patacrep/content/cwd.py b/patacrep/content/cwd.py index b9a85428..6d4dfa36 100755 --- a/patacrep/content/cwd.py +++ b/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 diff --git a/patacrep/songbook/__init__.py b/patacrep/songbook/__init__.py index cee8c096..0a7d394e 100644 --- a/patacrep/songbook/__init__.py +++ b/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)