Home | Fractal Benchmark
The programs on this page are quick hacks created for my personal use. They are published mainly to demonstrate what functionality I'm missing in free software but also in the hope they might be useful to others. They might or might not work for you. There is no warranty. Use them at your own risk.
iriverpla is a shell script for creating playlists for iriver multimedia players. These players use playlists in a simple format stored in files with extension ".pla". The playlists can be created by the player itself as so called "Quick Lists", but this becomes cumbersome for long lists. Under Microsoft Windows the software iriver plus3 can be used to make such playlists. Unofficial programs to make iriver playlists are iriverFile, iRiverPlaMaker3 by Mario Wehbrink and iRiverPlaMaker by Martin Owen. In the following example for the usage of "iriverpla" a list of paths to music files is generated with the "find" command and then converted to an iriver playlist. (The system must use UTF-8 character encoding. Otherwise the encoding system must be given as an argument to the script as shown in the second example.)
find /home/user/music/mozart -type f -printf "mozart/%P\n" | sort | ./iriverpla.sh > mozart.pla
The directory "mozart" must be copied into the "Music" directory and the file "mozart.pla" into the "Playlists" directory of an iriver UMS player. This has been tested with the model iriver T30. In the following example an M3U playlist with character encoding ISO Latin-1 containing paths relative to the "Music" directory is converted into an iriver playlist:
grep -A 1 '^#EXTINF:' list.m3u | grep -v '^#EXTINF:' | ./iriverpla.sh ISO-8859-1 > list.pla
Note that the main reason for creating this script has become obsolete since the "--guess-dpi" option has been added to pdf2djvu. The script is still useful for automatically removing prepended cover pages. If the PDF document contains images of different color or resolution which are to be converted, then pdf2djvu should be used.
scanpdf2djvu is a shell script, which converts a scanned document in PDF file format to a DjVu file. I wrote it to convert monochrome journal articles. If there is more than one image resolution or color depth, then a prepended cover page is assumed, which is discarded. The script uses pdf2djvu, which depends on Poppler. It depends on MuPDF and libxslt to extract DPI (and color) information from the PDF file. The contained XSLT style sheet must be in the same directory as the shell script. To get MuPDF use the following command:
darcs get --lazy http://darcs.ghostscript.com/fitz/
(To update the repository change to the directory 'fitz' and execute 'darcs pull'.)
./scanpdf2djvu.sh scan.pdf [first_page_number]
It will output a file "scan.djvu", which must not exist before. The optional second argument (default value 1) sets the start number for the page identifiers and titles. It can be used to fit the identifiers and titles to the page numbers of a scanned journal article.
djvuocropus is a shell/AWK script, which adds a hidden OCR text layer to a DjVu file of a scanned document. It depends on OCRopus (the SVN version from Google Code) and Tesseract to perform the text recognition, on libxslt to process the output of OCRopus and on DjVuLibre to edit the DjVu file. The contained AWK script and XSLT style sheet must be in the same directory as the shell script. Usage:
./djvuocropus.sh scan-in.djvu scan-with-text-out.djvu
"scan-with-text-out.djvu" must not exist before. Existing text layers are removed. A named pipe "djvuocropus.png" is created, which can be deleted manually after the script has finished.
djvuocropus does a similar job like ocrodjvu by Jakub Wilk. From the text layer created by ocrodjvu only whole lines can be selected, while djvuocropus creates layers where single word selection is possible. Information about headings and paragraphs provided by OCRopus is ignored.
bibtex2djvumeta is a shell script, which converts a bibtex entry to DjVu meta data and writes it into a meta data chunk of the shared annotation component of a DjVu file. It depends on Bibutils and DjVuLibre. Usage:
./bibtex2djvumeta.sh bibtex.bib key file-in.djvu file-with-metadata-out.djvu
"file-with-metadata-out.djvu" must not exist before.
Note that 'djvused -e print-meta' and DjView don't respect the order of metadata entries, whereas 'djvused -e "select-shared-ant; print-ant"' or ExifTool do.