From f10ed7503fa50581ec6589230585ac18acc2de7d Mon Sep 17 00:00:00 2001 From: Louis Date: Thu, 7 Mar 2013 20:25:59 +0100 Subject: [PATCH 01/10] =?UTF-8?q?D=C3=A9but=20d'un=20cahier=20des=20charge?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cahier_des_charges/charges.txt | 152 +++++++++++++++++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 cahier_des_charges/charges.txt diff --git a/cahier_des_charges/charges.txt b/cahier_des_charges/charges.txt new file mode 100644 index 00000000..3c502921 --- /dev/null +++ b/cahier_des_charges/charges.txt @@ -0,0 +1,152 @@ +# Index personnalisés + +Je veux être capable de créer mes propres index. Je ne veux pas choisir dans +une liste prédéfinie, mais pouvoir les personnaliser. Je veux pouvoir leur +donner le titre que je veux. + +## Proposition + +Dans le fichier general.sg, définition d'une liste : + +> indexes = [ +> "auteur", +> ("pays", "Index par pays d'origine"), +> ] + +Ceci signifie que j'aurai deux index : + +- l'un utilisant le mot-clef "auteur", ayant pour titre "Index par auteur" ; +- l'autre utilisant le mot-clef "pays", ayant pour titre "Index par pays d'origine". + +Pour chaque index, le mot clef sortas_nom est disponible, si l'on veut que le +nom qui s'affiche ne soit pas le nom par lequel l'entrée est triée. + +# Découpage du document + +Je veux pouvoir personnaliser le document, à savoir : mettre ma propre page de +titre, choisir l'ordre des éléments (index au début ou à la fin), ajouter des +pages personnalisées, etc. + +## Proposition + +### Préambule + +Dans le fichier general.sg, définition de variables : + +> preambule = "\usepackage{yfonts}" + +Cette variable permet d'ajouter des choses au préambule. Pour intégrer un fichier complet, il suffit de mettre : + +> preambule = "\input{mon_preambule.tex}" + +### Document + +Dans le fichier general.sg, possibilité de définir la variable document : + +> document = [ +> TITLE, +> INDEXES, +> SONGS, +> "appendice.tex", +> ] + +Ceci signifie que mon document comportera la page de titre, l'index, les textes +des chansons par défaut, et à la fin, intégrera mon document "appendice.tex". + +# Emplacement des chansons + +Je veux pouvoir dire à quelles chansons aller chercher. + +## Proposition + +Dans le fichier general.sg, utilisation des variables SONG_ROOT et SONG_FILES. + +> SONG_ROOT = "~/chansons" +> SONG_FILES = "*/*.tex" + +Il est possible de mettre une liste dans SONG_FILES, pour dire de prendre tous +les éléments de la liste. + +# Langue + +Je veux pouvoir dire dans quel langue est chaque chanson, et que ceci soit +ajouté automatiquement à l'appel de Babel. + +# Référence + +Je veux pouvoir faire référence à des chansons (nom, page, etc.). + +## Proposition + +Faire en sorte que la commande \label fonctionne, ou ajouter un mot-clef +"label" à \beginsong. + +Ensuite, avoir à disposition des commandes \songtitle{ref}, \songpage{ref}, +\songkeyword{ref}{keyword}. + +# Chansons de plusieurs auteurs + +Je veux pouvoir choisir l'ordre de mes chansons (classement par auteur par exemple). + +Je veux pouvoir attribuer des chansons à plusieurs auteurs, et décider dans la +partie de quel auteur elle aparaisse, et qu'elle soit référencée dans d'autre. + +Exemple : Les Oiseaux de passage, de Richepin, chantée par Brassens. Je veux +que le texte apparaisse avec les autres textes de Richepin, avec la mention « +Mise en musique par Brassens », et qu'à un endroit dans la « partie » Brassens, +apparaisse le texte « Voir aussi \songtitle{richepin_oiseau}, page +\songpage{richepin_page} ». La chanson apparaitra pour les deux auteurs dans +l'index par auteur. + +## Proposition + +> \beginsong{Chanson des cloches de baptême}[label=richepin_cloches, author=Richepin] +> \comment{Chantée par \songauthor{brassens_philistins} sous le titre \songtitle{brassens_philistins}.} +> ... +> \endsong +> +> \beginchildsong{Philistins}[parent=richepin_cloches, author=Brassens] +> Voir \songtitle{richepin_cloches}, page \pagetitle{richepin_page}. +> \endsong + +# Possibilité d'exporter en LaTeX ou PDF + +Je veux pouvoir, en ligne de commande, dire que je souhaite un export en LaTeX +ou en PDF. + +# Partitions + +Je veux pouvoir placer mes partitions Lilypond dans le même répertoire que les +chansons correspondantes. + +# PDF + +Je veux pouvoir intégrer des PDF comme chansons (partitions scannées). + +# Traductions + +Je pouvoir intégrer des traductions. + +## Proposition + +Dans le fichier general.sg, une variable avec la langue par défaut pour les +traductions. + +> DEFAULT_TRANSLATION_LANGUAGE = "francais" + +Dans un fichier de chanson : + +> \begin[english]{translation} +> Do not use your spoon with your left hand / etc. +> \end{translation} + +# Commentaires + +Je veux pouvoir ajouter des commentaires dans les chansons, qui soient mis en +valeur différement. + +# Langage du fichier de configuration + +Je propose que le fichier de configuration soit du Python : puisqu'un client +texte existe, nous pouvons considérer que quelqu'un modifiant à la main ce +fichier sait faire du Python. From fccb0181ef8c5aed25da1be9d31e237bedea6301 Mon Sep 17 00:00:00 2001 From: Louis Date: Fri, 8 Mar 2013 22:19:35 +0100 Subject: [PATCH 02/10] Cahier des charges --- cahier_des_charges/charges.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cahier_des_charges/charges.txt b/cahier_des_charges/charges.txt index 3c502921..9af8bc53 100644 --- a/cahier_des_charges/charges.txt +++ b/cahier_des_charges/charges.txt @@ -150,3 +150,8 @@ valeur différement. Je propose que le fichier de configuration soit du Python : puisqu'un client texte existe, nous pouvons considérer que quelqu'un modifiant à la main ce fichier sait faire du Python. + +# Langues + +Pouvoir définir les langues dans le fichier de configuration general.sg, pour +que babel ne soit pas bloqué. From efa6f82cf1da3eb0e531abbd3e57f62b96ccf1fc Mon Sep 17 00:00:00 2001 From: Louis Date: Fri, 8 Mar 2013 22:25:36 +0100 Subject: [PATCH 03/10] =?UTF-8?q?Correction=20du=20bug:=20un=20carnet=20sa?= =?UTF-8?q?ns=20chansons=20est=20autoris=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- songbook-makeindex.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/songbook-makeindex.py b/songbook-makeindex.py index 8509aa61..0ed27d56 100755 --- a/songbook-makeindex.py +++ b/songbook-makeindex.py @@ -85,10 +85,11 @@ def processSXD(filename): type = data[0] i = 1 idx = index() - while data[i].startswith('%'): - keywords = keywordPattern.match(data[i]).groups() - idx.keyword(keywords[0],keywords[1]) - i += 1 + if len(data) > 1: + while data[i].startswith('%'): + keywords = keywordPattern.match(data[i]).groups() + idx.keyword(keywords[0],keywords[1]) + i += 1 idx.compileKeywords() for i in range(i,len(data),3): entry = processSXDEntry(data[i:i+3]) From 2b4a213086c9313fff59e031d435326fe2bb144b Mon Sep 17 00:00:00 2001 From: Louis Date: Fri, 8 Mar 2013 22:51:38 +0100 Subject: [PATCH 04/10] =?UTF-8?q?Correction=20bug=20:=20trouver=20r=C3=A9c?= =?UTF-8?q?ursivement=20les=20fichiers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- songbook.py | 9 +++++---- utils/__init__.py | 0 utils/resize-cover.py | 5 +++-- utils/rules.py | 4 +++- utils/songbook-gtab.py | 5 +++-- utils/utils.py | 13 +++++++++++++ 6 files changed, 27 insertions(+), 9 deletions(-) create mode 100644 utils/__init__.py create mode 100644 utils/utils.py diff --git a/songbook.py b/songbook.py index f443947b..41b4b3df 100755 --- a/songbook.py +++ b/songbook.py @@ -4,7 +4,6 @@ import getopt, sys import os.path -import glob import re import json import locale @@ -12,6 +11,8 @@ import shutil import locale import platform +from utils.utils import recursiveFind + reTitle = re.compile('(?<=beginsong\\{)(.(? 0: out.write(formatDefinition('songslist', songslist(library, songs))) @@ -184,7 +185,7 @@ def makeDepend(sb, library, output): # check for deps (in sb data) deps = []; if sb["songs"] == "all": - deps += glob.glob(library + 'songs/*/*.sg') + deps += recursiveFind(os.path.join(library, 'songs'), '*.sg') else: deps += map(lambda x: library + "songs/" + x, sb["songs"]) diff --git a/utils/__init__.py b/utils/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/utils/resize-cover.py b/utils/resize-cover.py index c7f9daf3..21964487 100755 --- a/utils/resize-cover.py +++ b/utils/resize-cover.py @@ -6,10 +6,11 @@ #Description: Resize all covers to 128,128 thumbnails import Image -import glob + +from utils.utils import recursiveFind # Process song files -covers = glob.glob('songs/*/*.jpg') +covers = recursiveFind(os.path.join(library, 'songs'), '*.jpg') for filename in covers: source = Image.open(filename) diff --git a/utils/rules.py b/utils/rules.py index b1dfbb11..52b6e0b3 100755 --- a/utils/rules.py +++ b/utils/rules.py @@ -8,6 +8,8 @@ import logging import locale re.LOCALE +from utils.utils import recursiveFind + # the dictionary has target_word:replacement_word pairs word_dic = { ##: oe inclusion @@ -236,7 +238,7 @@ def main(): usage() sys.exit(2) - songfiles = glob.glob('songs/*/*.sg') + songfiles = recursiveFind(os.path.join(library, 'songs'), '*.sg') loglevel = "warning" for option, arg in opts: diff --git a/utils/songbook-gtab.py b/utils/songbook-gtab.py index 3a67355c..c89411e8 100755 --- a/utils/songbook-gtab.py +++ b/utils/songbook-gtab.py @@ -2,10 +2,11 @@ # import sys -import glob import re from optparse import OptionParser +from utils.utils import recursiveFind + # Pattern set to ignore latex command in title prefix gtabPattern = re.compile(r"\\gtab\{(.*)\}\{(.*)\}"); @@ -26,7 +27,7 @@ def main(): chords = dict() positions = dict() - songfiles = glob.glob('songs/*/*.sg') + songfiles = recursiveFind(os.path.join(library, 'songs'), '*.sg') for file in songfiles: for line in open(file): diff --git a/utils/utils.py b/utils/utils.py new file mode 100644 index 00000000..576c66b2 --- /dev/null +++ b/utils/utils.py @@ -0,0 +1,13 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# + +import fnmatch +import os + +def recursiveFind(root_directory, pattern): + matches = [] + for root, dirnames, filenames in os.walk(root_directory): + for filename in fnmatch.filter(filenames, pattern): + matches.append(os.path.join(root, filename)) + return matches From 1a057bcdfc749ec48abeb94f4f9b6e560084cbab Mon Sep 17 00:00:00 2001 From: Louis Date: Fri, 8 Mar 2013 23:03:59 +0100 Subject: [PATCH 05/10] =?UTF-8?q?Correction=20du=20bug=20:=20il=20est=20ma?= =?UTF-8?q?intenant=20possible=20de=20changer=20l'appel=20=C3=A0=20geometr?= =?UTF-8?q?y?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/ancient.tmpl | 13 +++++++++++++ templates/minimal.tmpl | 13 +++++++++++++ templates/patacrep.tmpl | 13 +++++++++++++ tex/crepbook.cls | 15 +-------------- 4 files changed, 40 insertions(+), 14 deletions(-) diff --git a/templates/ancient.tmpl b/templates/ancient.tmpl index 1575f198..9ed78c52 100644 --- a/templates/ancient.tmpl +++ b/templates/ancient.tmpl @@ -88,6 +88,19 @@ \pagestyle{empty} +% +% Customization of the page appearance +% +\RequirePackage[ + a4paper % paper size + ,includeheadfoot % include header and footer into text size + ,hmarginratio=1:1 % ratio between inner and outer margin (default) + ,outer=1.8cm % outer margin (right) + ,vmarginratio=1:1 % ratio between top and bottom margin + ,bmargin=1.3cm % bottom margin +% ,bindingoffset=1.7cm % space reserved to bound pages together + ]{geometry} + \begin{document} \maketitle diff --git a/templates/minimal.tmpl b/templates/minimal.tmpl index 3bdcd58a..d7fa5b65 100644 --- a/templates/minimal.tmpl +++ b/templates/minimal.tmpl @@ -52,6 +52,19 @@ \nosongnumbers \pagestyle{empty} +% +% Customization of the page appearance +% +\RequirePackage[ + a4paper % paper size + ,includeheadfoot % include header and footer into text size + ,hmarginratio=1:1 % ratio between inner and outer margin (default) + ,outer=1.8cm % outer margin (right) + ,vmarginratio=1:1 % ratio between top and bottom margin + ,bmargin=1.3cm % bottom margin +% ,bindingoffset=1.7cm % space reserved to bound pages together + ]{geometry} + \begin{document} \begin{songs}{} diff --git a/templates/patacrep.tmpl b/templates/patacrep.tmpl index 9b78917b..ec7f8e60 100644 --- a/templates/patacrep.tmpl +++ b/templates/patacrep.tmpl @@ -86,6 +86,19 @@ \pagestyle{empty} +% +% Customization of the page appearance +% +\RequirePackage[ + a4paper % paper size + ,includeheadfoot % include header and footer into text size + ,hmarginratio=1:1 % ratio between inner and outer margin (default) + ,outer=1.8cm % outer margin (right) + ,vmarginratio=1:1 % ratio between top and bottom margin + ,bmargin=1.3cm % bottom margin +% ,bindingoffset=1.7cm % space reserved to bound pages together + ]{geometry} + \begin{document} % translate default title diff --git a/tex/crepbook.cls b/tex/crepbook.cls index b61d24ac..7bd8c952 100644 --- a/tex/crepbook.cls +++ b/tex/crepbook.cls @@ -54,7 +54,7 @@ \ProcessOptions % Base class -\LoadClass[a4paper]{article} +\LoadClass{article} % Main packages \RequirePackage{graphicx,xcolor} @@ -335,19 +335,6 @@ \renewcommand{\idxheadfont}{\sffamily\it\LARGE} \renewcommand{\idxrefsfont}{\bfseries} -% -% Customization of the page appearance -% -\RequirePackage[ - a4paper % paper size - ,includeheadfoot % include header and footer into text size - ,hmarginratio=1:1 % ratio between inner and outer margin (default) - ,outer=1.8cm % outer margin (right) - ,vmarginratio=1:1 % ratio between top and bottom margin - ,bmargin=1.3cm % bottom margin -% ,bindingoffset=1.7cm % space reserved to bound pages together - ]{geometry} - % Paragraph indentation space \setlength{\parindent}{0.3cm} From cf866b48b1a08ab5b91ddbd511d69999ccc111d0 Mon Sep 17 00:00:00 2001 From: Louis Date: Fri, 8 Mar 2013 23:23:33 +0100 Subject: [PATCH 06/10] Autorisation de la commande \titleprefixword --- songbook-makeindex.py | 12 ++++++++++-- sortindex.py | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/songbook-makeindex.py b/songbook-makeindex.py index 8509aa61..5a0b822b 100755 --- a/songbook-makeindex.py +++ b/songbook-makeindex.py @@ -18,7 +18,7 @@ import sortindex import locale # Pattern set to ignore latex command in title prefix -keywordPattern = re.compile(r"^%(\w+)\s?(\w*)") +keywordPattern = re.compile(r"^%(\w+)\s?(.*)$") firstLetterPattern = re.compile(r"^(?:\{?\\\w+\}?)*[^\w]*(\w)") class index: @@ -37,9 +37,17 @@ class index: self.keywords[key].append(word) def compileKeywords(self): - pass + self.prefix_patterns = [] + if 'prefix' in self.keywords: + for prefix in self.keywords['prefix']: + self.prefix_patterns.append(re.compile(r"^(%s)\b\s*(.*)$" % prefix)) def add(self, key, number, link): + for pattern in self.prefix_patterns: + match = pattern.match(key) + if match: + key = "%s (%s)" % (match.group(2), match.group(1)) + break # Only one match per key (first, key) = self.filter(key) if not self.data.has_key(first): self.data[first] = dict() diff --git a/sortindex.py b/sortindex.py index dd3d5d50..4333e5f2 100644 --- a/sortindex.py +++ b/sortindex.py @@ -28,6 +28,7 @@ replacePattern = { '~n' : 'ñ', "c C" : 'Ç', "c c" : 'ç', + "textquoteright" : "'", } def sortkey(value): From 721121ed0b05943f9b6a38696267af1ef59d898d Mon Sep 17 00:00:00 2001 From: Louis Date: Sat, 9 Mar 2013 00:14:25 +0100 Subject: [PATCH 07/10] Cachier des charge --- cahier_des_charges/charges.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cahier_des_charges/charges.txt b/cahier_des_charges/charges.txt index 9af8bc53..21d4b611 100644 --- a/cahier_des_charges/charges.txt +++ b/cahier_des_charges/charges.txt @@ -21,6 +21,8 @@ Ceci signifie que j'aurai deux index : Pour chaque index, le mot clef sortas_nom est disponible, si l'on veut que le nom qui s'affiche ne soit pas le nom par lequel l'entrée est triée. +Utiliser la commande \newsongkey : http://songs.sourceforge.net/songsdoc/songs.html#mac.newsongkey + # Découpage du document Je veux pouvoir personnaliser le document, à savoir : mettre ma propre page de From 3c1582bdf989e49bfd62826363beb2cc076fdef8 Mon Sep 17 00:00:00 2001 From: Louis Date: Sat, 9 Mar 2013 01:57:33 +0100 Subject: [PATCH 08/10] =?UTF-8?q?Correction=20:=20Tri=20des=20chansons=20e?= =?UTF-8?q?n=20prenant=20compte=20des=20pr=C3=A9fixes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- songbook.py | 24 +++++++++++++++++++++--- templates/minimal.tmpl | 5 ++++- templates/patacrep.tmpl | 5 ++++- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/songbook.py b/songbook.py index f443947b..aeb404ee 100755 --- a/songbook.py +++ b/songbook.py @@ -49,7 +49,17 @@ def makeCoverCache(library): def matchRegexp(reg, iterable): return [ m.group(1) for m in (reg.match(l) for l in iterable) if m ] -def songslist(library, songs): +def unprefixed(title, prefixes): + """Remove the first prefix of the list in the beginning of title (if any). + """ + for prefix in prefixes: + match = re.compile(r"^(%s)\b\s*(.*)$" % prefix).match(title) + if match: + return match.group(2) + return title + + +def songslist(library, songs, prefixes): song_objects = [] for s in songs: path = library + 'songs/' + s @@ -64,7 +74,7 @@ def songslist(library, songs): album = '' song_objects.append(Song(title, artist, album, path)) - song_objects = sorted(song_objects, key=lambda x: locale.strxfrm(x.title)) + song_objects = sorted(song_objects, key=lambda x: locale.strxfrm(unprefixed(x.title, prefixes))) song_objects = sorted(song_objects, key=lambda x: locale.strxfrm(x.album)) song_objects = sorted(song_objects, key=lambda x: locale.strxfrm(x.artist)) @@ -121,6 +131,8 @@ def makeTexFile(sb, library, output): # default value template = "patacrep.tmpl" songs = [] + titleprefixwords = "" + prefixes = [] # parse the songbook data if "template" in sb: @@ -129,6 +141,12 @@ def makeTexFile(sb, library, output): if "songs" in sb: songs = sb["songs"] del sb["songs"] + if "titleprefixwords" in sb: + prefixes = sb["titleprefixwords"] + for prefix in sb["titleprefixwords"]: + titleprefixwords += "\\titleprefixword{%s}\n" % prefix + sb["titleprefixwords"] = titleprefixwords + parameters = parseTemplate("templates/"+template) @@ -151,7 +169,7 @@ def makeTexFile(sb, library, output): songs = map(lambda x: x[len(library) + 6:], glob.glob(library + 'songs/*/*.sg')) if len(songs) > 0: - out.write(formatDefinition('songslist', songslist(library, songs))) + out.write(formatDefinition('songslist', songslist(library, songs, prefixes))) out.write('\\makeatother\n') # output template diff --git a/templates/minimal.tmpl b/templates/minimal.tmpl index 3bdcd58a..770641e6 100644 --- a/templates/minimal.tmpl +++ b/templates/minimal.tmpl @@ -29,7 +29,8 @@ %%: {"name":"lang", "description":"Language", "default":"english"}, %%: {"name":"instruments", "description":"Instruments", "type":"flag", "values":["guitar","ukulele"], "join":",", "mandatory":true, "default":["guitar"]}, %%: {"name":"bookoptions", "description":"Options", "type":"flag", "values":["diagram","importantdiagramonly","lilypond","pictures","tabs","repeatchords","onesongperpage"], "join":",", "mandatory":true, "default":["pictures"]}, -%%: {"name":"mainfontsize", "description":"Font Size", "type":"font", "default":"10"} +%%: {"name":"mainfontsize", "description":"Font Size", "type":"font", "default":"10"}, +%%: {"name":"titleprefixwords", "description":"Ignore some words in the beginning of song titles"} %%:] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % begin document @@ -49,6 +50,8 @@ \fi% } +\gettitleprefixwords + \nosongnumbers \pagestyle{empty} diff --git a/templates/patacrep.tmpl b/templates/patacrep.tmpl index 9b78917b..9ca68eae 100644 --- a/templates/patacrep.tmpl +++ b/templates/patacrep.tmpl @@ -42,7 +42,8 @@ %%: {"name":"mainfontsize", "description":"Font Size", "type":"font", "default":"10"}, %%: {"name":"songnumberbgcolor", "description":"Number Shade", "type":"color", "default":"#D1E4AE"}, %%: {"name":"notebgcolor", "description":"Note Shade", "type":"color", "default":"#D1E4AE"}, -%%: {"name":"indexbgcolor", "description":"Index Shade", "type":"color", "default":"#D1E4AE"} +%%: {"name":"indexbgcolor", "description":"Index Shade", "type":"color", "default":"#D1E4AE"}, +%%: {"name":"titleprefixwords", "description":"Ignore some words in the beginning of song titles"} %%:] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % begin document @@ -84,6 +85,8 @@ \renewcommand{\notebgcolor}{NoteBgColor} \renewcommand{\idxbgcolor}{IndexBgColor} +\gettitleprefixwords + \pagestyle{empty} \begin{document} From 61a5cf2bacb6a8cd0bcc16872a87eab89d09f32c Mon Sep 17 00:00:00 2001 From: Louis Date: Sun, 24 Mar 2013 23:37:47 +0100 Subject: [PATCH 09/10] =?UTF-8?q?Partag=C3=A9=20par=20ici=20:=20http://www?= =?UTF-8?q?.patacrep.com/forum/viewtopic.php=3Fid=3D91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cahier_des_charges/charges.txt | 159 --------------------------------- 1 file changed, 159 deletions(-) delete mode 100644 cahier_des_charges/charges.txt diff --git a/cahier_des_charges/charges.txt b/cahier_des_charges/charges.txt deleted file mode 100644 index 21d4b611..00000000 --- a/cahier_des_charges/charges.txt +++ /dev/null @@ -1,159 +0,0 @@ -# Index personnalisés - -Je veux être capable de créer mes propres index. Je ne veux pas choisir dans -une liste prédéfinie, mais pouvoir les personnaliser. Je veux pouvoir leur -donner le titre que je veux. - -## Proposition - -Dans le fichier general.sg, définition d'une liste : - -> indexes = [ -> "auteur", -> ("pays", "Index par pays d'origine"), -> ] - -Ceci signifie que j'aurai deux index : - -- l'un utilisant le mot-clef "auteur", ayant pour titre "Index par auteur" ; -- l'autre utilisant le mot-clef "pays", ayant pour titre "Index par pays d'origine". - -Pour chaque index, le mot clef sortas_nom est disponible, si l'on veut que le -nom qui s'affiche ne soit pas le nom par lequel l'entrée est triée. - -Utiliser la commande \newsongkey : http://songs.sourceforge.net/songsdoc/songs.html#mac.newsongkey - -# Découpage du document - -Je veux pouvoir personnaliser le document, à savoir : mettre ma propre page de -titre, choisir l'ordre des éléments (index au début ou à la fin), ajouter des -pages personnalisées, etc. - -## Proposition - -### Préambule - -Dans le fichier general.sg, définition de variables : - -> preambule = "\usepackage{yfonts}" - -Cette variable permet d'ajouter des choses au préambule. Pour intégrer un fichier complet, il suffit de mettre : - -> preambule = "\input{mon_preambule.tex}" - -### Document - -Dans le fichier general.sg, possibilité de définir la variable document : - -> document = [ -> TITLE, -> INDEXES, -> SONGS, -> "appendice.tex", -> ] - -Ceci signifie que mon document comportera la page de titre, l'index, les textes -des chansons par défaut, et à la fin, intégrera mon document "appendice.tex". - -# Emplacement des chansons - -Je veux pouvoir dire à quelles chansons aller chercher. - -## Proposition - -Dans le fichier general.sg, utilisation des variables SONG_ROOT et SONG_FILES. - -> SONG_ROOT = "~/chansons" -> SONG_FILES = "*/*.tex" - -Il est possible de mettre une liste dans SONG_FILES, pour dire de prendre tous -les éléments de la liste. - -# Langue - -Je veux pouvoir dire dans quel langue est chaque chanson, et que ceci soit -ajouté automatiquement à l'appel de Babel. - -# Référence - -Je veux pouvoir faire référence à des chansons (nom, page, etc.). - -## Proposition - -Faire en sorte que la commande \label fonctionne, ou ajouter un mot-clef -"label" à \beginsong. - -Ensuite, avoir à disposition des commandes \songtitle{ref}, \songpage{ref}, -\songkeyword{ref}{keyword}. - -# Chansons de plusieurs auteurs - -Je veux pouvoir choisir l'ordre de mes chansons (classement par auteur par exemple). - -Je veux pouvoir attribuer des chansons à plusieurs auteurs, et décider dans la -partie de quel auteur elle aparaisse, et qu'elle soit référencée dans d'autre. - -Exemple : Les Oiseaux de passage, de Richepin, chantée par Brassens. Je veux -que le texte apparaisse avec les autres textes de Richepin, avec la mention « -Mise en musique par Brassens », et qu'à un endroit dans la « partie » Brassens, -apparaisse le texte « Voir aussi \songtitle{richepin_oiseau}, page -\songpage{richepin_page} ». La chanson apparaitra pour les deux auteurs dans -l'index par auteur. - -## Proposition - -> \beginsong{Chanson des cloches de baptême}[label=richepin_cloches, author=Richepin] -> \comment{Chantée par \songauthor{brassens_philistins} sous le titre \songtitle{brassens_philistins}.} -> ... -> \endsong -> -> \beginchildsong{Philistins}[parent=richepin_cloches, author=Brassens] -> Voir \songtitle{richepin_cloches}, page \pagetitle{richepin_page}. -> \endsong - -# Possibilité d'exporter en LaTeX ou PDF - -Je veux pouvoir, en ligne de commande, dire que je souhaite un export en LaTeX -ou en PDF. - -# Partitions - -Je veux pouvoir placer mes partitions Lilypond dans le même répertoire que les -chansons correspondantes. - -# PDF - -Je veux pouvoir intégrer des PDF comme chansons (partitions scannées). - -# Traductions - -Je pouvoir intégrer des traductions. - -## Proposition - -Dans le fichier general.sg, une variable avec la langue par défaut pour les -traductions. - -> DEFAULT_TRANSLATION_LANGUAGE = "francais" - -Dans un fichier de chanson : - -> \begin[english]{translation} -> Do not use your spoon with your left hand / etc. -> \end{translation} - -# Commentaires - -Je veux pouvoir ajouter des commentaires dans les chansons, qui soient mis en -valeur différement. - -# Langage du fichier de configuration - -Je propose que le fichier de configuration soit du Python : puisqu'un client -texte existe, nous pouvons considérer que quelqu'un modifiant à la main ce -fichier sait faire du Python. - -# Langues - -Pouvoir définir les langues dans le fichier de configuration general.sg, pour -que babel ne soit pas bloqué. From eb6e4de02f1d6bcebd2c25f4b7f342ba86e6f3d9 Mon Sep 17 00:00:00 2001 From: Louis Date: Thu, 28 Mar 2013 19:24:45 +0100 Subject: [PATCH 10/10] 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}}