Created
December 29, 2012 23:51
-
-
Save seidler2547/4410080 to your computer and use it in GitHub Desktop.
Zionworx to Lyricue
This file contains hidden or 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/sh | |
# you will need to get the Windows TurboDB Exchange s/w, like this: | |
# # wget http://dataweb.de/download/turbodbtools/tdbdataX.zip | |
# # unzip tdbdataX.zip | |
# then, copy all files from C:\Documents and Settings\All Users\...\Zionworx\2.6\Data | |
# into the current working dir | |
# Then, run this script, then you can import the lyricue.xmlz into Lyricue | |
# You will also need: | |
# - wine (because the Linux exporter of TurboDB is broken) | |
# - perl, and the Perl Module "Text::CSV" (install via »sudo apt-get install libtext-csv-perl« or »cpan Text::CSV«) | |
# This script assumes that you do NOT use { or } in your songs or song titles | |
wine TdbDataX.exe MainTable.dat export.csv -fsdf -s} -q{ | |
echo "Converting into Lyricue format ..." | |
perl -e ' | |
use Text::CSV; | |
sub clean { | |
my $r = $_[0]; | |
# $r=~s/\*//g; # optionally remove * signs from content | |
$r=~s/^\s+//; | |
$r=~s/\s+$//; | |
$r=~s/&/&/g; | |
$r=~s/</</g; | |
$r=~s/>/>/g; | |
return $r; | |
} | |
binmode(STDOUT, ":utf8"); | |
print "<lyricue>\n"; | |
my $csv = Text::CSV->new({escape_char => "\ff", binary => 1, sep_char => "}", quote_char => "{"}); | |
open my $fh, "<:encoding(windows-1252)", "export.csv"; | |
while (my $row = $csv->getline($fh)) { | |
my $name=clean($row->[1]); | |
$name=$name." / ".clean($row->[2]) if $row->[2]; | |
my $artist=clean($row->[4]); | |
my $copyright=clean($row->[5]); | |
my $pages=clean($row->[3]); | |
$pages=~s/\r//g; | |
$pages=~s!\n\n+!</page>\n<page>!gm; | |
$pages="<page>$pages</page>"; | |
print "<song>\n<name>$name</name>\n<artist>$artist</artist>\n<copyright>$copyright</copyright>\n$pages\n</song>\n"; | |
} | |
print "</lyricue>\n";' | gzip > lyricue.xmlz | |
echo "Done." | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment