Last active
December 24, 2018 02:40
-
-
Save MatthewCroughan/5e53672a6d24e6f0b614c0ad5f5227a8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sheetinput=${1?Error: no file given} | |
outputdir=${2?Error: no output directory given} | |
sheetoutput=final.svg | |
launchdir="$(pwd)" | |
ls $outputdir | |
mkdir /tmp/sheetfix | |
cp $sheetinput /tmp/sheetfix | |
cd /tmp/sheetfix | |
for fuck in $sheetinput; do | |
output=${fuck%.*}.svg | |
museoutput=${fuck%.*}-1.svg | |
musescore "$fuck" -o "$output" | |
sed -i''\ | |
-e 's/<polyline id="BarLine" class="BarLine" fill="none" stroke="#000000" stroke-width="1.99"/<polyline id="OtherElements" class="BarLine" fill="none" stroke="#000000" stroke-width="1.99"/g' \ | |
-e 's/<polyline class="BarLine" stroke="#000000" stroke-width="2.50"/<polyline id="OtherElements2" class="BarLine" stroke="#000000" stroke-width="2.50"/g' \ | |
-e 's/<polyline class="VoltaSegment" fill="none" stroke="#000000" stroke-width="0.40"/<polyline id="VoltaSegment" class="VoltaSegment" fill="none" stroke="#000000" stroke-width="0.40"/g' \ | |
-e 's/<polyline class="StaffLines"/<polyline id="StaffLines" class="StaffLines"/g' \ | |
-e 's/<polyline class="LedgerLine"/<polyline id="LedgerLine" class="LedgerLine"/g' \ | |
-e 's/<polyline class="Stem"/<polyline id="Stem" class="Stem"/g' \ | |
-e 's/<polyline class="LedgerLine"/<polyline id="LedgerLine" class="LedgerLine"/g' \ | |
-e 's/<polyline class="BarLine"/<polyline id="BarLine" class="BarLine"/g' \ | |
"$museoutput" | |
inkscape -z "$museoutput" -l "$museoutput" | |
inkscape -f "$museoutput" --select="StaffLines" --select="LedgerLine" --select="Stem" --select="LedgerLine" --select="BarLine" --select="OtherElements" --select="OtherElements2" --select="VoltaSegment" --verb="EditSelectSameStrokeStyle" --verb="StrokeToPath" --verb="EditSelectAll" --verb="SelectionUnion" --verb="FileSave" --verb="FileQuit" | |
cd $launchdir | |
mv /tmp/sheetfix/*-1.svg $outputdir | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment