2005-02-26 23:07:27 -05:00
|
|
|
#!/bin/sh
|
2005-02-21 13:41:12 -05:00
|
|
|
#
|
|
|
|
# script to facilitate server-side transcoding of ogg files
|
|
|
|
#
|
|
|
|
#
|
2005-02-26 23:07:27 -05:00
|
|
|
# Usage: mt-daapd-ssc.sh <filename> <offset> <length in seconds>
|
2005-02-21 13:41:12 -05:00
|
|
|
#
|
2005-02-26 23:07:27 -05:00
|
|
|
# You may need to fix these paths:
|
|
|
|
#
|
|
|
|
|
|
|
|
WAVSTREAMER=wavstreamer
|
|
|
|
OGGDEC=oggdec
|
|
|
|
FLAC=flac
|
2005-02-21 13:41:12 -05:00
|
|
|
|
|
|
|
ogg_file() {
|
2005-03-05 00:44:35 -05:00
|
|
|
$OGGDEC --quiet -o - "$FILE" | $WAVSTREAMER -o $OFFSET $FORGELEN
|
2005-02-21 13:41:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-02-26 23:07:27 -05:00
|
|
|
flac_file() {
|
2005-03-05 00:44:35 -05:00
|
|
|
$FLAC --silent --decode --stdout "$FILE" | $WAVSTREAMER -o $OFFSET $FORGELEN
|
2005-02-26 23:07:27 -05:00
|
|
|
}
|
|
|
|
|
2005-03-05 00:44:35 -05:00
|
|
|
FILE=$1
|
2007-10-22 23:13:15 -04:00
|
|
|
OFFSET=${2:-0}
|
2005-02-26 23:07:27 -05:00
|
|
|
|
2005-03-05 00:44:35 -05:00
|
|
|
if [ "$3" != "" ]; then
|
|
|
|
FORGELEN="-l $3"
|
2005-02-21 13:41:12 -05:00
|
|
|
fi
|
|
|
|
|
2007-10-22 23:13:15 -04:00
|
|
|
case "$1" in
|
|
|
|
*.[oO][gG][gG])
|
|
|
|
ogg_file
|
|
|
|
;;
|
|
|
|
*.[fF][lL][aA][cC])
|
|
|
|
flac_file
|
|
|
|
;;
|
|
|
|
*)
|
2005-02-26 23:07:27 -05:00
|
|
|
# here you could cat a generic "error" wav...
|
|
|
|
# cat /path/to/error.wav
|
2007-10-22 23:13:15 -04:00
|
|
|
;;
|
|
|
|
esac
|