jwztv

We play music videos all day long at both locations of DNA Pizza, the restaurants attached to my nightclubs, DNA Lounge and Codeword. This software is how we do that.

There are two things here: a MacOS application for playing videos; and a web-based application that controls it, and allows anonymous users to request songs.

but why?

I used to do this using iTunes. It worked pretty well for several years. But the reason I wrote this is that iTunes just gets worse and worse as time goes by.

Through iTunes 10.7, you could configure iTunes to allow anonymous users to request songs, without making them "pair" to your computer by giving them your iCloud password. It was a really great feature! Anyone who had the "Apple Remote" app installed on their iPhone could see the available tracks and vote on them. We used this great feature 24/7 in the restaurants. But in 2012 they killed that feature, when "iTunes DJ" was replaced with the far inferior "Up Next".

As it happens, Apple then went five years without touching the "Remote" app ("if it ain't broke, don't fix it"), so the request feature still worked, so long as you never upgraded beyond iTunes 10.7. Which is exactly what I did.

Sadly, in 2017, they finally removed that feature from the Apple Remote iOS app. And, iOS being the despicable locked-in walled garden that it is, they don't provide any way for you to downgrade to a previous version of the Remote app once you've accidentally upgraded.

So I wrote this pair of applications to work around Apple's habit of deleting perfectly good features with no replacement.

Dear iTunes team: you are bad at your job and you should feel bad.

jwztv.app

This is simple and reliable video player for MacOS, since iTunes is no longer simple or reliable. It plays videos one after another, doing configurable video cross-fades at the transition. It displays the artist and title at the bottom of the window shortly after the track starts, and shortly before it ends, music video style.

It has very little in the way of interactive UI. If you want an interactive video player, there are many featureful ones. There's iTunes, of course, and I also quite like Movist.

The mission of this program is to be easily scriptable, and to be reliable when run unattended. Most other movie players are not so great at that.

Features of jwztv include:

It accepts several AppleScript commands, for automation purposes:

play "file.mp4"
Add a file to the queue.
play "file.mp4" volume -22
Add a file to the queue, and specify a volume adustment (-100% to +100%).
play "file.mp4" request true
Add a file to the front of the queue, but after the other requests.
play "folder" shuffle true
Add all the files, and shuffle them.
delete "file.mp4"
Remove a file from the queue; if it was already playing, skip it.
skip
Move to the next track now.
pause
Pause current track.
play
Un-pause current track.
playing
What track is playing right now?
queued
What tracks are coming up next?

notify "text"
Display text at the bottom of the screen for a few seconds.
alert "text" for 15
Display text centered on the screen, and specify a duration in seconds.

You can also drop files or folders onto it, and File / Open has a "Shuffle" checkbox. But like I said above, interactive UI is sparse.

jwztv.cgi

This is a web application for controlling a remote video player.

(As it happens, that video player can be either jwztv.app or iTunes. That's only because I made this transition in stages.)

How it works is this:

There are two machines involved. The first is a Mac hooked up to a TV, which is playing videos. The second is a server, on the public web, which controls it. They need not be in the same building. The client can be behind NAT or firewalls.

The server has a MySQL database containing a listing of all of the available tracks (just the metadata, not the files themselves). The client periodically tells the server what it has recently played, and polls the server for any new requests that have been submitted by users out in the world. The server is also responsible for randomly (within reason) choosing what to play next.

The server is a CGI written in Perl, relying on a mysql back end. The CGI serves up a front end that is JavaScript with jQuery.

Users can request any tracks, but with certain constraints. These same constraints apply to randomly-chosen tracks:

The web app is optimized for phone and tablet usage, as well as desktop-sized windows.

You can see it in action at dnalounge.com/musicvideos/, however, it won't let you do anything unless you are physically at DNA Lounge or Codeword: it only lets you view and manipulate the queue if you are connected via the local WiFi. (That is both a feature to prevent trolling, and also how it tells which client machine it should be controlling, since we have multiple locations controlled by the same web app.)

To install it:

Let me know if you are actually using any of this!

download
MacOS App: jwztv-1.2.zip (6 MB)
Source Code: jwztv-1.2.tar.gz (6 MB)


© 2017 Jamie Zawinski <jwz@jwz.org>