[mythtv] Viewing Time Monitor

Brett tamntm2 at yahoo.com
Sun Oct 5 21:41:01 EDT 2003


I've written a bit of code that keeps track of how
much time I spend watching MythTV.  (I should write
one that keeps track of how much time working on it...
but that's another story.)

It uses a new table to store the times I start
watching recordings or live tv, and the times I end. 
There is some very basic logic to combine events that
occur close enough together (according to a threshold
in settings).

I then have a perl script that scans the table and
makes a little report on how much time we spent
watching TV in the last 24 hours.  I have a cron
script that sends it to me each day.

First, if there is any interest in this, I'd be glad
to pass these things along.  It could probably use
some polishing by better hands if it were to go beyond
my box, but it's a working first cut.

Second, I could use some advice.  I wrote everything
to support multiple users, since the accountability
factor goes way down if you can blame the large
viewing times on someone else in your head.  The
trouble is, this is the first time I've done anything
in QT, and I have only pidly experience writing GUI
stuff.  I can follow stuff around to some degree, but
I'm not sure of the best way to do something new. 
What I need is a GUI way to find out who is watching
when a show or live TV is started.

Obviously, the more streamlined the better.  I'm
thinking that a popup could show up with each name
displayed as a checkbox and and OK button to get on
with it.  Perhaps a number key could toggle each box,
and another key could hit OK (to cut down on arrow key
manip).  This would only add two keystrokes to the
viewing process as the cost of accountability (or
three if two people are watching, etc).

For my stuff to work, I just need a QStringList of
users watching when a show is started.  This list
should be generated by a GUI and stuck somewhere
accessible.  My stuff comprises two functions in the
TV class: ViewTimeLogStart(QStringList&) and
ViewTimeLogStop(), as well as the calls in
TV::HandleStateChange.  There's really nothing in them
that requires them to stay in TV though... it was just
convenient since I got it working with calls in
HandleStateChange.  Perhaps someplace else is
better???

I don't really understand the entire state change path
that makes everything run, but as best as I can
figure, perhaps a popup should be spawned in
TVMenuCallback(...) (mythfrontend/main.cpp).  It could
make the QStringList, stick it somewhere
(MythContext?), get rid of itself, and then call the
intended function (startTV() or startPlayback()).  If
it weren't for live TV, it seems like it would be much
easier to modify the popup infrastructure already
built in PlaybackBox.

So my questions: What is required for me to build a
popup dialog from scratch?  I'm assuming the Myth
widget set should make this pretty easy for someone
who has a clue, but I'm not in that group myself. 
Which widgets should be used?  How do I use them? 
Should the popup live in the global namespace of
main.cpp?   And is there a place that makes more sense
to jam this popup into rather than TVMenuCallback()?

Thanks for any help.  I'd be thrilled to work with
anyone GUI-savvy that is interested in this
functionality.

Brett

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com


More information about the mythtv-dev mailing list