#!/bin/sh # # (C) 2001 Alan Donovan. # # Author: Alan Donovan # # cdcover -- handy wrapper for cdlabelgen (does image scaling, etc). # # $Id: cdcover,v 1.1.1.1 2002/08/23 13:40:34 adonovan Exp $ # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied waranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the GNU General Public License for more details. # . # usage="usage: cdcover [image]" # Note: lines beginning with space in track file are not numbered TMP=$HOME/tmp/cdcover$$ artist="$1" album="$2" filename=`echo "$2" | tr -d ' '` trackfile="$3" image="$4" # checks! [ "$#" -ge "3" ] || { echo "$usage"; exit 1; } # get suffix imgtype=`echo "$image" | sed -e "s/.*\.//g"` # scaling: 340x340 points = 12cm square case $imgtype in gif) giftopnm "$image" | pnmscale -xysize 340 340 | pnmtops >$TMP.ps ps2epsi $TMP.ps $TMP.epsi eps=$TMP.epsi echo "gif" ;; jpg) djpeg "$image" | ppmquant 256 | pnmscale -xysize 340 340 | pnmtops >$TMP.ps ps2epsi $TMP.ps $TMP.epsi eps=$TMP.epsi echo "jpg" ;; #ps) # ;; #eps) # eps="$image" # ;; *) [ -z "$4" ] || { echo "unsupported image type: \`$image'."; exit 1; } eps="" ;; esac { echo echo "$artist: $album" echo nl -b "p^[^ ]" -s ". " "$trackfile" } >$TMP.track [ -z "$eps" ] || eps="-e $eps" # I had to hack out the banner. XXX fix this TEMPLATE="$HOME/stuff/cdlabelgen/template.ps" cdlabelgen -D -B -b -c "$artist" -s "$album" -f $TMP.track $eps -t $TEMPLATE >"$filename.ps" rm -f $TMP.track $TMP.ps $TMP.epsi echo "Generated output file: $filename.ps"