|
@ -4,30 +4,32 @@ from patacrep.content import process_content |
|
|
from patacrep.songs import DataSubpath |
|
|
from patacrep.songs import DataSubpath |
|
|
|
|
|
|
|
|
#pylint: disable=unused-argument |
|
|
#pylint: disable=unused-argument |
|
|
def parse(keyword, config, argument, contentlist): |
|
|
def parse(keyword, config, argument): |
|
|
"""Return a list songs included in contentlist, whith a different base path. |
|
|
"""Return a list songs, whith a different base path. |
|
|
|
|
|
|
|
|
Arguments: |
|
|
Arguments: |
|
|
- keyword: unused; |
|
|
- keyword: unused; |
|
|
- config: the current songbook configuration dictionary; |
|
|
- config: the current songbook configuration dictionary; |
|
|
- argument: a directory; |
|
|
- argument: a dict containing: |
|
|
- contentlist: songbook content, that is parsed by |
|
|
path: string specifying the path to use as root; |
|
|
patacrep.content.process_content(). |
|
|
content: songbook content, that is parsed by |
|
|
|
|
|
patacrep.content.process_content(). |
|
|
|
|
|
|
|
|
This function adds 'argument' to the directories where songs are searched |
|
|
This function adds 'path' to the directories where songs are searched |
|
|
for, and then processes the content. |
|
|
for, and then processes the content. |
|
|
|
|
|
|
|
|
The 'argument' is added: |
|
|
The 'path' is added: |
|
|
- first as a relative path to the current directory; |
|
|
- first as a relative path to the current 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']. |
|
|
""" |
|
|
""" |
|
|
|
|
|
subpath = argument['path'] |
|
|
old_songdir = config['_songdir'] |
|
|
old_songdir = config['_songdir'] |
|
|
config['_songdir'] = ( |
|
|
config['_songdir'] = ( |
|
|
[DataSubpath(".", argument)] + |
|
|
[DataSubpath(".", subpath)] + |
|
|
[path.clone().join(argument) for path in config['_songdir']] |
|
|
[path.clone().join(subpath) for path in config['_songdir']] |
|
|
) |
|
|
) |
|
|
processed_content = process_content(contentlist, config) |
|
|
processed_content = process_content(argument['content'], config) |
|
|
config['_songdir'] = old_songdir |
|
|
config['_songdir'] = old_songdir |
|
|
return processed_content |
|
|
return processed_content |
|
|
|
|
|
|
|
|