Call command in playlist

You have a question or need an advice about how to do something? Ask it here!
Post Reply
polp6880
Posts: 36
Joined: 19 Apr 2020 19:04
Call command in playlist

Post by polp6880 »

Hi all,

I want to be able to call a command (which makes an HTTP call to an external server) only when that particular item is played within a playlist. Let me better explain...

I currently have a script that loads a particular set of songs from my libraries. In the middle of these songs, I have an item that starts playing the Line-In feed for 1 hour. The actual content that I get from the Line-In feed is less than 1 hour so right now when the content is ready, we manually click the 'Play Next Use Fading' button so in the playlist, we move to the next track. All is good there.

What I'd like to happen is that just before the Line-In feed item in my script plays, I execute a command then, when I hit the 'Play Next Use Fading' button, another command is executed. To be more clear, I want to call an external HTTP request as soon as the Line-in feed starts playing and call another external HTTP request as soon as the Line-in feed stops playing (or as soon as the 'Play Next Use Fading' button is clicked).

Right now, the full script is loaded by calling a Scheduled Program so it loads in a specific time. I tried to add the commands in the script itself but what happened is that both commands ran as soon as the Scheduled Program ran, which kind of makes sense.

So, I guess, my question is, can I have an item in my script that calls the command only when that particular playlist item is played?
User avatar
radio42
Site Admin
Posts: 8295
Joined: 05 Apr 2012 16:26
Location: Hamburg, Germany
Contact:
Re: Call command in playlist

Post by radio42 »

If it is really a particular track, which should trigger the command, e.g. a 'LineIn' script-line, you might want to assign that command directly with to that track.
E.g. in the Script-Editor, add your 'LineIn' feed script line and then click on the flash icon for that line at the Options column.
This opens the 'Track Control Options & Command Events' dialog. Here you can assign your HTTP command with the 'On Track Played' resp. 'On Track Stopped' events
polp6880
Posts: 36
Joined: 19 Apr 2020 19:04
Re: Call command in playlist

Post by polp6880 »

Hi Bernd,

Thanks a lot for this suggestion. It might actually work as yes, I'd like to hook this up to a particular track (or two).

I'll try this ;)
User avatar
radio42
Site Admin
Posts: 8295
Joined: 05 Apr 2012 16:26
Location: Hamburg, Germany
Contact:
Re: Call command in playlist

Post by radio42 »

You might also use the LoadTrack script-line mode and than either use the same as above and define the commands In the script line options.
Or you might also use the TAG Editor to directly and permanently assign the commands to the track physically.
polp6880
Posts: 36
Joined: 19 Apr 2020 19:04
Re: Call command in playlist

Post by polp6880 »

Hi Bernd,

Just wanted to let you know that this worked perfectly and it's saving me a lot of time. Thanks a million!

Post Reply