A solution for recording without a sound card.
  • A few people have been after this so I'll post it here as well - 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) 
    You will need sox and streamripper installed. 
     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:26:29
  • 9 Comments sorted by
  • Vote Up0Vote Down Albert FRAlbert FR
    Posts: 1,978Member, Airtime Moderator
    It's too simple to be true ;-)
    but it's true !

    "Bravo !"
  • Vote Up0Vote Down hoerichhoerich
    Posts: 627Member, Airtime Moderator
    this sounds so cool, gotta try this the next days...

    does your script contain a split function?
    is this the place to go for?
    $LENGTH -m 600

    Official Airtime Forum Manager
    --------------------------
    Most of the time an issue is located between keyboard and chair.
  • Not sure what you are after here - streamripper can certainly split into multiple files (see the man page for streamripper) but you need to generate a single file so that Airtime can import it afterwards. The $LENGTH variable is the length of the show set by Airtime. 

    If you wanted to break it up you could simply schedule Airtime to record shorter shows - E.g. two half hour shows instead of one full hour.  Does that help?

      
    Post edited by D'man Ddan at 2014-04-19 03:17:32
  • Vote Up0Vote Down hoerichhoerich
    Posts: 627Member, Airtime Moderator

    If you wanted to break it up you could simply schedule Airtime to record shorter shows - E.g. two half hour shows instead of one full hour.  Does that help?


    thx for your reply! I am not sure if it helps ;-)
    While looking at your code I was asking myself, is this code splitting the recorded files hourly or daily?

    I am looking for a way to record and split hourly or 4-hourly.
    Or for a way to record per show according to Airtime Calendar.

    cheers

    Official Airtime Forum Manager
    --------------------------
    Most of the time an issue is located between keyboard and chair.
  • This solution is for recording according to the Airtime Calendar - the length is set by Airtime.  You just set up the show to record, and then it will appear in the library when it is done.   The difference is that it records from a stream rather than the sound card.  

    I've attached a slightly updated version of the script.
    Post edited by D'man Ddan at 2014-04-22 18:04:28
  • Well ,I think my solution fall on deaf ears.

    I post long ago how to record in this forum the easy way,This is how I do it and it can be fully customizable.


    These ways require too much skills

    Here it is again http://forum.sourcefabric.org/discussion/15915/record-output-to-a-file-every-xx-time-from-airtime-output-or-input-alsamicand-icecast-how-to

    I update this to include just from the Airtime Output

    Good Luck
    VOISSES

    Post edited by Voisses Tech at 2014-04-22 19:17:02
    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.
  • Vote Up0Vote Down hoerichhoerich
    Posts: 627Member, Airtime Moderator
    This solution is for recording according to the Airtime Calendar - the length is set by Airtime.  You just set up the show to record, and then it will appear in the library when it is done.   The difference is that it records from a stream rather than the sound card.  

    I've attached a slightly updated version of the script.


    thx, now I got it! its great!!
    Official Airtime Forum Manager
    --------------------------
    Most of the time an issue is located between keyboard and chair.
  • In case any of you still have this need I've created a simple web application for automating the recording of live Airtime Pro broadcasts.

    I'd be eager to hear any thoughts/feedback.
  • Hello, our modification to recorder.py doesn't seem to work. I don't think the show length variable is being passed through to the bash script. Getting this in the error log for recorder.log

    2017-11-28 20:00:00,021 INFO - [recorder.py : record_show() : line 98] - starting record
    2017-11-28 20:00:00,022 INFO - [recorder.py : record_show() : line 99] - command /usr/local/bin/ripstream.sh http://local$
    2017-11-28 20:00:31,550 INFO - [recorder.py : record_show() : line 111] - finishing record, return code 0
    2017-11-28 20:00:31,550 INFO - [recorder.py : run() : line 173] - Preparing to upload /var/tmp/airtime/show-recorder/2017$
    2017-11-28 20:00:31,550 INFO - [recorder.py : set_metadata_and_save() : line 150] - time: 20:00:00
    2017-11-28 20:00:31,614 ERROR - [recorder.py : set_metadata_and_save() : line 164] - Exception: [Errno 2] No such file or$
    2017-11-28 20:00:31,614 ERROR - [recorder.py : set_metadata_and_save() : line 165] - traceback: Traceback (most recent ca$
      File "/usr/lib/airtime/pypo/bin/recorder.py", line 153, in set_metadata_and_save
        recorded_file           = mutagen.File(filepath, easy = True)
      File "/usr/lib/airtime/airtime_virtualenv/local/lib/python2.7/site-packages/mutagen/__init__.py", line 202, in File
        fileobj = open(filename, "rb")
    IOError: [Errno 2] No such file or directory: '/var/tmp/airtime/show-recorder/2017-11-28-20:00:00.ogg'