mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-25 06:35:57 -05:00
Use wavstreamer
This commit is contained in:
parent
f43da69cf7
commit
880372a523
@ -1,24 +1,28 @@
|
||||
#!/opt/bin/bash
|
||||
#!/bin/sh
|
||||
#
|
||||
# script to facilitate server-side transcoding of ogg files
|
||||
# Ron Pedde (ron@pedde.com)
|
||||
#
|
||||
# Usage: mt-daapd-ssc.sh <filename> <offset>
|
||||
#
|
||||
# This is not as flexible as Timo's transcoding script, but it works
|
||||
# without perl, making it more suitable for the NSLU2.
|
||||
# Usage: mt-daapd-ssc.sh <filename> <offset> <length in seconds>
|
||||
#
|
||||
# You may need to fix these paths:
|
||||
#
|
||||
|
||||
WAVSTREAMER=wavstreamer
|
||||
OGGDEC=oggdec
|
||||
FLAC=flac
|
||||
|
||||
ogg_file() {
|
||||
if [ $OFFSET -eq 0 ]; then
|
||||
oggdec --quiet -o - "$1"
|
||||
else
|
||||
oggdec --quiet -o - "$1" | dd bs=$OFFSET skip=1 2>/dev/null
|
||||
fi
|
||||
$OGGDEC --quiet -o - "$1" | $WAVSTREAMER -o $2 -l $3
|
||||
}
|
||||
|
||||
|
||||
flac_file() {
|
||||
$FLAC --silent --decode --stdout "$1" | $WAVSTREAMER -o $2 -l $3
|
||||
}
|
||||
|
||||
OFFSET=0
|
||||
FORGELEN=0
|
||||
|
||||
if [ "$2" == "" ]; then
|
||||
OFFSET=0
|
||||
@ -26,9 +30,26 @@ else
|
||||
OFFSET=$2
|
||||
fi
|
||||
|
||||
if [ $OFFSET -lt 1024 ]; then
|
||||
OFFSET=0
|
||||
|
||||
if [ "$3" == "" ]; then
|
||||
FORGELEN=0
|
||||
else
|
||||
FORGELEN=$3
|
||||
fi
|
||||
|
||||
ogg_file $1 $OFFSET
|
||||
if ( echo $1 | grep -i "\.ogg$" > /dev/null 2>&1 ); then
|
||||
ogg_file $1 $OFFSET $FORGELEN
|
||||
exit;
|
||||
fi
|
||||
|
||||
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
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user