Connaitre le status d'Airtime (Scheduled, Master, DJ) par l'API live-info (version Airtime: 2.5.1)
  • Bonjour,

    Petit hack permettant de récupérer via l'api "live-info" le status des sources Maitre, Deejay ou Lecture programmée.

    La modification s'effectue dans le fichier airtime/application/controllers/ApiController.php.

    A partir de la ligne 309, remplacer:

    //used by caller to determine if the airtime they are running or widgets in use is out of date.
    $result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION;
    header("Content-Type: application/json");

    par

    //used by caller to determine if the airtime they are running or widgets in use is out of date.
    $result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION;
    //Airtime live status
    $live_dj        = Application_Model_Preference::GetSourceSwitchStatus('live_dj')        ;
    $master_dj      = Application_Model_Preference::GetSourceSwitchStatus('master_dj')      ;
    $scheduled_play = Application_Model_Preference::GetSourceSwitchStatus('scheduled_play') ;
    $result['livedj'] = $live_dj;
    $result['masterdj'] = $master_dj;
    $result['scheduledplay'] = $scheduled_play;
    header("Content-Type: application/json");

    l'appel a l'api live-info retourne maintenant le status dans le json:
    {"env":"production","schedulerTime":"2016-07-11 16:06:00","previous":{"name":"jingle","starts":"2016-07-11 13:59:33.483","ends":"2016-07-11 13:59:43.825","type":"track"},"current":{"name":"Podcast","starts":"2016-07-11 13:59:43.825","ends":"2016-07-11 18:56:34.538","media_item_played":true,"record":0,"type":"track"},"next":{"name":"JingleH2","starts":"2016-07-11 18:56:34.538","ends":"2016-07-11 18:56:44.88","type":"track"},"currentShow":[{"start_timestamp":"2016-07-11 00:00:00","0":"2016-07-10 22:00:00","end_timestamp":"2016-07-12 00:00:00","1":"2016-07-11 22:00:00","name":"PODCASTS","2":"PODCASTS","id":43,"3":43,"instance_id":2538,"4":2538,"record":0,"5":0,"url":"xxxxxxxxxx","6":"xxxxxxxxxx","starts":"2016-07-11 00:00:00","7":"2016-07-10 22:00:00","ends":"2016-07-12 00:00:00","8":"2016-07-11 22:00:00"}],"nextShow":[{"id":43,"instance_id":2549,"name":"PODCASTS","url":"xxxxxxxxxx","start_timestamp":"2016-07-12 00:00:00","end_timestamp":"2016-07-13 00:00:00","starts":"2016-07-12 00:00:00","ends":"2016-07-13 00:00:00","record":0,"type":"show"}],"timezone":"CEST","timezoneOffset":"7200","AIRTIME_API_VERSION":"1.1","livedj":"off","masterdj":"off","scheduledplay":"on"}