Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Comment on

( #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":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others chilling in the Monastery: (9)
    As of 2014-12-18 04:08 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (41 votes), past polls