From eb6e4de02f1d6bcebd2c25f4b7f342ba86e6f3d9 Mon Sep 17 00:00:00 2001 From: Louis Date: Thu, 28 Mar 2013 19:24:45 +0100 Subject: [PATCH] Suppression du cache pour les images --- makefile | 2 -- songbook.py | 25 ------------------------- templates/ancient.tmpl | 2 +- templates/minimal.tmpl | 2 +- templates/patacrep.tmpl | 2 +- tex/crepbook.cls | 3 ++- 6 files changed, 5 insertions(+), 31 deletions(-) diff --git a/makefile b/makefile index 60e8289e..bbe65c1f 100644 --- a/makefile +++ b/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' \ diff --git a/songbook.py b/songbook.py index db03fba5..419ce4d6 100755 --- a/songbook.py +++ b/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 ] @@ -179,9 +158,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 @@ -269,7 +245,6 @@ def main(): else: assert False, "unhandled option" - makeCoverCache(library) if songbook and output: f = open(songbook) sb = json.load(f) diff --git a/templates/ancient.tmpl b/templates/ancient.tmpl index 9ed78c52..19c4da76 100644 --- a/templates/ancient.tmpl +++ b/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% diff --git a/templates/minimal.tmpl b/templates/minimal.tmpl index f029c988..631a0c84 100644 --- a/templates/minimal.tmpl +++ b/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% diff --git a/templates/patacrep.tmpl b/templates/patacrep.tmpl index a14d85ca..2a6d8bf5 100644 --- a/templates/patacrep.tmpl +++ b/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% diff --git a/tex/crepbook.cls b/tex/crepbook.cls index 7bd8c952..c256a7dd 100644 --- a/tex/crepbook.cls +++ b/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}}