record broadcasts without a soundcard?
  • i would like to have show broadcasts recorded, but this is for a headless server with icecast-only broadcast.
    i realize i could put in a record hook into the icecast.xml, but that is invisible to airtime.
    meanwhile, it seems that the rebroadcast feature is only available for people who have recording from a soundcard?
    why couldn't this be done as a liquidsoap flow that Airtime is aware of, and can rebroadcast from?


  • 10 Comments sorted by
  • Vote Up0Vote Down hoerichhoerich
    Posts: 627Member, Airtime Moderator
    Post edited by hoerich at 2014-02-16 03:55:25
    Official Airtime Forum Manager
    --------------------------
    Most of the time an issue is located between keyboard and chair.
  • Unfortunately that script does what i said doesn't help me: it requires ALSA input, and the file name is unrelated to any knowledge of the name or timing of the broadcast schedule, and it doesn't enable the airttime rebroadcast feature to be used.

  • just blindly recording icecast streams isn't what i'm looking for. i can already do that.

  • Vote Up0Vote Down hoerichhoerich
    Posts: 627Member, Airtime Moderator
    with a few changes, voisses' ls_hack should also be suitable for your needs.
    just forget the studioinput and just go with output_file
    Official Airtime Forum Manager
    --------------------------
    Most of the time an issue is located between keyboard and chair.
  • @hoerich and @mark anderson
    That hack is found here http://forum.sourcefabric.org/discussion/16372/scheduled-recording-of-web-streams

    but I guess I read it a little wrong so I will make the correction for webstream or external downloads
    The way I saw it was playing out the streams and recording it.

    Note that the above hack will record everything that comes out of airtime (whether or not you modified you script). and before it goes to icecast so you can chose to recorded it lossless (ogg) or wav (you need an header interpreter for this)

    If @ Mark Anderson is referring to after the stream leaves  icecast then just use one of mm @ Micz Flor
    suggestion here

    http://www.sourcefabric.org/en/community/blog/2076/Schedule-stream-recordings-from-the-command-line-Part-1.htm

    http://www.sourcefabric.org/en/community/blog/2077/Schedule-stream-recordings-from-the-command-line-Part-2.htm

    I will post three alternatives soon using
    1. php
    2. Curl
    3. and Php

    all encompass in liquidsoap which is a little early.

    I am now testing the tuneinapi ( I modified ,just got  my keys from TuneIn) that also will give you the ability to  retreive the now plaining in XML ( a script I stole from @ Micz Flor,he does not mind @-) ) and  nowplaying in a web browser hope He does not mind @-)

    Tips.

    Reduce the stress to rewrite or scared to modify the script

    1. Place any your script in your own location
    2. Link the location to Airtime
    3. include your script in The ls_script using the "% include" syntax

    The next time you upgrade airtime just put the "% include" syntax in ls_script and you are good to go

    Post edited by Voisses Tech at 2014-02-17 11:14:04
    Anyone reading this a find it funny about my grammar , I make no apology ,Go get a translator.
    "The Problem with education today is that it takes a university degree to switch on a light bulb"
    "You learn from your mistakes but wise people learn from others mistakes avoid Making mistakes there is not sufficient rooms to make them"
    "Innuendo","If's","Assumptions" and "Fear" are for politician.Who,What,where,When and How are for those seeking knowledge and care about Humanity.
    "I might be in Mud but that does not Make me a Wild Hog(pig)"
    “Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius — and a lot of courage to move in the opposite direction.”
    "The only thing that remains constant is change itself"
    May the force be with you,until our path or destiny bring us in tandem.
  • Actually either streamripper or hooking into icecast.xml work ok for me.

    But recording a stream isn't the challenge. It is just that as far as I can see, the rebroadcast feature of Airtime is only available if its own recording feature is used, and that feature is oddly limited to hardware line in.


  • Vote Up0Vote Down Albert FRAlbert FR
    Posts: 1,978Member, Airtime Moderator
    exactly, that why this feature is asked for the next versions ;-)
    cf. http://dev.sourcefabric.org/
  • For those interested we enabled the recording of streams by modifying the script

    /usr/lib/airtime/pypo/bin/recorder.py

    changed the line:
    command = "ecasound......

    to point to our own script:
    command = "/usr/local/bin/ripstream.sh http://localhost:8000/airtime.ogg %s %s" % (length,filepath)

    ripstream.sh:

    #!/bin/bash

    # Check for command-line arg.
    ARGCOUNT=3
    E_WRONGARGS=65
    if [ $# -ne "$ARGCOUNT" ]
    then
    echo "Usage: `basename $0` stream length outfile"
    exit $E_WRONGARGS
    fi


    STREAM=$1
    LENGTH=$2
    OUTFILE=$3
    STREAMCMD="streamripper $STREAM -s -A -a %d.ogg -l $LENGTH -m 600 --quiet 2>&1 | tail -1 | awk '{print $1}'"
    TIME=$(date +%Y-%m-%d_%H%M)


    #create a temp folder to put the capture files in
    TMPFOLDER="/var/tmp/airtime/rips/streamipper-$TIME"
    if [ ! -d "TMPFOLDER" ]; then
    mkdir -p $TMPFOLDER
    fi


    #Record the stream with streamripper. It is possible the stream is not available in which case streamripper
    #will giveup. So try a few times... streamripper http://host:8000/stream.ogg -s -A -a %d.ogg -l 22000 -m 600

    nTrys=0
    maxTrys=5
    status="error"
    until [[ "$status" != error* ]] ; do
    echo "recording with command: streamripper $STREAM -s -A -a $TMPFOLDER/%d.ogg -l $LENGTH -m 600 --quiet"
    status=$(streamripper $STREAM -s -A -a $TMPFOLDER/%d.ogg -l $LENGTH -m 600 --quiet 2>&1 | grep error)
    nTrys=$(($nTrys + 1))
    if [ $nTrys -gt $maxTrys ] ; then
    echo "Number of re-trys exceeded. Quitting"
    exit
    fi
    if [[ "$status" == error* ]] ; then
    echo "$status retry $nTrys"
    sleep 5
    fi
    done

    #At this point we have one or more files in the XXX folder which we need to merge with sox
    /usr/bin/sox $TMPFOLDER/*.ogg $OUTFILE
    echo "merging files with command: /usr/bin/sox $TMPFOLDER/*.ogg $OUTFILE"


    # then we should be done!
    # you may want to delete something
    #rm $TMPFOLDER/*.ogg
    #rmdir $TMPFOLDER



    Post edited by D'man Ddan at 2014-03-21 00:09:26
  • ...  you need to have sox and streamripper installed.  Both available in most distributions.