Mediatomb – Live Streaming DLNA

Es ist möglich über Mediatomb (DLNA-Server) sunshine-live oder jedes andere Live Streaming Internetradio zu hören.

Mediatomb - Live Streaming DLNA

Dies geht folgendermaßen:

nano /etc/mediatomb/config.xml

In :

In :

audio/L16yesyes441002yes

In /etc/mediatomb/transcode.sh:

#!/bin/bash
display_usage() {

  USAGE="
  Usage:
    mediatomb-transcode -f function_name -i input -o output [function_arguments]

  Generic Options:
   -h, --help                  Display this help message.
   -i, --input                 Input file that is meant to be transcoded.
   -o, --output                Output file that will be read back by MediaTomb.
   -f, --func                  Function to execute from the script.
  "
  echo "${USAGE}"
  echo "Available Functions:"
  FUNCTIONS=($(compgen -A function | grep "^transcode_*"))
  printf " %s\n" "${FUNCTIONS[@]}"
  exit 1

}

transcode_to_pcm() {

  PROG=$(which avconv)
  if [ -z "$PROG" ]; then
    PROG=$(which ffmpeg)
  fi
  if [ -n "$PROG" ]; then
    exec "$PROG" -i "$1" -ac 2 -ar 44100 -y -f s16be "$2"
  fi

}

transcode_playlist_to_pcm() {

  INPUT=$1
  OUT_FILE=/tmp/playlist.tmp
  wget -q -O $OUT_FILE $INPUT
  if [ $? -eq 0 ]; then
    PLAYLIST_TYPE=${FUNC_ARGS["-t"],,}
    case "$PLAYLIST_TYPE" in
      "asx")
        RADIO_URL=$(grep -iE "^([[:space:]]*)'/}
        ;;
      "pls")
        RADIO_URL=$(grep -i "^file.*=" $OUT_FILE | head -n 1)
        RADIO_URL=${RADIO_URL#*=}
        ;;
      "m3u")
        LINE=$(head -n 1 $OUT_FILE)
        if [ "$LINE" == "#EXTM3U" ]; then
          RADIO_URL=$(grep -viE "(^#EXT|^$)" $OUT_FILE | head -n 1)
        else #normal m3u
          RADIO_URL=$LINE
        fi
        ;;
      *)
        echo "Invalid playlist type provided ($PLAYLIST_TYPE)"
        exit 1
        ;;
    esac
    if [ -a $OUT_FILE ]; then
      rm $OUT_FILE
    fi
    if [ "$RADIO_URL" != "" ]; then
      RADIO_URL=$(echo $RADIO_URL | tr -d '\r')
      transcode_to_pcm "$RADIO_URL" "$2"
    fi
  fi
}

declare -A FUNC_ARGS
while [ "$#" -gt "0" ]
do
  case "$1" in
      -f|--func)
        FUNCTION=$2
        shift; shift;
        ;;
      -i|--input)
        INPUT=$2
        shift; shift;
        ;;
      -o|--output)
        OUTPUT=$2
        shift; shift;
        ;;
      -h|--help)
        display_usage
        ;;
      *)
        FUNC_ARGS+=([$1]="$2")
        shift; shift;
        ;;
  esac
done

if [[ "$FUNCTION" != "" && "$INPUT" != "" && "$OUTPUT" != "" ]] ; then
  ${FUNCTION} "$INPUT" "$OUTPUT"
else
  display_usage
fi
chmod +x /etc/mediatomb/transcode.sh
Mediatomb -> Database -> add Item -> External Link (URL)
sunshinelive
http://stream.sunshine-live.de/hq/mp3-128/stream.sunshine-live.de/play.pls

http://listen.housetime.fm/dsl.pls

http://listen.technobase.fm/dsl.pls

http-get

object.item.audioItem.musicTrack

audio/x-stream

Bewerte diesen Artikel

0 Bewertung(en), Durchschnitt: 0 von 5

Dieser Artikel wurde noch nicht bewertet.

Es tut uns leid, dass dir der Beitrag nicht gefallen hat.

Lass uns diesen Artikel überarbeiten.

Erzähle uns, was dir nicht gefallen hat.

Beitrag teilen

Hinterlasse einen Kommentar

  Abonnieren  
Benachrichtige mich bei
Scroll to Top