Airtime live-info API Updates
  • The airtime live-info API is a bit of a jumble currently, so I wanted to ask on here and see who's using some of the features we're looking to update.

    During the transition process live-info will still be available in its current state, and the updates will be available for use as live-info-v2.

    The new model will look something like this:

    {
    "station": {
    "env": "",
    "schedulerTime": "",
    "timezone": "",
    "AIRTIME_API_VERSION": ""
    },
    "tracks": {
    "previous": null,
    "current": {
    "name": "",
    "starts": "",
    "ends": ""
    }
    "next": null
    },
    "shows": {
    "previous": [],
    "current": {
    "name": "",
    "description": "",
    "id": ,
    "instance_id": ,
    "instance_description": ,
    "record": ,
    "url": "",
    "image_path": "",
    "starts": "",
    "ends": ""
    },
    "next": [

    ]
    }
    }

    The new model will also accept different parameters, specifically "days" (how many days into the future you want to fetch shows from - defaults to 2, today and tomorrow), "shows" (how many shows to fetch - defaults to 5), and "timezone" (the timezone to get the times in - defaults to the station time).

    Since this is a significant shift from the current object model being passed, let me know of any conflicts or additional parameters that you would like to see in the new model so that it can be developed to suit everyone's current needs.

    The current week-info call will also use the "timezone" parameter.
  • 22 Comments sorted by
  • Add Show Genre please - I export that and use it - as well as everything on your list.
    I would like to see it paired with the NEXT show (not track) which I guess it is.
    Why would you need show description and show instance description? I don't understand that.
    I already implemented most of this myself
    Here
    Post edited by John Chewter at 2014-09-25 11:13:05
    No longer using Airtime or Libretime.
  • Show genre is a good one, I'll add that in now. Instance description is for repeating shows - if you have a weekly show then the show description can be generic and the instance description can cover any additional information you want to display for that week specifically, such as guests on a weekly talk show etc.
  • It would be cool if - when you change a show title.. it did not wipe the content (and leave database wreckage)

    No longer using Airtime or Libretime.
  • Vote Up0Vote Down Daniel JamesDaniel James
    Posts: 844Member, Sourcefabric Team
    Hi Duncan, I would suggest using image_url rather than image_path if you are thinking of using this for show artwork or slides, as the API client widget may be on a third-party site with no direct access to the Airtime filesystem.

    Another thing which has been requested is to indicate whether the show is live, was pre-recorded, or contains repeated content - and if it is a repeat, the date of the original broadcast. Airtime can accommodate a mixture of formats within a show, of course, so this might be based on a flag that the user would set when creating the show.

    You might also like to include stream URLs and format details within the live API, so that widgets only need to follow one API in order to generate a complete player/schedule application. At the moment, I don't know of any auto-discovery of Airtime streams, other than screen-scraping the Icecast admin interface, so I believe each player widget has to be hard-coded. Obviously, that is inflexible if stream mount points or formats change.

    Cheers!

    Daniel
  • Cool - thanks for the feedback! The image_path actually points to another API call which provides the image from the file-system - maybe you're right that the name is somewhat ambiguous.

    The record field is a binary check as to whether the show has been recorded or is live (1 = recorded, 0 = live). I'll keep the repeated content flag in mind, although I don't think that it will make it into the initial release of the v2 API.

    There are plans in the works for a separate API for station-specific metadata, which will include the stream URL and other station-specific information. It will be two API calls rather than just one, but allows for more structured separation of concerns. The "station" subobject in live-info-v2 will be for dynamic station info (AIRTIME_API_VERSION is something we're looking at deprecating), while the new API will give you static station information, so that it only needs to be called once (which will provide a flexible context that is reasserted on page/content load).

    What's the use-case for the stream format details?
  • Vote Up0Vote Down Daniel JamesDaniel James
    Posts: 844Member, Sourcefabric Team
    Hi Duncan, I think the current record flag only indicates that the show is scheduled to be recorded from the soundcard line-in, not whether the show contains pre-recorded content. Airtime itself has no way of knowing the latter, as even a 'live' input stream could be based on a pre-recorded source.

    The use case for stream details in the API is that many people struggle to set up their widgets correctly, and this is made more complicated by the fact that stream parameters can be changed very easily from within Airtime's interface, which can break a static player widget configuration on a remote site. For example, renaming a mount point or switching the codec.

    So by making all necessary stream details discoverable, the user only needs to know the URL of their Airtime instance, and the widget code can take care of the rest. This would also make it easier to auto-generate player widgets for Airtime Pro. I'll attach a screenshot of a combined player/schedule widget from BBC Radio.

    Cheers!

    Daniel
  • You're absolutely right about the record field. Recording is definitely an area that hasn't gotten enough attention in Airtime, so it's something we can look at going forward.

    A better widget implementation is something we've been looking at and working towards - what we're currently providing isn't enough for anyone, and we want to reduce the amount that a user needs to provide and customize and just have their player work out of the box.

    While the new API's are a step towards that, there's still work to be done on building a plug-and-play widget for Airtime. By releasing these API's now, we can hopefully tailor them a bit for when we reach that stage.
  • The station operator knows if the show is prerecoded. How about it being user selectable in the Show setup? In the content tracks, it would be useless to me.

    Post edited by John Chewter at 2014-09-25 14:07:53
    No longer using Airtime or Libretime.
  • Widgets to use the API. We users really need Joomla, Wordpress, iFrame and, I guess, NewsScoop widgets.
    I am happy to make some Joomla ones, for common use..
    Likewise working low-latency players.
    Post edited by John Chewter at 2014-09-25 14:23:26
    No longer using Airtime or Libretime.
  • These are all considerations that will be made as we put together a proper specification for better widgets in Airtime. Some of them might be handled outside of the scope of the dashboard (ie. wiki or blog posts on inserting an Airtime widget into your Wordpress site).

    As for the pre-recording feature, I'll keep it in mind.

    If you're keen to make working widgets that can be easily tailored for Airtime instances, that would be awesome :).
  • Some of us in here are full-blown devs. We are surprised we don't get used - apart from bug finding. There are Joomla, Wordpress, LiquidSoap, Bash, Python, PHP etc people in here that I am sure would help out on the Non-Pro side of things. Is that not what open source is all about? If the work was shared around it would all happen faster?
    No longer using Airtime or Libretime.
  • I'm the new guy, so I don't really have a say in what ends up as part of the codebase - fork the repository and make a pull request is all I can say on that one :S.
  • We do. Lots of us. What a lot of wasted duplicated effort. I am talking about things like external widgets, dedicated radio players - not part of the Pro codebase. The things you guys don't have time to do and do not care about. The 'not invented here attitude' is holding things back for us. But, I have noted your attitude. It is inline with what we have seen. Yes, lets have dozens of official and many more Git-Rips and duplicate the work over and over again. Its what we have been doing anyway. Good plan. My offer is withdrawn.
    Post edited by John Chewter at 2014-09-25 17:26:58
    No longer using Airtime or Libretime.
  • It wasn't my intention to come off as standoffish or uncaring when it comes to the community - sorry if that's how it came across.

    Unfortunately, there are a lot of checks and balances to be considered any time code needs to be added to Airtime - open source is absolutely about collaboration, but it works through meticulous use of version control, which needs to be filtered.

    I wholly understand that there's a lot of awesome content being generated by the community, but as far as I can see from looking at the Airtime github repository, people aren't using pull requests to coordinate their changes.

    Feel free to shoot me a PM and we can discuss these ideas in more detail.
  • Your PM code is falling over with an Exception Fault (latest Firefox). I am john_chewter on skype.
    Post edited by John Chewter at 2014-09-26 05:22:22
    No longer using Airtime or Libretime.
  • Vote Up0Vote Down hoerichhoerich
    Posts: 627Member, Airtime Moderator
    +1 for genre
    +1 for your good start, duncan!
    welcome to sofab-family!
    Official Airtime Forum Manager
    --------------------------
    Most of the time an issue is located between keyboard and chair.
  • Any update on this.

    Also I have problem parsing this through python or php. Anybody have a simple decode Python or PHP script can do this.

    This Json is the most complicated I have seen


    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 Albert SantoniAlbert Santoni
    Posts: 68Member, Sourcefabric Team, Airtime Moderator
    Hi Voisses,

    We're evaluating including this new v2 live-info API in our next bugfix release ("coming soon"). The changes are fairly minor, and we would keep the old API too for backwards compatibility. I hope to have more to say about this in coming weeks. As soon as we know for certain, we'll give an update on the next release date.

    Thanks,
    Albert
    Airtime Developer @ Sourcefabric
  • Cannot come too soon.

    I happen to however whip this up overnight from my script in the tunein api
    and the results is this


    {
                         "comment": "",
                         "album": "This Gift of Life",
                         "filename": "/var/www/radio/music/gospel/Hopeton Lewis/Miscellaneous_albums/03 This gift of life.mp3",
                         "status": "playing", "year": "0", "liq_cue_out": "250.", "source": "gospel",
                         "initial_uri": "annotate:liq_cue_in=\"5.\",liq_cue_out=\"250.\":/var/www/radio/music/gospel/Hopeton Lewis/Miscellaneou
                         "liq_cue_in": "5.", "on_air": "2014/10/28 07:37:49", "rid": "34",
                         "kind": "{audio=2;video=0;midi=0}", "track": "3",
                         "artist": " Hopeton Lewis ", "decoder": "MAD", "temporary": "false",
                         "title": " This gift of life"
                        }


    This is a plus for me as i want a simple json array which can easily parse by php or python.

    I hope the V2 will include method to extract simple json array rather than the multidimensional arrary proposal.

    Attached is the full console input

    VOISSES
    Post edited by Voisses Tech at 2014-10-28 08:34:09
    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.
  • The current state of the live-info-v2 API is available in the 2.5.x branch on github: https://github.com/sourcefabric/Airtime/tree/2.5.x.

    There's also a wiki article describing basic behaviour and format for both the old live-info and the new v2 APIs.

    I think the specificity of that JSON is a bit much for live-info, but it would definitely make for a good stand-alone call. I'll keep that in mind going forward.
  • Vote Up0Vote Down hoerichhoerich
    Posts: 627Member, Airtime Moderator

    You're absolutely right about the record field. Recording is definitely an area that hasn't gotten enough attention in Airtime, so it's something we can look at going forward.


    please don't give the recording feature more attention.
    imho, as long as the recorded audio is not broadcasted simultanously, this feature is more than useless for self-hosted airtime-server-users, and it's even more useless for pro-users...
    expand it to a "record-per-show" function (request on bugtracker available since years) or dump the feature completely.

    I presented Airtime to 5 terrestrial community radio stations.
    For all of them the recording feature sounded so promising, but it does not work as anyone expected. the way it works gathers a lot of disapproval. no station would have a possible application for this feature. and these are all persons working for decades with radio stations...
    Official Airtime Forum Manager
    --------------------------
    Most of the time an issue is located between keyboard and chair.
  • Vote Up0Vote Down Daniel JamesDaniel James
    Posts: 844Member, Sourcefabric Team
    Hi Hoerich, this is easily done by modifying the recorder to capture the stream output instead of the soundcard input. See https://forum.sourcefabric.org/discussion/16477/a-solution-for-recording-without-a-sound-card-

    Cheers!

    Daniel