From 330e7158349ccc2003a418e0236ca9a6d30af2e1 Mon Sep 17 00:00:00 2001 From: Romain Goffe Date: Sat, 7 May 2011 15:14:04 +0200 Subject: [PATCH] Utils: add script to generate volume-3 songs list --- utils/header-volume-3 | 12 ++++++++++++ utils/volume-3.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 utils/header-volume-3 create mode 100755 utils/volume-3.sh diff --git a/utils/header-volume-3 b/utils/header-volume-3 new file mode 100644 index 00000000..839fdf6d --- /dev/null +++ b/utils/header-volume-3 @@ -0,0 +1,12 @@ +{ +"template" : "patacrep.tmpl", +"bookoptions" : [ + "diagram", + "lilypond", + "pictures" + ], +"booktype" : "chorded", +"picture" : "Mousey_Band_by_Duffzilla", +"picturecopyright" : "duffzilla @ deviantart.com", +"subtitle" : "Tome 3", +"songs" : [ diff --git a/utils/volume-3.sh b/utils/volume-3.sh new file mode 100755 index 00000000..d1f07ab1 --- /dev/null +++ b/utils/volume-3.sh @@ -0,0 +1,40 @@ +#!/bin/sh +#Author: Romain Goffe +#Date: 07/05/2011 +#Description: Generate an sb file containing all the songs that are not +# already in volume-1 and volume-2 + +#all songs +cd songs +ls -1 */*.sg > ../res1 +cd .. + +#get volume 1 list +tail -n +12 volume-1.sb > tmp1 +head -n -2 tmp1 > list1 +sed -i -e "s/\",//g" -e "s/ \"//g" -e "s/\"//g" list1 + +#remove volume 1 songs +grep -vf list1 res1 > res2 + +#get volume 2 list +tail -n +13 volume-2.sb > tmp2 +head -n -2 tmp2 > list2 +sed -i -e "s/\",//g" -e "s/ \"//g" -e "s/\"//g" list2 + +#remove volume 2 songs +grep -vf list2 res2 > res3 + +#format song list +sed -i -e "s/^/ \"/g" -e "s/$/\",/g" res3 +head -c -2 res3 > res + + +#make volume 3 sb file +cat utils/header-volume-3 > volume-3.sb +cat res >> volume-3.sb +echo "]" >> volume-3.sb +echo "}" >> volume-3.sb + +#remove tmp files +rm -f res res1 res2 res3 list1 list2 tmp1 tmp2