Home » Classes » Fall 2003 » Networked Objects » Server Documentation
Truly Interactive TV
Server Documentation
December 2, 2003
 
The Truly Interactive TV modules are designed to work as individual agents over the Internet, communicating with a central server over TCP/IP. The original design called for a single server to collect TV closed-captioning and deliver individual line information to the modules, but an ill-timed apartment move and lackadasical service from Earthlink DSL made it necessary for the TV-line-collection server to reside in a location separate from the module server. Thus, one server (a Dell Dimension V400C graciously loaned by ITP's Tom Igoe and Nancy Lewis) lives in my house, happily connected to my TiVo, while the server that actually talks to the modules is ITP's "stage" server at NYU. The raw closed-captioning sentence log was transferred between the two via Zip disk on a regular basis (whenever I commuted to school.)

Closed-Captioning Collection

The computer dedicated to closed-captioning collection is a Red Hat Linux 9.0 box, equipped with a ridiclously inexpensive ATI TV Wonder VE tuner card plugged directly into my TiVo. The card was detected and installed automatically when Red Hat was installed on the machine. Closed-captioning information is transmitted in the US on Line 21 of the Vertical Blanking Interval (VBI), so I first tried to detect and decode VBI signals using the Video::Capture::VBI module since I knew my line distribution server would be running Perl.

Unfortunately, I couldn't get beyond raw VBI gibberish using the CPAN modules; the decoding programs included were mostly for European-based PAL teletext systems. Not only is the NTSC standard used in the States different, but closed-captioning is not encoded in the same way as teletext. After a few days of frustration I discovered a nifty Linux utility called "ntsc-cc" that can be run under the xawtv TV viewer for linux. Once xawtv is properly configured (in my case: NTSC, composite in, us-cable) ntsc-cc can be set to run in a terminal the background, snagging the closed-captioning info from the video feed. I simply piped the result directly into a text-file using the command "ntsc-cc -cp >>transcript.txt". And voila. (One buggy thing; it seems that xawtv must be visible, with the window resting above the terminal window, for ntsc-cc to run properly.)

Line Parsing and Distribution

The raw data (once transferred via Zip disk) is parsed into sentences by a Perl program running on the ITP stage server. The program collates the raw data into sentences, removing line breaks and non-character codes, and then checks each word of each sentence against a word list collated from four different dictionaries. (There are quite a few missed letters and misspelled words in closed-captioned text; I didn't want anything that looked flaky, so if a sentence contained an unrecognized word, it got dumped.)

The sentences are loaded into arrays, classified by words mentioned as well as first words, so that users have an easier time selecting sensible sentences -- they scroll first through first words, then (once a first word is selected) all of the sentences that begin with that word. If a previous sentence has been uttered, the program looks for all of the sentences that contain one or more of the words previously said, and collects those in a "[related]" array, listed first on the module. Thus there is some degree of subtle guidance from the computer as to what a logical next sentence could be, but the user is in no way obligated to choose any of the server's suggestions.

Another wrinkle is that the user is randomly assigned an identity upon logging on; the names are culled from census data of the most popular names of the 1970s.

Connections to the modules are done using the IO::Socket Module to initiate TCP/IP. Each line is delivered to the module three times (to ensure that it's properly received) with the header "xx".

Perl Source Code

As every Perl programmer knows, "there's more than one way to do it." This way is neither elegant nor (I readily admit) comprehensible to anyone but me; it was coded with an eye towards results, not beauty. It will have to be reworked for any sort of heavy-duty use; at present, there are a lot of false starts, unused vars, and even worse no multi-threading or proper closing of sockets once a user logs off. This is printed here as a public service with the hopes that it will improve my grade, so take it for what it is -- a quick and dirty solution for a demonstration prototype. Code will be updated here as it is developed.

» See the Perl source code for this project


Copyright © 2003 James G. Robinson
(and various collaborators, where noted).