Browse Source

Merge pull request #125 from patacrep/datadir

Sub-datadir (img and score) must be explicitely set
pull/122/head
oliverpool 9 years ago
parent
commit
783d29070a
  1. 0
      examples/datadir2/scores/datadir2.ly
  2. 0
      examples/scores/datadir.ly
  3. 6
      examples/songs/subdir/datadir.sg
  4. 6
      examples/songs/subdir/datadir2.sg
  5. 2
      patacrep/data/templates/patacrep.tex
  6. 2
      patacrep/data/templates/songs.tex
  7. 2
      patacrep/songs/__init__.py
  8. 25
      patacrep/songs/chordpro/__init__.py
  9. 0
      test/test_chordpro/datadir/scores/greensleeves.ly
  10. 4
      test/test_chordpro/greensleeves.tex
  11. 6
      test/test_chordpro/metadata.tex

0
examples/datadir2/img/datadir2.ly → examples/datadir2/scores/datadir2.ly

0
examples/img/datadir.ly → examples/scores/datadir.ly

6
examples/songs/subdir/datadir.sg

@ -1,10 +1,10 @@
\beginsong{Image included from datadir\\\LaTeX}
[cov={datadir}]
[cov={img/datadir}]
\cover
\lilypond{datadir.ly}
\lilypond{scores/datadir.ly}
\image{datadir}
\image{img/datadir}
\endsong

6
examples/songs/subdir/datadir2.sg

@ -1,10 +1,10 @@
\beginsong{Image included from a different datadir\\\LaTeX}
[cov={datadir2}]
[cov={img/datadir2}]
\cover
\lilypond{datadir2.ly}
\lilypond{scores/datadir2.ly}
\image{datadir2}
\image{img/datadir2}
\endsong

2
patacrep/data/templates/patacrep.tex

@ -34,7 +34,7 @@
},
"picture": {"description": {"english": "Cover picture", "french": "Image de couverture"},
"type": "file",
"default": {"default": "treble_a"}
"default": {"default": "img/treble_a"}
},
"picturecopyright": {"description": {"english": "Copyright for the cover picture", "french": "Copyright pour l'image de couverture"},
"default": {"default": "Dbolton \\url{http://commons.wikimedia.org/wiki/User:Dbolton}"}

2
patacrep/data/templates/songs.tex

@ -89,7 +89,7 @@
\usepackage{graphicx}
\graphicspath{ %
(* for dir in datadir *)
{(( path2posix(dir) ))/img/} %
{(( path2posix(dir) ))/} %
(* endfor *)
}

2
patacrep/songs/__init__.py

@ -263,7 +263,7 @@ class Song:
return self.search_file(
filename,
['', '.ly'],
datadirs=self.get_datadirs('img'),
datadirs=self.get_datadirs('scores'),
)
def unprefixed_title(title, prefixes):

25
patacrep/songs/chordpro/__init__.py

@ -93,16 +93,29 @@ class Chordpro2LatexSong(ChordproSong):
output_language = "latex"
def search_file(self, filename, extensions=None, *, datadirs=None):
_datadir, filename, _extension = self.search_datadir_file(
filename,
extensions,
datadirs,
)
return filename
def search_partition(self, filename):
try:
_datadir, filename, _extension = self.search_datadir_file(
filename,
extensions,
datadirs,
return os.path.join("scores", super().search_partition(filename))
except FileNotFoundError:
LOGGER.warning(
"Song '%s' (datadir '%s'): Score '%s' not found.",
self.subpath, self.datadir, filename,
)
return filename
return None
def search_image(self, filename):
try:
return os.path.join("img", super().search_image(filename))
except FileNotFoundError:
LOGGER.warning(
"Song '%s' (datadir '%s'): File '%s' not found.",
"Song '%s' (datadir '%s'): Image '%s' not found.",
self.subpath, self.datadir, filename,
)
return None

0
test/test_chordpro/datadir/img/greensleeves.ly → test/test_chordpro/datadir/scores/greensleeves.ly

4
test/test_chordpro/greensleeves.tex

@ -7,14 +7,14 @@ Un sous titre}[
by={
Traditionnel },
album={Angleterre},
cov={traditionnel},
cov={img/traditionnel},
]
\cover
\lilypond{greensleeves.ly}
\lilypond{scores/greensleeves.ly}

6
test/test_chordpro/metadata.tex

@ -11,7 +11,7 @@ Subtitle5}[
Author2 },
album={Album},
copyright={Copyright},
cov={test/test_chordpro/metadata_cover},
cov={img/test/test_chordpro/metadata_cover},
foo={Foo},
]
@ -19,8 +19,8 @@ Subtitle5}[
\textnote{Comment}
\musicnote{GuitarComment}
\lilypond{test/test_chordpro/metadata_lilypond}
\image{test/test_chordpro/metadata_image}
\lilypond{scores/test/test_chordpro/metadata_lilypond}
\image{img/test/test_chordpro/metadata_image}

Loading…
Cancel
Save