Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

This is the story of how I used Perl, POE, and a Linux box to turn an annual event of terror, boredom, and insomnia into an enjoyable experience.

Every year in the San Francisco Bay Area there’s a science fiction convention called BayCon. During the con, we take over one of the channels on the hotel's televisions to run a TV station called BayCon TV, or BCTV for short. We play interviews with our guests of honor, fan videos, old movies, and pictures of people at the convention.

When I first came aboard with BCTV, everything was done with tape. The crew had to build huge videotapes and play them one after the other. If they missed a tape change, or if a movie was shorter than expected, the entire schedule got thrown off. We had to build the tapes during the convention, which kept us locked in our rooms and awake all night, frantically editing the next tape together.

There had to be a better way. I found one... using Perl.

The first problem was how to play the movies. I found that the most complete video player which had a documented library interface was Xine. (This was in 2003.) I wrote a Perl library to handle at least the basics of accessing it. This module became Video::Xine.

Next, I needed something to tell the Xine module when to play the movies. I drew up baroque plans involving threads, forking, and alarm calls... then used POE instead. With POE, I could create a daemon that called my movie-player object at the scheduled time. Whenever Xine was finished playing a movie, it would tell POE about it via Xine's built-in event system, and it would show slides with Image::Imlib2 and play music, again using Xine.

Overlapping movies proved to be a big problem. The listed running time for a movie can be inaccurate (or, in the throes of con confusion, miscommunicated), and it can be easy to schedule one movie to start before another is finished. I attacked this problem in a couple of ways.

First, I stored the schedule in a PostgreSQL database. This allowed me to prevent careless errors by defining database triggers that calculated the start time and end time for a particular run of a film and would not allow me to add a new schedule entry that conflicted with a previous one. Second, I kept the lengths of all the movies in the Postgres database as well, and automatically calculated them using my Xine module. Finally, POE's event-based programming environment let me program the system flexibly enough to simply skip any conflicting movie.

Since the theme of the convention for which I wrote this system was time travel, I called it the Playback Machine. You can find it on CPAN as Video::PlaybackMachine.

These days, the Playback Machine is stable enough to do its work without interference from me. I can, in theory, hook it up to the hotel's TV system, walk out of the room, and spend the rest of the weekend mingling with my fellow deranged geeks. (It hasn't always been perfect. A tip-- always turn off your screen saver.) I run around taking pictures, then upload them to the system so that my fellow fans can turn on their television sets and say, "Hey! That's me!"

So if you're a science fiction fan in the San Francisco Bay Area, and feel like stopping by a convention on Memorial Day weekend, see if you can find a television set tuned to BCTV. And as you watch Godzilla destroy Tokyo, or see images of people dressed in very strange costumes, just remember-- it's powered by Perl.

stephen


In reply to How Perl Saved BayCon TV by stephen

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (7)
As of 2024-04-24 09:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found