in reply to report generation

rgb:

We're not a code-writing service, so I'll assume you're asking for a general approach you can use to start building a program. So here goes:

I'd suggest you create a hash, and when you see a movie start time, add it to the hash using the video title as the hash key. Then when you see a stopped tag, you can look up the start time from the hash and print the video title and duration and remove it from the hash.

There would be two special cases you'll want to handle: (1) You may receive a Stopped message without a Played record. Just print a warning when this occurs. (You'll be able to detect it because the video isn't in the hash.) The other special case is when you reach the end of your file, and there are some videos that haven't received their Stopped message yet. Just scan through the hash and print appropriate messages as req'd.

...roboticus

Replies are listed 'Best First'.
Re^2: report generation
by dsheroh (Monsignor) on Jan 23, 2009 at 12:49 UTC
    Special case 3: Receiving two "played" messages for the same video without a corresponding "stopped" message in between. (i.e., The inverse of special case 1.)

    If this is a legitimate case, then you may need to use a hash of arrays or other means of supporting multiple start times for a video, as well as a means of deciding which of the multiple start times a stop time should correspond to. If it is not legitimate, emitting a warning message should suffice.