The PlayIt Software Users Facebook group provides a much faster response to questions. Please consider joining.
Start a new topic

Plugin API

I have recently been looking into plugin scripts on playIt Live and wondered if you could help me with a couple of questions I can't find the answer to:


App.LiveAssistMode.QueueTrack(track);


Is there any way to control where the track is inserted using this or a similar command? It appears to always insert after the last thing scheduled for the day. (ie if it's 13:00, there is nothing scheduled at 14:00 but there is something scheduled at 16:00 it will schedule the track after what's scheduled at 16:00).

  

TrackQueueItem[] queueItems = App.LiveAssistMode.GetQueueItems();

  

Similarly is there any effective way to get the current location using the above command. I have achieved this by iterating through the TrackQueueItems comparing the starttimes to the current time. However there is often a lot of QueueItem before the current time so this doesn't feel like an effective way of doing things.


Hi Stephen,


Admittedly the plugin API for public consumption has got a bit neglected due to lack of interest from the majority of users. QueueTrack made more sense in previous versions of PlayIt Live (pre-playout log/clocks) because there was a distinct 'end' to the queue. Now QueueTrack will queue a track at the end of the cached 'live' log (which includes 3 hours before and 3 hours after the current time) - this would explain why it is queueing at 16:00 when it is 13:00. GetQueueItems similarly will return the 'live' log items.


Please let me know what you are trying to achieve and I will see if I can extend the API for your needs. By the way, I would not recommend using the plugin API to modify data if you are connected to PlayIt Manager - this may cause synchronisation errors as the data will not be pushed back to PlayIt Manager. PlayIt Manager does have an undocumented REST API which you can attempt to use based on the requests made via the web interface. I plan to make this a documented API in the future, with proper API keys for access.


Jason

Hi Jason thank you for your response. 


We get a news recording delivered to us once an hour which is always 1:30 long. I have imported a track to the system which has a 2 second intro on it then 1:30 of bed. Using the App.LiveAssistMode.OnPlayerStart event the plugin detects the track has started playing,copies the news file to a temporary location,loads it into a quickcart and plays it.


This approach works ok but relies on the news file always being the right length so I was looking into if it would be possible to do something similar but actually insert it into the log instead of using a quickcart.


I was also considering the idea of writing a similar plugin to play insert adverts (building some logic into the plugin to determine which adverts should be inserted depending on the day/time)


Thankyou for your advice about not using the plugin API to modify data, I had realized that this was probably the case so have avoided using the functions for inserting tracks, modifying groups etc.