|
@ -2,6 +2,7 @@ |
|
|
|
|
|
|
|
|
from jinja2 import Environment, FileSystemLoader, contextfunction, ChoiceLoader |
|
|
from jinja2 import Environment, FileSystemLoader, contextfunction, ChoiceLoader |
|
|
import jinja2 |
|
|
import jinja2 |
|
|
|
|
|
import logging |
|
|
import os |
|
|
import os |
|
|
from pkg_resources import resource_filename |
|
|
from pkg_resources import resource_filename |
|
|
|
|
|
|
|
@ -10,6 +11,8 @@ from patacrep.songs import Song |
|
|
from patacrep.songs.chordpro.syntax import parse_song |
|
|
from patacrep.songs.chordpro.syntax import parse_song |
|
|
from patacrep.templates import Renderer |
|
|
from patacrep.templates import Renderer |
|
|
|
|
|
|
|
|
|
|
|
LOGGER = logging.getLogger(__name__) |
|
|
|
|
|
|
|
|
class ChordproSong(Song): |
|
|
class ChordproSong(Song): |
|
|
"""Chordpro song parser""" |
|
|
"""Chordpro song parser""" |
|
|
# pylint: disable=abstract-method |
|
|
# pylint: disable=abstract-method |
|
@ -76,6 +79,7 @@ class Chordpro2HtmlSong(ChordproSong): |
|
|
datadir, filename, extensions = self.search_datadir_file(filename, extensions, datadirs) |
|
|
datadir, filename, extensions = self.search_datadir_file(filename, extensions, datadirs) |
|
|
return os.path.join(datadir, filename + extensions) |
|
|
return os.path.join(datadir, filename + extensions) |
|
|
except FileNotFoundError: |
|
|
except FileNotFoundError: |
|
|
|
|
|
LOGGER.warning("Song '%s' (datadir '%s'): File '%s' not found.", self.subpath, self.datadir, filename) |
|
|
return None |
|
|
return None |
|
|
|
|
|
|
|
|
class Chordpro2LatexSong(ChordproSong): |
|
|
class Chordpro2LatexSong(ChordproSong): |
|
@ -92,6 +96,7 @@ class Chordpro2LatexSong(ChordproSong): |
|
|
) |
|
|
) |
|
|
return filename |
|
|
return filename |
|
|
except FileNotFoundError: |
|
|
except FileNotFoundError: |
|
|
|
|
|
LOGGER.warning("Song '%s' (datadir '%s'): File '%s' not found.", self.subpath, self.datadir, filename) |
|
|
return None |
|
|
return None |
|
|
|
|
|
|
|
|
class Chordpro2ChordproSong(ChordproSong): |
|
|
class Chordpro2ChordproSong(ChordproSong): |
|
|