Hey all, I notice that the libprs500 utils seem really popular and have a ton of functionality. Like many others, I downloaded all of the BAEN CDs and wanted to do a mass conversion. Put together a real quick script in case anyone else is looking for something similar. (Didn't see anything in a search, but might have missed if someone already did similar)
Basically, just dump all your files of the same type (.lit, .rtf, etc.) into a single directory, and run the below script from that directory. First option is for the type of file converting from, second option is any *2lrf option you want to add (like meta-data changes). An example would be
./batch2lrf.sh rtf "--publisher=BAEN"
I tend to batch convert files in groups by author/series myself, but I ALWAYS name my source file to the book title. If you don't, remove the
"-t $targ" portion from the script. This makes it easy for me since I have a ton of files that don't have any meta-data, and I can at least get the title set without any extra work.
Works pretty simply for me, so I thought I'd share. Finished the first 5 CDs in less than 30 minutes.
Thanks again to Kovid for all his work!!
Quote:
#!/bin/bash
# $1 = input file type
# $2 = options
ls -1 | grep \.$1$ | sed "s/\.$1//g" > inputfiles
exec 3<inputfiles
while read -u 3 targ
do
echo "Converting File $targ.$1 to $targ.lrf"
$12lrf "-t $targ" $2 $targ.$1 &> /dev/null
done
exec 3<&-
rm inputfiles
|