TV Diary - add-on web interface


Active Member
Hi there...

In the week that LG have been in trouble for their TVs spying on their customers' viewing habits, I'd like to introduce a new package I've put together to allow Humax HDR Fox T2 owners to spy on their own viewing habits!

TV Diary adds to the custom web interface to present a daily list of the programs that you've recorded, or you plan to record, and those that you've already watched. It also tells you how many hours of TV you've watched, which may make you feel a little guilty!

Rather than trying to describe it, it's easier to let you take a look. So, you can find an externally hosted snapshot of the TV Diary for my machine at The snapshot was taken at 13:51 Nov 25th, so anything after then is a scheduled recording. (It's not really been a typical week, with a few late night debugging sessions, but it's interesting how much time I shave off programs by skipping adverts, or fast forwarding over the boring bits of The One Show. And I don't normally watch Loose Women at 3:33am!)

When you install the package it automatically adds an entry to crontab to monitor the humaxtv activity every minute. There's a settings plugin to allow you to turn monitoring off if you want a bit of privacy, and you can also adjust the time in the morning that's treated as the start of your TV day. It defaults to midnight, but many TV listings go through to 4:00am or 6:00am.

A CLI for publishing to a remote web server is included FYI, but isn't supported yet because the remotely hosted version of the TV Diary main web page is a bit of a hack at the moment. I was planning to try pushing to the Facebook graph, but I've reconsidered after seeing the revealing detail!

TV Diary is available now through Package Management from as tvdiary 0.0.1-2.

Have fun, and let me know what you think.
Sounds excellent and something I was recently thinking about (though possibly more from the disk usage and predictions when it will run out)
Wow - excellent bit of documentation writing! I didn't expect that. Thanks.

@cloud9 As it saves the times, channel, title and synopsis of recorded and watched programs it'll make your disk run out just a little bit sooner, but I have tried to keep it small and avoid duplicate information.
The DB lives in /mod/etc/tvdiary.db and isn't currently deleted if you uninstall the package. Maybe 200Kb/month, but of course it's very dependent on how many programs you watch, and I guess how wordy their synopsises are.
Would it be worth putting logic in to delete historical data after a predefined time. Say a rolling time period. Assuming this is not a major development of course.
Perhaps a user set parameter in in settings to define how many months/weeks history to keep.

Sent from my iPad using Tapatalk HD
Wow - excellent bit of documentation writing! I didn't expect that. Thanks.

Ezra Pound's contributions are most appreciated. I for one am very grateful for his work - I love writing code but hate writing documentation :)
@cloud9: It only reports 1 day at a time. It would be possible to take add an end date parameter, but it would still have to be in whole days, and the dates of recording and playback aren't displayed inside the tables; only the dates from the schedule.
If I wanted to report multiple days on one page then I'd consider updating the script.js to make multiple Ajax requests and concatenate the tables, adding date headings between them.
You could hack this together by cloning index.shtml and script.js and trying it out. The trickiest part is making sure you do the ajax requests serially - I've done them in parallel because they're updating separate divs.
I can envisage some nice weekly/monthly/yearly summary pages using the data that have been collected.
Not sure if I really want to know how much TV was watched last month though! (Although it would be interesting to estimate the time saved from ad skipping)
Does it need a restart or only start next day. I have installed it and still see an error on both recorded and watched. My wife is currently watching Dr Who, though that was already started when I installed.
Error: The tvdiary.db database is missing.
Did you install it more than a minute ago? The DB file is created by the program called from the crontab, so there could be a minute before the DB is created, and 2 minutes before meaningful data has been recorded. The startup should be automatic.
Oh yes, I should have pointed out that the same TV program needs to be observed on two consecutive polls from crontab in order to be listed. So you can safely channel surf over embarrassing stuff. Just don't watch any one thing more than a minute!
Sorry, I should have said I did wait quite a few minutes. An hour almost now, and as I said, my wife is current watching a program (for at least 20 mins).

(and it is apparently now recording 2 things)

I did update the start time as soon as I installed it. Any possibility it is waiting until 6am tomorrow to start?
The first check I'd do is to go to Diagnostics and type "crontab -l" in the Run Diagnostic: box and hit "Run Diagnostic". You should see something like this:
>>> Beginning diagnostic crontab -l
Running: crontab
686 crond
0 2 * * * /mod/sbin/anacron -s -d
* * * * * /mod/monitor/run
*/10 * * * * /mod/webif/lib/bin/auto >/dev/null 2>&1
* * * * * /mod/sbin/tvdiary_status.jim  >>/mod/tmp/tvdiary.log 2>&1
>>> Ending diagnostic crontab -l
tvdiary_status.jim is the key line.

The second check is the tvdiary.log file, which should be listed in the top third of the "View Log Files" box.

You could also run /mod/sbin/tvdiary_status.jim directly, either through the "Run Diagnostic" or by telnetting onto the box.
* * * * * /mod/sbin/tvdiary_status.jim >>/mod/tmp/tvdiary.log 2>&1

aha, the log is full of

Wed Nov 27 20:21 (GMT): Cannot find humaxtv process.
Wed Nov 27 20:22 (GMT): Cannot find humaxtv process.
Wed Nov 27 20:23 (GMT): Cannot find humaxtv process.
Wed Nov 27 20:24 (GMT): Cannot find humaxtv process.

I do see a humaxtv process in ps

humax# ps | grep humaxtv
180 root 367m S /usr/bin/humaxtv
7574 root 1344 S grep humaxtv