TV Diary - add-on web interface

I have just noticed that my tvdiary log contains lots of errors on 17th Jan:

Runtime Error: /mod/sbin/tvdiary_status:312: syntax error in expression: "/ 60"
in procedure 'main' called at file "/mod/sbin/tvdiary_status", line 398
at file "/mod/sbin/tvdiary_status", line 312

it might be relating to files that were copied (streamed and therefor played) and then deleted, but not sure whether that was that day.
 
That appears to suggest that the scheduled duration of the .ts file is returned as something other than an number.
I've tried messing around with the sidecar files, but I can't reproduce the issue.
Did you move the files independently, or run them though packages that might have re-written the information about the video?
 
I would have done opt+ copy (to usb drive) from the handset (which can cause play entries in the tvdiary as they are streamed) and then later (or next day) deleted the files.
 
I've updated the TV Diary to show some more information, which will hopefully make it more useful.
tvdiary_0.0.2-2_mipsel.opk

I have several series links, including Time Team and The Big Bang Theory, which seem to mix up shows so it's hard to know whether it's one they last broadcast a month ago or one that I haven't seen before.
It's usually a few minutes in that I start getting a feeling of deja vu.
Since TV Diary tracks what I've recorded and what I've watched, I've added an icon against shows with a title and synopsis that I've already watched. It's not an absolutely certain sign that I've seen the show before because some shows (like the News) have the same synopsis every time. And it doesn't pick up where the synopsis has changed just to add [SL] at the end to indicate that it's the signed version of the program. But if you click on the icon it will show you a brief list of the times that a similar show was recorded or played in the past.

I like to know which of the recordings I made are still available to watch, which I haven't yet watched, and which I've deleted without watching because I was pre-warned that I'd get a feeling of deja vu if I started watching them.
To this end I've updated TV Diary to quickly scan the .ts video files under My Videos, and show the relevant icons against the show's listing.
To avoid doing any unnecessary work it caches the details, so it only looks inside videos that have actually changed, and it won't check for changes more than once a minute. I've tested almost filling a 1Tb disk with videos, and it doesn't slow things down much at all.

One thing that has slowed the UI a little is that I've added locking around accessing the TV Diary's own database, since the sqlite3 we use doesn't have any locking built in. So where before the two tables in the TV Diary were updated in parallel, there was a little bit of (harmless) Russian Roulette going on there. Now the DB access is serialized, so one of the tables will have to wait for the other to finish. There's a 15 second timeout to access the DB before downloading the table gives up. This almost never occurs, and I wouldn't mention it except for the fact that the very first time you access the updated TV Diary will probably hit it because the cache of video file details will initially be empty. If I were doing this for a paid for product I'd have the post installation script build the initial cache, but I can't spare the time to fix something that will only occur once. If it times out you will see a message which says "Timed out acquiring exclusive access to the database. Try again later." Just hit the "Today" button and the page should refresh just fine.

Oh yes, there's a "Today" button, and "Prev" and "Next" day buttons too, to make it slightly easier to navigate around.

A situation I sometimes hit is where I've managed to get more than two recordings scheduled at once. Because TV Diary shows you a list of what's going to be recorded it's the obvious place to warn you. The affected programs have a pink background and red warning bar. It's then pretty easy to use the remote control to cancel one of the recordings and have the Humax suggest alternative times that work.

So, I can see, day by day, what was recorded, whether they're possible repeats, whether I've watched them or not, and whether they're still available on disk or not.
But I also want to be able to find those programs on the box and simply watch them.
To that end, I've added the ability to view the inventory of video files that TV Diary is caching in a way that gives me as much information in a useful form that I can relate to the on-screen experience.
You get into the TV Diary's Inventory by clicking on the video available icons against a program.
I'm considering it experimental at the moment. The code's solid, but I'm just not decided about how the UI to get into the inventory should go, and how it relates to the WebIf Browse interface. I don't want to try to replicate the rich web-based functionality. That would be pointless. What I've tried to do is show you the details of TV programs that you can look at while stepping through the Humax's on-screen menu. Hence the thumbnails, date & time formatting and sorting by reverse time (sorry I haven't done alphabetical sorting or by channel).

At the moment the inventory only checks under "/media/My Videos", and the dustbin folder (typically [Deleted items]) is excluded.

You can take a look at a snapshot of my machine at http://www.wink.eclipse.co.uk/tvdiary/ .
  • The most obvious feature is the overlapping recordings, where 2 programs are being recorded and the third is failing to record. The recordings are underway, so it's too late to fix now, but the warning is available for all future recordings.
  • The Time Team at Tue 28 Jan 2014 13:25 is currently unwatched, is available on disk, and is probably a repeat.
  • Click on the deja vu icon to see when it was previously recorded and watched. (I'm not snapshotting individual programs' deja vu information, so the same sample details appear for all programs.)
  • Click on the video available icons to see the inventory. (Again, this is a snapshot, and not taken at the same time as the main details, so don't expect consistency here.)
Under the covers, details are now returned as JSON instead of HTML, so it's far easier to change things, and you could pull down details for your own applications.

I'm currently looking at putting together a teensy little data warehouse to use for displaying the recording and viewing summary statistics that people have been asking for. Going to the raw transaction data every time would probably be rather wasteful.

TVDiarySnapshot1.png

TVDiarySnapshot2.png

TVDiarySnapshot3.png
 
That all looks very impressive. If only one could then command the Humax to play the file!

I've given it a "like", even though I have no plans to use it.
 
Excellent.
I am especially impressed with the video inventory, though isn;t it something that should have a top level link/entry point, since it is essentially an alternative browse view.

I was a little confused by some of the icons. e.g. the eye icon being unwatched (rather than watched), but am getting used to them.

I don't want to try to replicate the rich web-based functionality
Indeed, rather than replicate, would it make more sense for some of the features to be available from the webif browser view. I am not sure what is involved in this and how much time from af123 would be needed nor even which would be the best, but it just seems that it might be worth looking at an integrated view.

One final note, I forgot to ask before - is the purging of the watched db still manual and do you have any plans for an auto facility. I must remember to look at how big the file is and check if I need to do a manual purge (and look back in this thread for the instructions).
 
Some good new features, I am getting this icon watched.png with 'Deleted Unwatched' against it for a programme that is still on the Hard drive that was recorded on Sun 2 Feb 2014 19:00 and watched on 4 Feb 2014. I would have expected to see this symbol but with 'Watched' against it
 
I have to say, this is beautifully written code, making good use of the libraries provided by web interface.
(Even though I'm an 80-columns, Allman style advocate! [accepting that Jim/TCL doesn't entirely support that])

It's a fine example of how good HTML/CSS/AJAX code should be written with clear separation of the framework, style and code. Rather a stark contrast to some other parts of the web interface, I'm afraid. I'm a systems programmer who has learned HTML/CSS/AJAX through this project and I'm getting better but some of the early stuff is decidedly embarrassing now!
 
TV diary was working fine until I installed update 0.0.2-2 - now all I see is 'Sorry, unavailable due to server error' in both 'Recorded / To be recorded' and 'Watched' fields with '[HDD] My Video' continuously 'Processing request'. Is it possible to go back to previous version, or can you suggest where my problem lies.
 
I get the same result after upgrade. I presumed it was because I was running it on an HD-Fox. The original version worked.
 
TV diary was working fine until I installed update 0.0.2-2 - now all I see is 'Sorry, unavailable due to server error' in both 'Recorded / To be recorded' and 'Watched' fields with '[HDD] My Video' continuously 'Processing request'. Is it possible to go back to previous version, or can you suggest where my problem lies.

Can you try changing the web page URL from "/tvdiary/index.shtml" to "/tvdiary/day_json.jim?start=1391745600&current_time=1391807552&type=R" and report what you receive please.
 
Is it possible to go back to previous version, or can you suggest where my problem lies.
It's worth giving it more than one try I think, Martxw has said that it will be a bit slow the first time it is used, If it still doesn't work after a few attempts, it would be possible to go back to the previous version if necessary
EDIT
Sorry Martxw, our posts crossed
 
Sorry martxw - now I'm really lost! Where do I find web page URL - you are speaking to a novice here. Thank you for instant response to my post.
Copied your quoted URL into browser address field and was presented with pages of text - not formatted page.
 
If you highlight and [right click] copy the text below :-
Code:
tvdiary/day_json.jim?start=1391745600&current_time=1391807552&type=R
go to the web-if and select TV-Diary, you will see the URL of you Humax followed by tvdiary/index.shtm, you need to highlight the tvdiary/index.shtm and the paste the previously copied text

tv-diary-url.jpg

You should get something like this :-

Code:
{
"current_time": 1391807552,
"time_start": 1391745600,
"time_end": 1391832000,
"events": [
  {
  "type": "record",
  "active": false,
  "watched": false,
  "repeat_id": -1,
  "available": true,
  "event_start": 1391805002,
  "event_end": 1391806741,
  "event_duration": 29,
  "scheduled_start": 1391805000,
 
Looks like I did the right thing but only now presented with pages of text? If only I knew how to attach screen info to this post??
 
Highlight the test on the screen, [right click] copy and then in the post entry box click on the { }# CODE icon above and [right click] paste the text into the provided code box
EDIT
You don't have to upload a screen image
 
If you want to add an image, you have to upload your image as a file attachment. You then get the option to embed it in the post.
 
Back
Top