|
@ -14,6 +14,15 @@ class ChordproSong(Song): |
|
|
|
|
|
|
|
|
def __init__(self, *args, **kwargs): |
|
|
def __init__(self, *args, **kwargs): |
|
|
super().__init__(*args, **kwargs) |
|
|
super().__init__(*args, **kwargs) |
|
|
|
|
|
self.template_paths = [os.path.abspath(pkg_resources.resource_filename(__name__, 'data'))] |
|
|
|
|
|
|
|
|
|
|
|
def add_template_path(self, absolute_path): |
|
|
|
|
|
"""Add a template path (at the beginning, so that it's choosen first).""" |
|
|
|
|
|
self.template_paths.insert(0, absolute_path) |
|
|
|
|
|
|
|
|
|
|
|
def get_template_paths(self, output_format): |
|
|
|
|
|
"""Get the template path for a given output_format.""" |
|
|
|
|
|
return [os.path.join(path, output_format) for path in self.template_paths] |
|
|
|
|
|
|
|
|
def parse(self, config): |
|
|
def parse(self, config): |
|
|
"""Parse content, and return the dictionary of song data.""" |
|
|
"""Parse content, and return the dictionary of song data.""" |
|
@ -40,10 +49,9 @@ class ChordproSong(Song): |
|
|
"config": self.config, |
|
|
"config": self.config, |
|
|
"content": content, |
|
|
"content": content, |
|
|
} |
|
|
} |
|
|
jinjaenv = Environment(loader=FileSystemLoader(os.path.join( |
|
|
jinjaenv = Environment(loader=FileSystemLoader( |
|
|
os.path.abspath(pkg_resources.resource_filename(__name__, 'data')), |
|
|
self.get_template_paths(output_format) |
|
|
output_format, |
|
|
)) |
|
|
))) |
|
|
|
|
|
jinjaenv.filters['search_image'] = self.search_image |
|
|
jinjaenv.filters['search_image'] = self.search_image |
|
|
jinjaenv.filters['search_partition'] = self.search_partition |
|
|
jinjaenv.filters['search_partition'] = self.search_partition |
|
|
|
|
|
|
|
|