Send only metadata to remote icecast (or shoutcast) server when usind soundcard as only output
  • Greetings!

    I looked around for a solution but couldn't find
    anything so if it has already been answered please accept my apologies
    and kindly point to the right direction.....

    I am trying to use Airtime with only the soundcard as output..... i.e. no streaming to a server.......

    The audio output will then be fed to another machine which will do the encoding and streaming......


    Is there anyway that Airtime can send just the metadata to the remote icecast server, for example by invoking something like:

    //server:port/admin.cgi?pass=yourAdminPassword&mode
    =updinfo&song=(current songtitle)  ....?


    Thanks for your time.

    >cheers for the devs for this great piece of software
    Post edited by don takis at 2013-09-29 22:02:17
  • 16 Comments sorted by
  • Vote Up0Vote Down hoerichhoerich
    Posts: 627Member, Airtime Moderator
    Hi there,
    I'm also interested in a way to do this.

    But afaik metadata are contained in stream itself.
    So I doubt this can be done without streaming at least with 48kbps.

    But I hope I am wrong. ;-)

    cheers
    Official Airtime Forum Manager
    --------------------------
    Most of the time an issue is located between keyboard and chair.
  • @hoerich: The metadata (track info) is inside the track file....when liquidsoap streams it it reads the info.... it could then perform an http post to send the metadata to the server


    Looking more into it, I found that Liquidsoap has a scripting language.
    There is on_track function that calls a given handler on new tracks, and http.post function that, I assume, can be used to post the metadata with //server:port/admin.cgi?pass=yourAdminPassword&mode
    =updinfo&song=(current songtitle).

    there is also icy.update_metadata that can send metadata to an icecast server
    I am unsure on how to use these in a script though.....
    Post edited by don takis at 2013-10-03 09:10:21
  • I have found interesting code snippets in Liquidsoap's website.

    # This function is called when
    # a new metadata block is passed in
    # the stream.
    def apply_metadata(m) =
    title = m["title"]
    artist = m["artist"]
    print("Now playing: #{title} by #{artist}")
    end

    s = on_metadata(apply_metadata,s)

    and also this

    def icy_update(v) =
    # Parse the argument
    l = string.split(separator=",",v)
    def split(l,v) =
    v = string.split(separator="=",v)
    if list.length(v) >= 2 then
    list.append(l,[(list.nth(v,0),list.nth(v,1))])
    else
    l
    end
    end
    meta = list.fold(split,[],l)

    # Update metadata
    icy.update_metadata(mount="/mystream",password="hackme",
    host="myserver.net",meta)
    "Done !"
    end


    I am unsure though how to combine them and where to put them.

    Any ideas?
  • [-X

    Scenario

    Mixer = some Equipment
    Encoder= BUTT,IDJC,M3W,Nicecast,Edcast,SamCast,Drs2006,RadioBoss etc
    Streamer= Icecast/Shoutcast


    If You are using the Airtime output to a mixer (You Lost The Metatags Here)  then from the mixer to an encoder then to Streaming(Icecast/Shoutcast) you would have to set a manual meta tag- ) at the encoder.

    This is why you see some stations have something like the "Music/Arts/Entertainment " or "DJ Blah Blah Live"

    If you are doing Airtime Output to Encoder to Streamer then whatever you put in Airtime will come out the other end to Streamer.

    Notice the Function is used" when a new Meta Block is called to the stream"

    So "s" would have to be and source different from Airtime

    But "Isn't Icy a shoutcast protocol?" I might be wrong as I now stay far from shoutcast as a streamer.It is a pain in the A**.

    V.O.I.S.S.E.S
    Can You hear me Now
    Post edited by Voisses Tech at 2013-10-04 11:27:27
    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.
  • Do This Instead

    Set one of your stream in Airtime Stream settings and put the remote server credentials in that stream and bam you are on your way.

    no unnecessary modification or coding

    If You want Multiple Bitrates and Mount Points and you have used up all the slots in Airtime Stream settings,then Icecast is the thing for that

    • Just create Multiple Instances and Mount points in Icecast

    • Relay to Shoutcast by changing your Alaises (shoutcast stupid to not want this)


    V.O.I.S.S.E.S
    Can You Hear Me Now
    Post edited by Voisses Tech at 2013-10-04 08:51:19
    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.
  • Just a note my friends over at Icecast is suggesting that the protocols for Icecast V2 is http and therefore you might have stability issues with this.

    I will run it through liquidsoap this weekend,but because I see your problem as one which can easily solve I put a 
    [-X  to it

    Here is what I used to do

    I have a remote server in the UK which I use sent my stream to so it was
      Airtime ==> UK server==>clients. 

    I never like this scenario for a number of reason.one in particular was the fact they use Shoutcast Server and I wanted to use Icecast for many reason its backup and introfile,security,failover,mount points,relaying etc.

    So I do this.

    I setup a dedicate local Icecast server (with backup and introfile).This allows me to pull down my airtime anytime,upgrades etc without disconnecting anyone.

    I then change the Aliases in Icecast and relay it to the shoutcast server.(you lose the status page directly but anytime anyone try to come to that page you have the music playing)

    Airtime ==> Local Server ==>Remote Server==>Clients

    to see your status page you would have to type


    Use Xbuntu to set up a lite server (local Server), You can even set up a raw installation of liquidsoap on it and do your script testing there
    V.O.I.S.S.E.S
    Can You Hear Me Now




    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
    digging out this topic... I want to implace the function icy.update_metadata in ls_script.liq

    has anybody had success with this?

    the reason why I can only use soundcard-output and cannot turn on icecast-output is an issue with soundcard-buffering.
    as soon as I enable icecast-output-streaming, the signal gets cut-offs every 10 to 60 secs.
    and this is an unacceptable behaviour, which I was not able yet to solve with setting buffering options.

    So, for me it looks easier to implement icy.update_metadata instead of fixing buffer issues.
    Official Airtime Forum Manager
    --------------------------
    Most of the time an issue is located between keyboard and chair.
  • Yes I have solutions for this
    Things you need

    Method

    1. your artist and title needs to come from the source and will more than like be outputted too a text file.
    Like in the case of

    mixmeister the output is in a vertical form - where the separator here is a carriage return
    Title:
    Airtist:
    Album:


    What Love Got to Do with it
    Tina Turner
    Private Dancer

    or

    In the case of most other source its Horizontal (note some source like butt ,you can input this method manually) - where the seperator here is an "-"

    Title - Artist - Album

    What Love Gotta do with it - Tina Turner - Private Dancer

    You can pull this into your ls script using split.replace or use php to push it straight to Ice-Cast/Shoutcast

    Or

    Method
    2. if your source can generate a url that will have the stream information for artist,title,or album

    Here is why you have that problem of Icy-Meta as describe in the tutorial,once you pull anything into liquidsoap,the data must be prepared or queued at hand and ready whenever liquidsoap makes the call.
    Using the Icy- meta is that you are using the liquidsoap internal web-server and therefore it gives you that little extra buffer,and depending on your machine,if you tail the logs you will see a "we must catchup" msg

    This is true that if no data is input liqudsoap will literally stop (some people say crash but thats not the case) and halt.

    I have the proof of concept

    1.Ls solution - as long as you have data available (works 100%,I have not tinker again to fixed the no data aspect)
    2.The Icecast solution using a dummy webstream like if you have a url
    3.If a url is generated by the source.
    4.pushing the information straight to icecast (this is just a mod of radiodj tunein script)

    so let me know how your source handles and output metadata and I will pm or post a solution here  for you

    Voisses








    Post edited by Voisses Tech at 2015-01-19 08:00:56
    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.
  • Ok Just a correction here

    If you are using this http://savonet.sourceforge.net/doc-svn/harbor_http.html,then definitely you are using the web server and  that is the one I referred to


    but if you are using this

    http://savonet.sourceforge.net/doc-svn/icy_metadata.html

    then your source need to be pushing out a url as describe in this line

    "When using the ICY metadata update mechanism, new metadata are submitted separately from the stream's data, via a http GET request. "

    Then there are 2 output url streams involved.

    1.from source output
    2.your regular output

    note that most source outputs are usually in text format and not url so to use url you might have to use php argvc to generate that souce output url

    VOISSES





    Post edited by Voisses Tech at 2015-01-19 08:20:21
    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.
  • So My offer not valid so lets put this topic to a natural rest.

    Some people suggest that you use http://savonet.sourceforge.net/doc-svn/icy_metadata.html  as per @don_takis above

    You do not need this there are many php scripts out there to update icecast metadata just google the terms highlighted also if you chose this method you will have to use telnet to send the metadata liquidsoap -h icy.update_metadata lists all the arguments to be used via telnet or write a script to push information to the icy metadata.

    So here is the solution

    • Its just the fundamentals ,you need to expand
    • This will assume you have a static metadata and you need to have a script which calls the data from your external source say every 10s or whatever
    • In this case I am using a text file,this text file must exists and liquidsoap must have read access to it
    • So Go ahead create a text with just the information of title - artist - album
    • notice my separator pattern is " - " .Most software have export format for metadata

    VOISSES
    Post edited by Voisses Tech at 2015-01-22 00:50:38
    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.
  • #Now the basics of updating metadata

    # A function applied to each metadata chunk
    # This function is covered here http://savonet.sourceforge.net/doc-svn/scripts/append_title.liq
    # but lets modify it a little
    # we will Assume s=(...............)

    def append_title(m) =
     

      # Parse what ever new data we want
        new_title = "my station.com"

       # Grab the current title
        title = m["title"]

      # Return a new append title metadata
        #[("title","#{title} - #{new_title} ")]
       
        # or just the New title
       
        print ("#{title}") #print the old title but output the new title
        [("title"," #{new_title} ")]
       
     
     
    end

    #Â Apply map_metadata to s using append_title
    #map_metadata by default is to update the metadata with the returned values
    s = map_metadata(append_title, s)

    #If you use this script as is putting it about line 283 of ls_script,you will now see your title
    # of the song being played becomes my station.com
    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.
  • So lets grab the metadata from our text file ,I will use a simple scripting language called cat,but you can use any other language,python,php,curl,bash or what ever you like and here is how we parse the information

    ########  This is Parsing The Data  ######################################
    # Getting the meta data from an external file

      content = list.hd(get_process_lines("cat /path/to/externalmeta.txt")) #put any scripting language here

      param = string.split(separator="-",content)
     
      new_title = list.nth(param,0)

      #to put the artist and title together
      #new_title = list.nth(param,0)^"-" list.nth(param,1)

      #Here are other options
      #new_artist =  list.nth(param,1)
      #new_album = list.nth(param,2)
     
       #Uncomm to see what is the New metadata
       #print ("#{content}")
       #print ("#{new_artist}")
       #print ("#{new_title}")
        #print ("#{new_album}")



    #############################################################

    # my text file will simple have in there title - artist - album
    #  Man in the Mirror - Micheal Jackson - Bad

    # and Now our script will be

    Post edited by Voisses Tech at 2015-01-22 00:53: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.
  • # A function applied to each metadata chunk
    # This function is covered here http://savonet.sourceforge.net/doc-svn/scripts/append_title.liq
    # but lets modify it a little
    # we will Assume s=(...............)

    def append_title(m) =
     

      # Parse what ever new data we want
        #new_title = "my station.com"

    #############*****New Line******########################
      # Getting the meta data from an external file

      content = list.hd(get_process_lines("cat /path/to/externalmeta.txt")) #your language of choice

      param = string.split(separator="-",content)
     
      new_title = list.nth(param,0)

      #to put the artist and title together
      #new_title = list.nth(param,0)^"-" list.nth(param,1)

      #Here are other options
      #new_artist =  list.nth(param,1)
      #new_album = list.nth(param,2)
     
       #Uncomm to see what is the New metadata
       #print ("#{content}")
       #print ("#{new_artist}")
       #print ("#{new_title}")
        #print ("#{new_album}")

    #######################################################

       # Grab the current title
        title = m["title"]

      # Return a new append title metadata
        #[("title","#{title} - #{new_title} ")]
        
        # or just the New title
        
        print ("#{title}") #print the old title but output the new title
        [("title"," #{new_title} ")]
        
     
     
    end

    #Â Apply map_metadata to s using append_title
    #map_metadata by default is to update the metadata with the returned values
    s = map_metadata(append_title, s)

    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.
  • As I said this is just the fundamentals and your imagination can go wild,just look at how radio nova pull theirs from a web page at http://savonet.sourceforge.net/doc-svn/radio-nova.html and also remember you can use the annotate protocol


    VOISSES
    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.
  • My previous explanation "when I was a rookie" seems to explained where the metadata data is already in the

    stream output .

    My new explanation is for where you use a sound input

    remember also you can do a rewrite of the metadata.

    So I should point out there are basically

    • Rewrite the metadata  (can be static or dynamically)
    • using the embedded data already in alive stream
    • updating the metadata

    The tune-in app I wrote is basically a push http-get so I will test this weekend if it can modified to send data to icecast directly


    vOISSES


    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 AndyAndy
    Posts: 42Member
    Hello, i have Question to liquidsoap

    I have a playlist an i have a input Stream with input.harbor.

    How can i make it when live input.harbor complete overwrite metadata from output to icecast?
    Genre and Discrition i must have from input.harbor write to output.
    Here is my code example.

    #!/usr/bin/liquidsoap -vvv
    set("log.file",false)
    set("log.stdout",true)
    set("log.level",3)
    set("server.telnet",true)

    #Playlist
    songs = (mksafe(playlist("/home/ralf/play.txt")))

    #Jingles
    jingles = (mksafe(playlist("/home/ralf/play.txt")))

    #security = single("/home/ralf/default.mp3")

    #radio = songs

    s = random(weights = [1, 4],[jingles, songs])

    live = input.harbor("live3",port=8080,password="hackme")
    s = fallback(track_sensitive=false,
                     [live,s])


    output.icecast(%mp3,
    mount="/live",
    host="192.168.10.100",
    port=8000,
    genre="xxxx",
    name="***",
    description="****",
    user="source",
    password="xxxx",
    s)