1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Automatic soft padding running on the TiVo

Discussion in 'TiVo Series 1 - UK' started by sanderton, Oct 8, 2003.

Thread Status:
Not open for further replies.
  1. Oct 11, 2003 #81 of 1197
    pahunt

    pahunt Active Member

    1,719
    0
    Apr 7, 2003
    England
    Not on mine. I had version 1 running for about 24 hours without a hitch and there must have been about a dozen recordings done during that time as well. I've only had 1.01 installed for a couple of hours now but no problems so far.
     
  2. Oct 11, 2003 #82 of 1197
    LJ

    LJ New Member

    786
    0
    Nov 11, 2001
    West...
    Originally posted by sanderton
    I'm aiming to make it so that it simply doesn't need to know about what is soft and what is hard. (Insert own Carry On joke here..)

    Nice module Stuart! ;) :D

    Maybe you could code the original padding into the recalculated figure. Looks like there are 8 possible values for padding: 1, 2, 5, 15, 30, 60, 90 and 180 minutes (unless you're MrTickle and have hacked the database ;) ). They're stored in the database in seconds, so you've got all the values inbetween that will never be used by the UI. You could add the index into that array to the padding value so you could decode which one was originally used. e.g. to encode:
    Code:
    set ui_padding_values { 0, 60, 120, 300, 900, 1800, 3600, 5400, 10800 }
    
    set padding_in_db [defaultval 0 [dbobj $rec get EndPadding]]
    set new_padding [lsearch -exact $ui_padding_values $padding_in_db]
    if { $new_padding > -1 } {
       incr new_padding $default_soft_padding_value
    } else {
       puts "Hello MrTickle!"
    }
    
    To decode:
    Code:
    set flag [expr $current_padding_from_db % 10]
    set original_padding [lindex $ui_padding_values $flag]
     
  3. Oct 11, 2003 #83 of 1197
    pahunt

    pahunt Active Member

    1,719
    0
    Apr 7, 2003
    England
    Just spotted one thing that might be a problem but it might just be how it's supposed to work.

    I had a suggestion that was scheduled from 10:20am to 10:50am this morning and then Friends started recording at 10.55am. I have got it set to use 5 minutes of soft padding but none was used on the suggestion. As it actually had exactly 5 minutes inbetween recordings I would have expected it to pad it.
     
  4. Oct 11, 2003 #84 of 1197
    Fozzie

    Fozzie New Member

    837
    0
    Sep 3, 2001
    Alton,...
    I thought that and checked but it doesn't!?! In fact, none of my SPs do because I removed it all when I used softpad. I'll keep a check on the logs and see if it happens again.

    I did have another question about something that happened last night though. A suggestion (I think) was scheduled to start straight after an explicit recording. From your answer earlier in this thread, a suggestion will get cancelled in order to soft pad a regular recording. That appears to have happened below:

    Sat Oct 11 04:54:01 localtime 2003 : Waiting a minute before checking for kill
    Sat Oct 11 04:55:00 localtime 2003 : Recording in progressSat Oct 11 04:55:00 localtime 2003 : Channel: ITV2
    Sat Oct 11 04:55:00 localtime 2003 : Programme: Rugby
    Sat Oct 11 04:55:00 localtime 2003 : Scheduled End Time: Sat Oct 11 04:59:58 localtime 2003
    Sat Oct 11 04:55:00 localtime 2003 : Next Channel: DISCOV
    Sat Oct 11 04:55:00 localtime 2003 : Next Programme: {Cleopatra's Palace: In Search of a Legend}
    Sat Oct 11 04:55:00 localtime 2003 : Next Scheduled Start Time: Sat Oct 11 05:00:00 localtime 2003
    Sat Oct 11 04:55:00 localtime 2003 : Added 5 minutes padding
    Sat Oct 11 04:55:00 localtime 2003 : Sleep until Sat Oct 11 05:55:00 localtime 2003
    Sat Oct 11 04:55:00 localtime 2003 : Waiting a minute before checking for kill

    Sat Oct 11 05:54:00 localtime 2003 : Waiting a minute before checking for kill
    Sat Oct 11 05:55:00 localtime 2003 : No recording in progress
    Sat Oct 11 05:55:00 localtime 2003 : Next recording starts: Sat Oct 11 06:00:00 localtime 2003
    Sat Oct 11 05:55:00 localtime 2003 : Next Channel: UKBRID
    Sat Oct 11 05:55:00 localtime 2003 : Next Programme: {Garden ER}
    Sat Oct 11 05:55:00 localtime 2003 : Next Scheduled Start Time: Sat Oct 11 06:00:00 localtime 2003
    Sat Oct 11 05:55:00 localtime 2003 : Sleep until Sat Oct 11 06:25:00 localtime 2003
    Sat Oct 11 05:55:00 localtime 2003 : Waiting a minute before checking for kill

    Once the padding was added it then says 'Sleep until Sat Oct 11 05:55:00' which is presumeably when the now cancelled suggestion {Cleopatra's Palace: In Search of a Legend} was due to finish. What happens if as a result of the suggestion being cancelled, a recording is scheduled for the now empty slot 05:05:00 to 06:00:00? Will Endpad pick it up or does it do nothing until the end of the sleep period? If not, what about when there is say 6 hours between recordings - will Endpad sleep until the end of the recording that starts in 6 hours time and/or will it still pick up recordings subsequently scheduled?

    Many thanks. Oh yeah, it has been stable so far - a day and half :)
     
  5. Oct 11, 2003 #85 of 1197
    ccwf

    ccwf 国際化 Member

    8,634
    0
    Dec 29, 2001
    Malibu
    Well, cancelling a suggestion should only enable TiVo to record replacement suggestions.

    For your other question, from the source it looks like it sleeps until the next time it thinks it's needed. You are right, there should be a cap on the amount of time endpad sleeps between checks so that it can detect changes to the To Do list, in particular from cancelling the current recording and choosing to record something else.
     
  6. Oct 11, 2003 #86 of 1197
    sanderton

    sanderton TiVoer since 11/2000

    6,341
    0
    Jan 4, 2002
    What will happen in this case it that it will wake up 5 mins before the now cancelled suggestion was due to finish. If another suggestion has taken its place, it will pad that. If not, back to sleep it goes until the next recording.

    It does not poll for a recording when running, it relies on the TDL. I'm trying to keep the overhead for running the script to the minimum.

    BTW, the reason I haven't posted a version wth Dibblah and ccwf's amendments in yet is that I've decided the next version will have start padding, and my blasted social life is interfering with my TiVo hacking!

    A start padding enabled version is running now on my TiVos, and I will post when I think it probably works. :)
     
  7. Oct 11, 2003 #87 of 1197
    sanderton

    sanderton TiVoer since 11/2000

    6,341
    0
    Jan 4, 2002
    3 hours?
     
  8. Oct 11, 2003 #88 of 1197
    ccwf

    ccwf 国際化 Member

    8,634
    0
    Dec 29, 2001
    Malibu
    Which is certainly a good thing.

    If you keep in memory the ID of the last show that's been padded, then you should be able to check very quickly whether or not the that recording is still current, in which case it can skip the rest of the logic and just go back to sleep.

    As for the cap on the sleep interval, I would suggest a half hour to an hour. Or just make it another command line option or argument.
     
  9. Oct 11, 2003 #89 of 1197
    Fozzie

    Fozzie New Member

    837
    0
    Sep 3, 2001
    Alton,...
    Thanks sanderton, I think I have it - endpad bases it's time to wake up on the TDL as it stands at the point 5 mins before the end of the current recording. If the TDL changes between that point and when it has decided to wake up, those new programmes will not get padded. I guess the TDL could change for a couple reasons:

    a. The next recording (a suggestion) gets cancelled because endpad has just padded the current recording. This could cause a different suggestion to be recorded. This would only get padded if it happened to end at or after the cancelled recording. If it ended before that, it would get missed by endpad. I don't see this as a drama because it's 'only' a suggestion. (Initially, I thought it might be but having typed through the logic I don't think it is!).

    b. If there was a large time gap between the current recording and the next scheduled one, there is more potential for either a user initiated recording to be scheduled or perhaps as a result of new guide data being loaded. This seems to be where there is most potential for endpad to accidentally miss something.

    I've no idea what the performance overhead would be and whether it's feasible, but would have thought 1/2 hour for checking the TDL would capture most changes, if not all.

    Keep up the excellent work. endpad has already saved me an ending :)
     
  10. Oct 11, 2003 #90 of 1197
    Chris T

    Chris T New Member

    222
    0
    Oct 30, 2002
    Leicstershir...
    Just found that Endpad fell over at 7.55pm, 55 minuets into recording an hour-long suggestion, and exactly 2 hours after it had been last started.

    The error was:

    syntax error in expression "1065898798 + * 60"
    while executing
    "expr "$endtime + $padding * 60""
    (file "/var/hack/endpad.tcl" line 158)

    Line 158: set newstoptime [expr "$endtime + $padding * 60"]
     
  11. Oct 11, 2003 #91 of 1197
    sanderton

    sanderton TiVoer since 11/2000

    6,341
    0
    Jan 4, 2002
    Thanks Chris, by co-incidence I just fixed that bug!

    I hope to post the new version tomorrow.
     
  12. Oct 11, 2003 #92 of 1197
    mas

    mas 274GB, Oct 2000-2011

    30
    0
    Jan 12, 2002
    West...
    There is definitely a problem when there is a gap between programs, it just happened to me....

    Prog 1 records at 1pm next sceduled prog is for 11pm

    after prog 1 is recorded next pad check is sceduled for within the program at 11pm and sleeps (checking kill file) until the 11pm program.

    If you then request a recording at 8pm this program does not have any padding added.

    When in sleep mode (checking for kill) it needs to recheck to see if there is an earlier program sceduled. every 5 mins ? dont know...

    Great Utility... Hope this helps.

    Mas
     
  13. Oct 11, 2003 #93 of 1197
    sanderton

    sanderton TiVoer since 11/2000

    6,341
    0
    Jan 4, 2002
    It's not quite that simple, as it is possible for endpad to wake up up to three times during a single recording, and it will have logic to process each time.

    But every 30 mins doesn't seem a huge overhead, I'll set it to that.
     
  14. Oct 11, 2003 #94 of 1197
    ccwf

    ccwf 国際化 Member

    8,634
    0
    Dec 29, 2001
    Malibu
    Are you saying that the recording database ID check wouldn't work (does the ID change?), or is the overhead for just waking up and checking the current recording's ID still significant?
     
  15. Oct 11, 2003 #95 of 1197
    sanderton

    sanderton TiVoer since 11/2000

    6,341
    0
    Jan 4, 2002
    There are circumstances (esp. now I'm adding start padding) when endpad can wake up more than once during a recording and do different things each time, so a simple "x is still recording so go straight back to sleep" won't work. Nor can I assume that all the retrieved data stays the same (eg, someone is recording the grand prix, discovers there's been a restart so comes in and adds 30 mins end padding. If endpad just assumed everything was the same as the first time it checked the db, that padding would get wiped 5 mins from the end!)

    However the overhead for a 30 minute check is so low that it will be fine. My first draft has the script not look ahead and just check every minute, but I was nervous about that, especially as I already run one (LJ's red dot) which does pretty much the same thing..
     
  16. Oct 11, 2003 #96 of 1197
    bobnick

    bobnick New Member

    862
    0
    Jun 6, 2002
    London
    The Binary transfer worked a treat, and I've finally found out to track down and kill the FTP process on Tivo, so I don't need to restart the unit when FTP hangs! However.... Endpad crashed on me this evening. It's also a bugger to restart, as you have to delete the PID file (which said 1793).

    The error code was
    PHP:
    error writing "file1"I/O error
        
    while executing
    "puts "retrying after $errorCode ...""
        
    (procedure "RetryTransaction" line 12)
        
    invoked from within
    "RetryTransaction {
            set currec [mfs scan "
    /Recording/Active" -start "3:" -count 1]
          }"
        
    (file "./end.tcl" line 128)
    Was this down to the fact I'd renamed the tcl file? (I'd had to use http_get to get the binary to my Tivo as FTP crashed after the ascii transfer)

    The error log:
    Sat Oct 11 16:36:00 localtime 2003 : Next Channel: ITV1LON
    Sat Oct 11 16:36:00 localtime 2003 : Next Programme: {Pop Idol}
    Sat Oct 11 16:36:00 localtime 2003 : Next Scheduled Start Time: Sat Oct 11 18:05:00 localtime 2003
    Sat Oct 11 16:36:00 localtime 2003 : Added 3 minutes padding
    Sat Oct 11 16:36:00 localtime 2003 : Sleep until Sat Oct 11 19:00:00 localtime 2003
    -NB Isn't this GMT rather than localtime?
    Then...
    Sat Oct 11 16:36:00 localtime 2003 : Waiting a minute before checking for kill
    repeated every minute until
    Sat Oct 11 18:59:01 localtime 2003 : Waiting a minute before checking for kill

    I'd cancelled the pending Pop Idol recording @ 6.03pm to record WWI on Channel 4, by pressing record on live TV and going to options and chosing record new portion (high quality)

    And as for waking endpad up every 30 minutes, might it be an idea to wake it every 29 minutes, so the overhead is spread throughout the hour, just in case it regularly clashes with other things?
     
  17. Oct 11, 2003 #97 of 1197
    Fozzie

    Fozzie New Member

    837
    0
    Sep 3, 2001
    Alton,...
    Ok, there's something really strange going on here.

    If I start endpad from rc.sysinit.author then TiVo tries to dial up to get its' guide data instead of using Turbonet. Take the endpad entry out, reboot and it's back to using the ethernet port. Put endpad back in, reboot and it tries to dial again!

    My rc.sysinit.author:

    #!/bin/bash
    /var/hack/tivoweb-tcl/tivoweb
    /var/hack/endpad.tcl 5 -auto

    TivoWeb runs fine with or without the endpad entry. Confused :confused:

    (As an aside, what does -auto switch do?)
     
  18. Oct 11, 2003 #98 of 1197
    ccwf

    ccwf 国際化 Member

    8,634
    0
    Dec 29, 2001
    Malibu
    Auto tries to kill an existing endpad.tcl process (if it exists) and then waits two minutes for boot-up to complete.
     
  19. Oct 12, 2003 #99 of 1197
    sanderton

    sanderton TiVoer since 11/2000

    6,341
    0
    Jan 4, 2002
     
  20. Oct 12, 2003 #100 of 1197
    sanderton

    sanderton TiVoer since 11/2000

    6,341
    0
    Jan 4, 2002
    Sorry, had to think about that for a minute!

    My mistake. The line should be:

    /var/hack/endpad.tcl 5 -auto >> /dev/null &

    I had thought rc.sysinit.author ran last of all on startup, but rc.net runs after it. endpad had a two minute pause in it, which it seems is long enough to bggr up the code in rc.net which configures TiVo to use the internet for guide data.

    Apologies.
     
Thread Status:
Not open for further replies.

Share This Page