owntone-server/contrib/mt-daapd-ssc.sh

56 lines
827 B
Bash
Raw Normal View History

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-02-26 23:07:27 -05:00
$OGGDEC --quiet -o - "$1" | $WAVSTREAMER -o $2 -l $3
2005-02-21 13:41:12 -05:00
}
2005-02-26 23:07:27 -05:00
flac_file() {
$FLAC --silent --decode --stdout "$1" | $WAVSTREAMER -o $2 -l $3
}
2005-02-21 13:41:12 -05:00
OFFSET=0
2005-02-26 23:07:27 -05:00
FORGELEN=0
2005-02-21 13:41:12 -05:00
if [ "$2" == "" ]; then
OFFSET=0
else
OFFSET=$2
fi
2005-02-26 23:07:27 -05:00
if [ "$3" == "" ]; then
FORGELEN=0
else
FORGELEN=$3
2005-02-21 13:41:12 -05:00
fi
2005-02-26 23:07:27 -05:00
if ( echo $1 | grep -i "\.ogg$" > /dev/null 2>&1 ); then
ogg_file $1 $OFFSET $FORGELEN
exit;
fi
2005-02-23 23:59:53 -05:00
2005-02-26 23:07:27 -05:00
if ( echo $1 | grep -i "\.flac$" > /dev/null 2>&1 ); then
flac_file $1 $OFFSET $FORGELEN
exit;
fi
#
# here you could cat a generic "error" wav...
#
#
# cat /path/to/error.wav
#