userdoc:tt_external_moh_source

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
userdoc:tt_external_moh_source [2014/02/18 13:03]
abelbeck
userdoc:tt_external_moh_source [2014/02/19 06:43]
abelbeck [Internet Streaming]
Line 85: Line 85:
 ===== Internet Streaming ===== ===== Internet Streaming =====
  
-You can also easily stream music over the Internet/LAN for MOH with sox:+You can also easily stream music over the Internet/LAN for MOH with sox.  The ''ast-stream-mp3'' script directly supports MP3 streams or indirectly MP3 streams via a ''.pls'' playlist.
  
 Create file: ''/mnt/kd/bin/ast-stream-mp3'' Create file: ''/mnt/kd/bin/ast-stream-mp3''
Line 94: Line 94:
   # Value: "0.8" is 80%, "1.2" is 120%, default is "1.0" when not defined.   # Value: "0.8" is 80%, "1.2" is 120%, default is "1.0" when not defined.
   VOLUME="0.8"   VOLUME="0.8"
 +  
 +  URL="$1"
 +  if [ "$URL" != "${URL%.pls}" ]; then
 +    PLAYLIST="$(wget -q -O - $URL)"
 +    if [ $? -ne 0 ]; then
 +      sleep 10
 +      exit 1
 +    fi
 +    URL="$(echo "$PLAYLIST" | sed -n -r -e 's/^File[0-9]*=(.*)$/\1/p' | head -n1)"
 +    if [ -z "$URL" ]; then
 +      sleep 10
 +      exit 1
 +    fi
 +  fi
      
   if [ -n "$VOLUME" ]; then   if [ -n "$VOLUME" ]; then
Line 101: Line 115:
   fi   fi
      
-  wget -q -O - ${1} | sox -t mp3 $FOPTS - -t raw -r 8000 -c 1 -+  wget -q -O - $URL | sox -t mp3 $FOPTS - -t raw -r 8000 -c 1 -
  
 Make the "''/mnt/kd/bin/ast-stream-mp3''" file executable: Make the "''/mnt/kd/bin/ast-stream-mp3''" file executable:
  • userdoc/tt_external_moh_source.txt
  • Last modified: 2014/02/19 06:44
  • by abelbeck