× Warning! This forum is in archival status. New contributions may not work.
Scheduled recording of web streams
  • Vote Up0Vote Down Micz FlorMicz Flor
    Posts: 184Administrator
    I just posted on our blog about a little script to schedule stream recordings. This is not really a direct Airtime hack, but I felt like sharing it here.

  • 4 Comments sorted by
  • Here is a simple method to do a recording every hour (Airtime hack)

    go to line 401 and place the following [of course you need to define your own file path and parameters)

    # The output file
    # to be saved with parameters date and time
    # make sure you have permission to the file path
    filename = "path-to-file/recording-%Y-%m-%d-%H-%M-%S.mp3"



    #with a newfile each time its open [append] and open that file every xxx time [reopen_when]
    #{0m0s} is every hour
    output.file(%mp3,
                      filename,
                            fallible=true,
                                 append=true,
                                    reopen_when={0m0s},
                                          on_stop=shutdown,
                                          
                                                         s)


    Now go to your watch folder and place the pathtofile as a folder to watch,you will see all your recording.
    schedule away.

    You can use a switch to tell it when you want it to play.

    My previous post about this is here http://forum.sourcefabric.org/discussion/15915/record-output-to-a-file-every-hour-from-input-alsamicand-icecast-how-to/p1.
     and this cover from line in

    This is especially useful for stations  who want to archive there show daily.
    I found this to be more reliable than sox,ffmpeg,vlc etc.
    you need about 40mb-120mb per hour of disk space






    Post edited by Voisses Tech at 2014-02-12 21:17:03
    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

    Here is a simple method to do a recording every hour (Airtime hack)

    go to line 401 and place the following [of course you need to define your own file path and parameters)



    these changes have to be made in ls_script.liq?
    Official Airtime Forum Manager
    --------------------------
    Most of the time an issue is located between keyboard and chair.
  • Yes !
     but here is my easy tip
     
    You can set up  your own includes file and whenever you upgrade just place that line at line 401. like this

    "% include /mypath/mymod.liq"

    one line as a post activity for upgrade

    So if you want to debug  just comment it out #"% include /mypath/mymod.liq"



    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.
  • This is a hack, but I wanted to control the size of the recording file.  My initial purpose was to maximize what I could burn on a CD and play in the car.  Thank you to Micz Flor.

    Let's call the shell "stream.rip"

    #!/bin/ksh

    URL=$1
    STATION=$2
    MAX=$3

    cvlc $URL --sout file/mp3:$STATION.mp3 2>/dev/null &

    sleep 120

    while (true)
    do
            SIZE=`ls -lh $STATION.mp3 | cut -d " " -f 5 | cut -d M -f 1`

            if [[ $SIZE -ge $MAX ]]
            then
                    killall -v vlc

                    exit 0
            fi

            sleep 60
    done

    It may be scheduled by

        at <time-spec> -f <file>

    where file is

        ksh stream.rip <url> <stream-name> <length-in-MiB>