Author Topic: Remote Broadcast (Automatic Switchover from DJ to iTunes)  (Read 977 times)

n9xcr

  • overnight DJ
  • **
  • Posts: 92
    • View Profile
Remote Broadcast (Automatic Switchover from DJ to iTunes)
« on: March 18, 2012, 11:40:39 AM »
The ability to mute DJ and play an Internet feed became a necessity for my station in Fall 2011. Jay kindly (and quickly!) added the ability to "tell" DJ to mute all three players.

I added some code to  DJEvent-NowPlayingChanged that told iTunes to try playing the playlist that contained my remote feed URL, waited 10 seconds, muted DJ if iTunes was playing and then entered a loop that would go for as long as iTunes was playing. It worked well most of the time but still needed work.

I recently converted an LPFM I'm involved with from another product to Radiologik. They have the same needs for remote broadcasts so, of course, I put my script on their system as well. I ran into two things over there... the script didn't work as well for some reason (it wasn't staying in the loop) and they sometimes do remotes during pre-recorded programming. It was only by chance that I didn't run into the second problem at my Internet station, but it did present a problem. I realized that relying on  DJEvent-NowPlayingChanged wasn't the right way to go with this.

What follows is a complete rewrite of a script I previously posted in the forum. This is what is does:
  • Tell iTunes to play the remote feed playlist.
  • Wait 10 seconds.
  • If iTunes isn't stopped, set MuteMain3 to true. Otherwise, set MuteMain3 to false.
  • Wait 20 seconds and do it one more time.

Basically, you're checking for a remote broadcast every 30 seconds and setting everything to the state it should be in.

~/Music/Radiologik/Scripts/CheckRemote.scpt
Code: [Select]
tell application "System Events"
tell application "iTunes"
if player state is stopped then
tell application "Radiologik DJ"
MuteMain3 false
end tell

try
play the playlist named "Remote"
end try

delay 10
end if
end tell

tell application "iTunes"
if player state is not stopped then
tell application "Radiologik DJ"
MuteMain3 true
end tell
else
tell application "Radiologik DJ"
MuteMain3 false
end tell
end if
end tell
end tell

delay 20

tell application "System Events"
tell application "iTunes"
if player state is stopped then
tell application "Radiologik DJ"
MuteMain3 false
end tell

try
play the playlist named "Remote"
end try

delay 10
end if
end tell

tell application "iTunes"
if player state is not stopped then
tell application "Radiologik DJ"
MuteMain3 true
end tell
else
tell application "Radiologik DJ"
MuteMain3 false
end tell
end if
end tell
end tell

crontab
Code: [Select]
* * * * * /usr/bin/osascript ~/Music/Radiologik/Scripts/CheckRemote.scpt
« Last Edit: March 18, 2012, 09:20:01 PM by n9xcr »

Lane

  • Administrator
  • fat cat
  • *****
  • Posts: 1761
    • View Profile
Re: Remote Broadcast (Automatic Switchover from DJ to iTunes)
« Reply #1 on: March 18, 2012, 12:47:38 PM »
Thanks for your script contribution and update to it.

So does DJ stay muted? What happens when a new song is loaded into the deck and plays?

Jay Lichtenauer

  • Global Moderator
  • fat cat
  • *****
  • Posts: 828
    • View Profile
Re: Remote Broadcast (Automatic Switchover from DJ to iTunes)
« Reply #2 on: March 18, 2012, 07:02:06 PM »
The 3 main players remain muted through new songs, preference sets, etc. until you unmute them or quit and restart DJ. This command is also in the Functions menu.

n9xcr

  • overnight DJ
  • **
  • Posts: 92
    • View Profile
Re: Remote Broadcast (Automatic Switchover from DJ to iTunes)
« Reply #3 on: March 19, 2012, 09:11:26 AM »
Something worth mentioning is that having this script interferes with updating iTunes.  ::)

Lane

  • Administrator
  • fat cat
  • *****
  • Posts: 1761
    • View Profile
Re: Remote Broadcast (Automatic Switchover from DJ to iTunes)
« Reply #4 on: March 19, 2012, 12:27:56 PM »
If the players are muted, itunes shouldn't be updated anyway.

Actually, I'm kinda reluctant to have DJ playing at all. I'd probably choose to stop playout.

n9xcr

  • overnight DJ
  • **
  • Posts: 92
    • View Profile
Re: Remote Broadcast (Automatic Switchover from DJ to iTunes)
« Reply #5 on: March 19, 2012, 11:00:53 PM »
I only update iTunes manually if I happen to think of it. The latest updates have been useless, of course, but nonetheless I did it anyways. I'll probably be reluctant to do so in the future, though. I restarted iTunes after the update and all of my playlists were gone. It was back to defaults. I restarted it again, taking a deep breath, and all was back to normal. Talk about lucky. =)

I prefer to keep DJ playing because I want it to just stay on track. Although the people doing the remotes will access the machine to monitor it to make sure it switched over, they don't necessarily have the knowledge to control Radiologik.

John Russell

  • gofer
  • *
  • Posts: 10
    • View Profile
    • Radio Lewes
Re: Remote Broadcast (Automatic Switchover from DJ to iTunes)
« Reply #6 on: March 20, 2012, 02:35:48 AM »
We use CloudDJ from wavestreaming.com to pick up relay feeds, it can be scheduled and handles repeats, there is a seamless transition from Live (Radiologik) to Relay.  If either drop out CloudDJ automation takes over so avoiding silence on air.  Using a web based third party solution is proving very successful for us http://radiolewes.org.uk
Wavestreaming also distribute a free customisable player that works well.  :)

Lane

  • Administrator
  • fat cat
  • *****
  • Posts: 1761
    • View Profile
Re: Remote Broadcast (Automatic Switchover from DJ to iTunes)
« Reply #7 on: March 20, 2012, 07:59:14 AM »
Oh you meant the itunes *program* updating, not the track's lastplayed info updating in itunes.

n9xcr

  • overnight DJ
  • **
  • Posts: 92
    • View Profile
Re: Remote Broadcast (Automatic Switchover from DJ to iTunes)
« Reply #8 on: March 20, 2012, 04:08:57 PM »
Am I correct that your situation is for a streaming (only) station, John?

Chris

John Russell

  • gofer
  • *
  • Posts: 10
    • View Profile
    • Radio Lewes
Re: Remote Broadcast (Automatic Switchover from DJ to iTunes)
« Reply #9 on: March 27, 2012, 02:31:56 PM »
Yes, we don't do a lot of on-demand downloads as our PRS/PPL LOEL licence doesn't cover that and to do so is pricey.  We run live from the studio at our charity's office, plus Radiologik from a dedicated laptop that can be moved and handle live outside broadcasts and CloudDJ to pick up relays and cover off air time so ensuring 24/7.  They hope to have the ability to soon allow remote DJs to connect at set times and we are keen to exploit this as we have potential DJs who are housebound or have difficulty travelling etc.