Browse Source

Merge branch 'bug_imagecache' of git://git.spalax.fr.eu.org/songbook

Conflicts:
	songbook-makeindex.py
	songbook.py
	templates/ancient.tmpl
	templates/minimal.tmpl
	templates/patacrep.tmpl
	utils/songbook-gtab.py
remotes/origin/HEAD
Romain Goffe 11 years ago
parent
commit
f6d9616cc1
  1. 2
      makefile
  2. 25
      songbook.py
  3. 2
      templates/ancient.tmpl
  4. 2
      templates/minimal.tmpl
  5. 2
      templates/patacrep.tmpl
  6. 3
      tex/crepbook.cls
  7. 3
      utils/songbook-gtab.py

2
makefile

@ -62,7 +62,6 @@ clean:
$(TARGETS:%=%.nav) $(TARGETS:%=%.snm)
@rm -f *.sbx *.sxd *.sxc
@rm -f *.pyc
@rm -rf covers/
cleanall: clean
@rm -f $(PDF)
@ -99,7 +98,6 @@ archive: cleanall
--exclude=$(BOOKS_DIR)/default.sb \
--exclude=perso/* --exclude=perso \
--exclude=build/* --exclude=build \
--exclude=covers/* --exclude=covers \
--exclude=data/* --exclude=data \
--exclude=*tar.gz \
--transform 's/songbook/songbook-$(DATE)/1' \

25
songbook.py

@ -26,27 +26,6 @@ class Song:
def __repr__(self):
return repr((self.title, self.artist, self.album, self.path))
if platform.system() == "Linux":
from xdg.BaseDirectory import *
cachePath = os.path.join(xdg_cache_home, 'songbook')
else:
cachePath = os.path.join('cache', 'songbook')
def makeCoverCache(library):
'''
Copy all pictures found in the libraries into a unique cache
folder.
'''
# create the cache directory if it does not exist
if not os.path.exists(cachePath):
os.makedirs(cachePath)
# copy pictures file into the cache directory
covers = recursiveFind(os.path.join(library, 'songs'), '*.jpg')
for cover in covers:
coverPath = os.path.join(cachePath, os.path.basename(cover))
shutil.copy(cover, coverPath)
def matchRegexp(reg, iterable):
return [ m.group(1) for m in (reg.match(l) for l in iterable) if m ]
@ -177,9 +156,6 @@ def makeTexFile(sb, library, output):
content = [ line for line in f if not commentPattern.match(line) ]
for index, line in enumerate(content):
if re.compile("getCacheDirectory").search(line):
line = line.replace("\\getCacheDirectory", cachePath.replace("\\","/") + "/")
content[index] = line
if re.compile("getLibraryImgDirectory").search(line):
line = line.replace("\\getLibraryImgDirectory", library + "img/")
content[index] = line
@ -267,7 +243,6 @@ def main():
else:
assert False, "unhandled option"
makeCoverCache(library)
if songbook and output:
f = open(songbook)
sb = json.load(f)

2
templates/ancient.tmpl

@ -68,7 +68,7 @@
\newindex{titleidx}{\getname_title}
\newauthorindex{authidx}{\getname_auth}
\graphicspath{ {img/}, {\getLibraryImgDirectory}, {\getLibraryLilypondDirectory}, {\getCacheDirectory} }
\graphicspath{ {img/}, {\getLibraryImgDirectory}, {\getLibraryLilypondDirectory} }
\renewcommand{\lilypond}[1]{%
\iflilypond%

2
templates/minimal.tmpl

@ -42,7 +42,7 @@
\usepackage[italian,portuguese,spanish,english,french]{babel}
\lang{\getlang}
\graphicspath{ {img/}, {\getLibraryImgDirectory}, {\getLibraryLilypondDirectory}, {\getCacheDirectory} }
\graphicspath{ {img/}, {\getLibraryImgDirectory}, {\getLibraryLilypondDirectory} }
\renewcommand{\lilypond}[1]{%
\iflilypond%

2
templates/patacrep.tmpl

@ -69,7 +69,7 @@
\newindex{titleidx}{\getname_title}
\newauthorindex{authidx}{\getname_auth}
\graphicspath{ {img/}, {\getLibraryImgDirectory}, {\getLibraryLilypondDirectory}, {\getCacheDirectory} }
\graphicspath{ {img/}, {\getLibraryImgDirectory}, {\getLibraryLilypondDirectory} }
\renewcommand{\lilypond}[1]{%
\iflilypond%

3
tex/crepbook.cls

@ -73,6 +73,7 @@
\RequirePackage{xstring}
\RequirePackage{ifthen}
\RequirePackage{framed}
\RequirePackage{currfile}
\iflyric%
\tabsfalse%
@ -202,7 +203,7 @@
\setlength{\coverspace}{0.1cm}
\newcommand{\songcover}{}
\newcommand{\songalbum}{}
\newsongkey{cov}{\let\songcover\@empty}{\def\songcover{#1}}
\newsongkey{cov}{\let\songcover\@empty}{\def\songcover{\currfiledir#1}}
\newsongkey{album}{\let\songalbum\@empty}{\def\songalbum{#1}}
\newsongkey{url}{\let\songurl\@empty}{\def\songurl{#1}}
\newsongkey{original}{\let\songoriginal\@empty}{\def\songoriginal{#1}}

3
utils/songbook-gtab.py

@ -6,6 +6,8 @@ import re
from optparse import OptionParser
from utils.utils import recursiveFind
from utils.utils import recursiveFind
# Pattern set to ignore latex command in title prefix
gtabPattern = re.compile(r"\\gtab\{(.*)\}\{(.*)\}");
@ -27,6 +29,7 @@ def main():
positions = dict()
songfiles = recursiveFind(os.path.join(library, 'songs'), '*.sg')
for file in songfiles:
for line in open(file):
result = gtabPattern.match(line)

Loading…
Cancel
Save