# New TiVoWeb Module: New Episodes



## sanderton

A TiVoWeb module which displays all episodes on a given day or channel which, according to the guide data at least, have never been shown before.

Wrote it as I thought it might flag up some interesting shows that I would otherwise miss.

If you have Sky, be patient!

(Install - just unzip, FTP to the TiVoWeb modules directory and do a Quick Restart)


----------



## sanderton

Tweaked to cope better with a busy db.


----------



## kitschcamp

Interesting little module, that, I can see myself using this one quite a bit. Thanks very much!


----------



## sanderton

Having used it a bit, I think a "whole week by channel" option might be more useful (I would typically scan BBC 2 and C4). I think I'll add that later.


----------



## kitschcamp

Yup, I can see that, or "Whole week by favourites", a bit like Mr Tickle's guide checking module.


----------



## pahunt

Another nice module. I don't know where you find the time


----------



## tivo_boj

Stuart - whatever your job is - I want one!

another great module ...where do you get the time?


----------



## sanderton

This one took two hours to write from start to finish - it really is easy once you get started!


----------



## sanderton

Version 0.2 has the option to view by channela s well as by day.


----------



## Trinitron

Is there a simple listing anywhere of links to the various tivoweb modules?


----------



## pahunt

> _Originally posted by Trinitron _
> *Is there a simple listing anywhere of links to the various tivoweb modules? *


I wouldn't say it was definitive but this thread is the best list you will find in one place.


----------



## pahunt

Just a small point.

It would be nice if it took account of the current time so that it only showed programs for the current day that haven't started yet.


----------



## sanderton

Yeah, I noticed that the other day.


----------



## pahunt

I did have a quick look at trying to modify it myself but my TCL knowledge is pretty much non-existant and although I managed to work out how to get the system time I couldn't see how to compare it against the program start time.


----------



## Adder

Hmm, by day works, but for by channel I get this for each channel I have tried:


Code:


INTERNAL SERVER ERROR
--cut here--
action_shownewepbychan '' 'set "showchan" "706";set "showcall" "C4";'
can't open object (errDbNotFound)

    while executing
"db $db openid $fsid"
    ("uplevel" body line 2)
    invoked from within
"uplevel $body"
    invoked from within
"transaction {uplevel $body}"
    (procedure "RetryTransaction" line 5)
    invoked from within
"RetryTransaction {
				set stationday [db $db openid $fsid]
				set showings [dbobj $stationday get Showing]
				set showingfsids [dbobj $stationday g..."
    ("uplevel" body line 6)
    invoked from within
"uplevel $body"
    invoked from within
"ForeachMfsFile fsid name type "/Schedule" "" {

		scan $name "%d:%d:%d:%d:%d:%d" channel day junk1 junk2 junk3 junk4

			if {$channel == $showchan} {
..."
    (procedure "::action_shownewepbychan" line 19)
    invoked from within
"::action_$action $chan $part $env"
    ("eval" body line 1)
    invoked from within
"eval {::action_$action $chan $part $env}"
--cut here--

Any ideas?


----------



## sanderton

"errDbNotFound" means that the datbase connection is broken. TiVoWeb sets that up, so try doing a Full Restart.


----------



## Adder

Aha, cheers sanderton, I ended up restarting a couple of times, was trying to add Backup, Re-order Season Passes, the latest version of Endpad, the Digiguide Search 1.4 and New Episodes all at once. 

Had to restart to get backup to work, then New Episodes started to work, then crashed tivosh trying to convince endpad that it definately wasn't running. 

All seems to be working now though.


----------



## Wonder_lander

I have had a look at this module and would most use it by day.

What is the sort order because it seems fairly random to me!

It appears to pick a channel number (not sure how) and then puts those programs in time order.

I would be most interested in a global sort by day and then into time order with the option of sorting it globally into Day > Channel Number > Time order!


----------



## sanderton

It is the order in which the stations are stored in MFS, which seems to be random. 

I guess you could add some sort options, but it sends the HTML for each station as it finds it, so you'd have to store all the data, then sort it. 

Feel free to do so and post your code back here!


----------



## Wonder_lander

> _Originally posted by sanderton _
> *
> Feel free to do so and post your code back here! *


 I have no programming background at all...I was hinting at modifications that you could make 

I don't mind having a stab if someone can point me at some good online guides to this language?


----------



## sanderton

I'm happy with how it works no, so I'm not going to make any changes, sorry!

There are many TCL guides out there, but the best all in one package is a book - Jeff Keegan's Hacking Tivo.


----------



## gyre

Rather than ordering from amazon.com in the US... anybody know of a UK reseller of this book?

Thanks!

-- gyre --


----------



## 10203

Here's a version of 0.2 that only shows new episodes from 7pm until the end of the day. It also sorts the daily list into channel number order and adds a tooltip of the programme description to the episode link. All the procedure names are different to the original so you can happily run both at the same time. Enjoy.


----------



## threadkiller

LJ Tried your module, but if I use the channel listing, any of the channels in the right hand column bring up a page not found message  left column is fine tho


----------



## 10203

Well spotted ! New version in the post above.


----------



## Fozzie

Looks good 

One thing LJ - when finding episodes by date, the channels are sorted slightly out of sequence. Reading from top to bottom displays the 3 digit channels, then the two digit channels then the single digit channels. Each group is sorted numerically ascending though.


----------



## 10203

Err, yeah, I almost got the maths right  Try the latest one and see if that's better...

My excuse is I've only got 3 digit channels to test on


----------



## Fozzie

hmm - still the same. File timestamp is 1738?


----------



## 10203

Oops, forgot to update the zip before posting it! Time for more tea!


----------



## Fozzie

That's got it  (Just finished my tea and toasted tea cake as it happens!)


----------



## Snoopy

The error is just here for reference. I either got this error (trying different ui.itcl files that were not necessary), or I got a reboot. See note below as this is now fixed!

INTERNAL SERVER ERROR
--cut here--
action_channelgrid '' 'set "whichChannel" "3521";'
can't open object (0x30007)

while executing
"db $db openid $programfsid"
("uplevel" body line 10)
invoked from within
"uplevel $body"
invoked from within
"transaction {uplevel $body}"
(procedure "RetryTransaction" line 5)
invoked from within
"RetryTransaction {
for { } { $y < $last } { incr y } {

set sl [lindex $scheduleList $y]

set constprogramfsid [lind..."
(procedure "::action_channelgrid" line 148)
invoked from within
"::action_$action $chan $part $env"
("eval" body line 1)
invoked from within
"eval {::action_$action $chan $part $env}"
--cut here

AHHA -- FIXED! FINALLY ... I hope 

BOTTOM LINE: Nothing else is required besides the newepisodes.itcl file.

Here is WHERE I WENT WRONG
1) The message and/or reboot prpoblem has nothing to do with a newer copy of ui.itcl so far as I can tell, even though changing it may cause the message or reboot to surface. Use the ui.itcl that comes with TWP.

2) I removed the wishlist stuff entirely to avoid some conflicts, the specifics of which were unknown at the time, so that still needs to be ironed out. I expect getting it working again should be easy from this stage.

3) Remove the ukgenres.js script and Walla. (ukgenres.js will cause problems if you aren't in the UK -- This was an oversight on my part that caused me major headaches. I believe it comes with the wishslists module and maybe some other things so be aware of it). At least if you are in the US, ukgenres.js doesn't need to be there.


----------



## mdolton

Haven't seen this mentioned yet, but this module doesn't work if your channel lineup includes digital channels (ie 10.1, 10.2, etc). The error it returns is:

INTERNAL SERVER ERROR
--cut here--
action_showcir '' ''
expected integer but got "40.1"
while executing
"lsort -integer [array names channeltablenum]"
(procedure "getchannelsir" line 10)
invoked from within
"getchannelsir"
(procedure "::action_showcir" line 4)
invoked from within
"::action_$action $chan $part $env"
("eval" body line 1)
invoked from within
"eval {::action_$action $chan $part $env}"
--cut here--


----------



## sanderton

Sorry, what are these "Digital Channels"?


----------



## mdolton

> _Originally posted by sanderton _
> *Sorry, what are these "Digital Channels"? *


Sorry, "digital channels" is a bit vague. What I'm reffering to are digital broadcast channels (ATSC in the US). For example, where channel 40 is the old analog NTSC broadcast channel, 40.1 (and perhaps 40.2, 40.3,....) is the new digital ATSC broadcast channel. I'm not even sure why they show up, as directv doesn't offer digital locals in my area, but they're there and it looks like that's what the module is choking on.


----------



## sanderton

Sorry, we don't have such things here, so I can't easily see what the problem is or how to fix it.

I guess you could try removing the -integer parameter fron the lsort command listed in the error message?


----------



## doubledrat

stuart: good mod!

a couple of suggestions for a FMR 

have it able to restrict to a time window. e.g. > 1800 < 0400 ? so we could get rid of all the daytime stuff

what I would REALLY like it to tell me is when there's something completely new on i.e. the first of a new series, or a one off never shown before. not knowing what is in the db I don't know if this is possible or not? where did you get your info on what's in the db?


----------



## sanderton

The time windowed version has already been written by LJ.

You clould modify the code to only show episode 1s, but I'm not sure how reliably that would work.

Code's there for anyone to modify.


----------



## doubledrat

stuart: I'll give it a shot, but I need some info on getting data from the db. is there an online resource at all?


----------



## mdolton

> _Originally posted by sanderton _
> *Sorry, we don't have such things here, so I can't easily see what the problem is or how to fix it.
> 
> I guess you could try removing the -integer parameter fron the lsort command listed in the error message? *


Yup, getting rid of -integer from the lsort command on line 21 fixed the problem. Thanks!


----------



## sanderton

> _Originally posted by doubledrat _
> *is there an online resource at all? *


You're reading it. 

This, and the Db of Deals is all there is!

Ypu can figure most of it out with the MFS browser in TW, looking at existing code, and guessing!


----------



## didolgi

Well I've fallen in love with this module, but I've found a slight problem with it. My TiVo is in Los Angeles, but as we all know the TiVo uses GMT as its internal timeclock, so the schedule data for me shows a "day" as a period of time from 16:00-15:59 the next day. This makes perfect sense because thats midnight-midnight GMT. 

Before I start attempting to re-write this code to handle non-UK units I wonder if anybody has already attempted this?


----------



## goony

Is this module known to work on a DirecTivo running V4.0.1b? I have installed the module but the results are _always_ empty.

Thanks!


----------



## marklyn

This is what I get when I try to run the new episodes module (by chan):
INTERNAL SERVER ERROR
--cut here--
action_showcir '' ''
expected integer but got "18.1"
while executing
"lsort -integer [array names channeltablenum]"
(procedure "getchannelsir" line 10)
invoked from within
"getchannelsir"
(procedure "::action_showcir" line 4)
invoked from within
"::action_$action $chan $part $env"
("eval" body line 1)
invoked from within
"eval {::action_$action $chan $part $env}"
--cut here--

also does similar crash by date:
INTERNAL SERVER ERROR
--cut here--
action_shownewepisodes '' 'set "showdate" "13031";'
expected integer but got "18.1"
while executing
"lsort -integer [array names channeltablenum]"
(procedure "getchannelsir" line 10)
invoked from within
"getchannelsir"
(procedure "::action_shownewepisodes" line 8)
invoked from within
"::action_$action $chan $part $env"
("eval" body line 1)
invoked from within
"eval {::action_$action $chan $part $env}"
--cut here--

I've had my tivo up and running for at least 3 days so it's got a full schedule listing. Any ideas where I've gone wrong?


----------



## sanderton

This is someting to do with the way TiVo stors "locals" whatever they might be. We don't have them in the UK.


----------



## b166er

Is it possible (and easy) to limit the results of this to be only programs on your favorite channels ?


----------



## sanderton

I guess you could write a filter into it.


----------



## b166er

sanderton said:


> I guess you could write a filter into it.


Doing it now


----------



## Fred1

Hi

Looks like there are a couple of useful variations on this very nice module from Stuart.

Any chance someone could post a couple of links to the filtered versions (time and channels)

Or even better, a version that integrates it all?

Thanks (hopefully)


----------



## b166er

sanderton said:


> I guess you could write a filter into it.


Well, this is my first stab at doing anything in TCL. A TiVoWeb API would have been useful. I never figured out how to tell if a channel is a favourite channel. So instead, I hard-coded my list of personal favourites (only about 20 channels) into the tcl file itself.

It's not an ideal way of doing it obviously. If someone knows how to determine if a channel is a favourite then it would be much better than what I've done. I've marked my changes with #DD. I took LJ's "evening" version as a basis.

It currently limits results to these sky channels:

BBC1NE, BBC2, ITV1TYN, C4, FIVE, SKYONE, SKYTWO, SKY3, UKGLD, UKG2, LIVING, LIVIN2, BBC2, BBC4, ITV2, ITVTHREE, ITV4, PCOM1, PCOM2, E4, MORE4

I deliberately left the +1 channels out of the list.


----------



## sanderton

Look in the code for a TiVoWeb module which allows you to filter by favourites. I think TW loads a list at startup.


----------



## b166er

sanderton said:


> Look in the code for a TiVoWeb module which allows you to filter by favourites. I think TW loads a list at startup.


Yeah I tried that. The only tivoweb module I could think of is the TWP one that lets you modify your channel preferences (received & favourite). It wasn't obvious what was going on. I think I'll get myself a tivoweb api somehow and not have to rely on someone else's code (which is more difficult being a TCL newbie also).


----------



## b166er

Fred1 said:


> Any chance someone could post a couple of links to the filtered versions (time and channels)


Ok, here they are. Two versions both modified to filter by favourites. I took the original 0.2 version by stuart and the evening 0.2 version by LJ and added a favourites filter to each of them.

Maybe someone more advanced in TCL/Tivoweb can make a combined version that offers a menu choice for all-day or evening but that's beyond my current knowledge.

Here they are then, I changed the version number to 0.2f (f for favorites)


----------



## Fred1

You're a star - thanks

Will take a look at the code myself to see if there is any chance I could contribute (or even learn) something.


----------



## 10203

Just noticed this thread's active again... back when it first started I updated my What's On module to highlight new episodes and added a tick box to display only new episodes - it's about half way down this page. Feel free to grab bits of code.


----------



## b166er

LJ said:


> Just noticed this thread's active again... back when it first started I updated my What's On module to highlight new episodes and added a tick box to display only new episodes - it's about half way down this page. Feel free to grab bits of code.


Thanks LJ, I might be pilfering some code from there later


----------



## marklyn

OK, I'm venturing a guess that either of these two won't work on my tivoweb 1.2.1 because they are written for UK programming/line ups?

When I try to check by channel they fail with:
INTERNAL SERVER ERROR
--cut here--
action_shownewepisodes '' 'set "showdate" "13162";'
expected integer but got "18.1"
while executing
"lsort -integer [array names channeltablenum]"
(procedure "getchannelsir" line 10)
invoked from within
"getchannelsir"
(procedure "::action_shownewepisodes" line 8)
invoked from within
"::action_$action $chan $part $env"
("eval" body line 1)
invoked from within
"eval {::action_$action $chan $part $env}"
--cut here--


----------



## b166er

marklyn said:


> OK, I'm venturing a guess that either of these two won't work on my tivoweb 1.2.1 because they are written for UK programming/line ups?
> 
> When I try to check by channel they fail with:
> INTERNAL SERVER ERROR


It wasn't specifically written (by Stuart) for UK lineup, but it seems to not like the US style digital channels (e.g. "10.1"). The original 0.2 version will have the same problem and I don't know how to fix it with my limited knowledge at this stage.

Perhaps removing any instance of -integer might do it, but you try it at your own risk. I doubt it has the power to do any real harm if it's a bad idea.


----------



## PhilG

I notice that at the very top of the thread, it says "If you have Sky, be patient!" - how patient??

I have installed the script, done a rull restart of Tivoweb but when I select the "by channel" option, all I get is:

Find New Episodes on: 

at the top of the screen, and nothing else seems to be happening (so far as I can tell, Explorer is not waiting for anything else from Tivoweb)??

What did I do wrong??


----------



## PhilG

The search by day also only seems to return the headings

Also, when I installed this module, Tivowebs "info" module stopped working.

I get:
INTERNAL SERVER ERROR
--cut here--
action_info '/' ''
can't open object (0x00030007)

while executing
"db $db open /Setup"
("uplevel" body line 2)
invoked from within
"uplevel $body"
invoked from within
"transaction {uplevel $body}"
(procedure "RetryTransaction" line 5)
invoked from within
"RetryTransaction {
set setup [db $db open /Setup]
set remoteaddress [dbobj $setup get RemoteAddress]
}"
(procedure "::action_info" line 104)
invoked from within
"::action_$action $chan $part $env"
("eval" body line 1)
invoked from within
"eval {::action_$action $chan $part $env}"
--cut here--

I have removed the "newepisodes.itcl" script from the tivoweb modules directory, done a full restart of Tivoweb now, AND "NEW EPISODES" STILL APPEARS IN THE MENU and Info still doesn't work

HELP!!!!!


----------



## sanderton

If it still appears in the menu after removing the file then you either haven't done a fulll restart or your browser is showing a cached copy.


----------



## PhilG

Something odd was definately going on. Whilst I was trying to sort this out, Tivo rebooted 

Trying it all again know (typing with fingers crossed is not easy!)

OK, newepisodes re-FTPd and TivoWeb fully restarted

the 'info' script is now OK, as is 'newepisodes'

Sorry for the faulty fault report


----------



## Bobbis2000

When I try to use it, I get this:
INTERNAL SERVER ERROR
--cut here--
action_showcir '' ''
expected integer but got "17.2"
while executing
"lsort -integer [array names channeltablenum]"
(procedure "getchannelsir" line 10)
invoked from within
"getchannelsir"
(procedure "::action_showcir" line 4)
invoked from within
"::action_$action $chan $part $env"
("eval" body line 1)
invoked from within
"eval {::action_$action $chan $part $env}"
--cut here--

Any ideas?
Thanks,
Rob


----------

