Claudio Favi's Wiki
VirtMus
français | english
Navigation
Ce wiki
Cette page

Wrote this script to convert a pdf file to a VirtMus song file.

I called the script pdf2song. It creates the file in the local directory... 

#!/bin/bash

#uncomment for debug
#set -x

INPUTPDF=$1
OUTPUTJPG=${1##*/}
OUTPUTJPG=${OUTPUTJPG%.pdf}.jpg
SONGFILE=${OUTPUTJPG%.jpg}.song.xml

convert -colorspace Gray -depth 8 -density 300x300 -resize x1050 "$INPUTPDF" "$OUTPUTJPG" || exit

#create the song.xml file
echo "<song>" > "$SONGFILE"
echo " <pages>" >> "$SONGFILE"

for f in "${OUTPUTJPG%.jpg}"*.jpg; do
echo " <page>" >> "$SONGFILE";
echo " <sourceFile>${f}</sourceFile>" >> "$SONGFILE";
echo " <rotation>Clockwise_0</rotation>" >> "$SONGFILE";
echo " </page>" >> "$SONGFILE";
done

echo " </pages>" >> "$SONGFILE";
echo -n "</song>" >> "$SONGFILE";

To process multiple files:

cd DESTDIR/
for f in ../SOURCEDIR/*.pdf; do pdf2song $f; done
Rechercher
Partager