Developer Guide

Requirements

Basically, Dalmatian plays Spots. A Spot is an audio file (in WAV format) that a Sponsor pays to have played. Generally the Sponsor, name, and year will probably be enough to identify a unique Spot. Somewhere information about the Sponsor, at least their address, should be stored. In addition, the number of times a Spot has been played should be maintained.

Spots are played during Breaks. A Break is a short period of time between songs in a satellite feed. A Break does not occur after every song; rather it is scheduled to happen around a certain time. The exact time that the Break is triggered is determined by the satellite feed itself, which is connected to the computer through the joystick port. When it's time to play a Break, the satellite feed sends a signal on the port as if a user had pressed the first button a joystick. However, Dalmatian should only play a break if this trigger falls within two minutes of the scheduled time.

Spots are scheduled in Breaks by their Slot, which are just numbered positions within the Break. There is no added time between Slots; they are just played one after the other as fast as possible. A Break can have as little or as many Slots as the user desires.

Some advanced method of scheduling Breaks should be given. Specifically, the user should be able to repeat a Break on either a weekly or monthly basis. If it is a weekly basis, then the user should be able to specify one or more days of the week that the Break will be repeated. If it is a monthly basis, then the user should be able to specify either a day of the week and a cardinal number (such as first, second, third, or fourth) or an actual day in the month (as in 1-31.)

There should actually be two applications. A Player, and a Manager. The Player maintains a queue of Breaks and plays them at the appropriate times. The Manager actually schedules Breaks. Ideally, the Manager will send a message to the Player when it updates something in the database. That way the Player can change the queue if necessary. Optionally, more than on Manager should be able to work at once.

Database

The underlying MySQL database consists primarily of four tables: sponsor, spot, break, and slot. Here are their CREATE TABLE statements.

CREATE TABLE sponsor (
name VARCHAR(32) NOT NULL,
street VARCHAR(32) NOT NULL,
city VARCHAR(16) NOT NULL,
state CHAR(2) NOT NULL,
zip CHAR(5) NOT NULL,
phone CHAR(10) NOT NULL,
PRIMARY KEY (name),
FOREIGN KEY (state) REFERENCES state(code)
) ENGINE=InnoDB
CREATE TABLE spot (
id INT AUTO_INCREMENT,
sponsor VARCHAR(32) NOT NULL,
title VARCHAR(64) NOT NULL,
year DATE NOT NULL,
filename VARCHAR(128) NOT NULL,
description TEXT NULL,
PRIMARY KEY (id),
UNIQUE u_spot_composite (sponsor, title, year),
UNIQUE u_spot_filename (filename),
FOREIGN KEY (sponsor) REFERENCES sponsor(name)
) ENGINE=InnoDB
CREATE TABLE break (
id INT AUTO_INCREMENT,
start TIMESTAMP NOT NULL,
end TIMESTAMP NOT NULL,
PRIMARY KEY (id),
UNIQUE u_break_start (start),
UNIQUE u_break_end (end)
) ENGINE=InnoDB
CREATE TABLE slot (
break INT NOT NULL,
position SMALLINT NOT NULL,
spot INT NOT NULL,
PRIMARY KEY (break, position),
FOREIGN KEY (break) REFERENCES break(id),
FOREIGN KEY (spot) REFERENCES spot(id)
) ENGINE=InnoDB