hacking web epg for ease of reading

chris_c

New Member
NB I forgot this only applies to the custom firmware - but I kinda assumed everyone has done it as its so good!

I like to have 4 hours at a time viewable, however at this means teeeensy weeeensy text you can't see
and of course if you up the magnification you then can't see all four hours

A temporary fix is to hack one of the web cgi files, and as it turned out it was very much easier than I thought

this gives me 4 hours on one horizontal screen full at 100% browser zoom

this bodge has three negative points
  • It will only last until the epg web package is upgraded
  • the channel logo over runs the channel title a bit (I can live with this)
  • short 5 to 15 min programs like kids cartoons in the morning will show as ellipsis (but
    you can mouse over them as normal) again I can really live with this!
You should not follow these instructions unless you are absolutely sure you know what you are doing.

first telnet into box and change to the path where the file is we want to edit

cd /opt/var/mongoose/cgi-bin

then make a backup of the file

cp epg7day.jim epg7day.jim.orig

please do this as when if you make a rick it makes it a lot easier to start afresh

next step is to download the file called epg7day.jim

look for a line near the top of the script

set cellwidth 8

change the 8 to a 4 then save the file and upload it back to your box (I recommend filezilla for this as it does it transparently, detects when you save the local temp file and ups it for you)

the change should take effect immediately, and I know its only a simple change but please do back up the file in case....
 
further hacking for the foolish brave only

When you scroll down the list of channels on the 7 day epg its all too easy to loose track of where a specific time column is, this hack will repeat the title bar with the time in it (07:00 | 08:00 etc) every eight lines

first you have to locate the loop that actually prints out the epg data, it starts
foreach record $records {
above this line add the following line
set lineNum 0
now inside the loop look for this if statement
if {$num ne $currentchannel} {
after the code the if clause contains (but inside the if clause!) add the following code
incr lineNum
if ($lineNum>8) {
set lineNum 0

}
immediately after setting the lineNum to zero we want to print the title row again, locate this block of code further up the script
it consists of six puts statments one of them in a for loop
copy and paste this code into our if statement and you should be good to go!
 
Before I break my Foxsat HDR, is it OK to use a text editor that puts LF/CR as a line termimator, such as MS Notepad, or must you use one that does only LF. If so which prog does this?

Edit: Done the cell width mod using MS Explorer and Notepad. Works OK and is much better (apart from the slight probs that you mention, no sweat). Had a 404 error on reload, but a return to the home page and a click on 7 Day EPG works OK after the first few heartstopping seconds
 
I haven't had the misfortune of having to use windows for a number of years, so I have no idea how its mangling of simple text files will effect you... from memory i seem to remember there was something called pfe programmers file editor or something similar that would save out with unix line ending - but it was a number of years ago...

glad the hack was some use to you! :D

incidentally I think despite my dire warnings stuffing up the epg probably wouldn't (shouldn't?) mess up the rest of the web front end which you could use to uninstall and reinstall the epg package.

failing that you can always use opkg from telnet.....
 
Thanks for the reply.
I did take your dire warnings seriously and made a copy of the file before I started editing it.
Must have a Google for a unix editor. I'll post back for the benefit of us poor Windows users.
 
Hi Chris.
I'm a glutton for punishment and brave stupid and will give anything a go (even if I don't know what I am doing), but would appreciate a bit of a pointer here please. (Ask me one on MS Visual Basic, and I'm in with a bit of a chance)
Have found EditPad Lite 7 which seems to render the code correctly.
I want to have a go at the repeating header, but don't understand enough about the language. I'm ok with the set lineNum 0 above foreach record $records { but how is the if clause if {$num ne $currentchannel} {
terminated so that I can do the next bit, specifically my emboldened bit?
'after the code the if clause contains (but inside the if clause!) add the following code'
incr lineNum
if ($lineNum>8) {
set lineNum 0

and presumably the required puts statements are these?

puts "
<table class=borders style=\"table-layout:fixed;width:[expr [expr $HoursToDisplay * 60 * $cellwidth] + [expr 26 * $cellwidth]]px;\">
"
set i 0
puts "<tr>"
while {$i < [expr [expr $HoursToDisplay * 60] + 26]} {
puts "<td style=\"width:[expr $cellwidth]px; border:0\"></td>"
incr i
}
puts "</tr>"
puts "
<tr>
<th colspan=26 style=\"width:[expr $cellwidth * 26]px\">Channel</th>
"
puts -nonewline "<th colspan=60 style=\"width:[expr $cellwidth * 60]px; text-align:left\">[clock format $StartBand -format %H]:00 "
puts [clock format $StartBand -format "%A %B %e %Y"]
puts "</th>"
for {set i 1} {$i < $HoursToDisplay} {incr i} {
puts "<th colspan=60 style=\"width:[expr $cellwidth * 60]px; text-align:left\">[clock format [expr $StartBand + [expr $i * 3600]] -format %H]:00</th>"
}
puts "</tr>"

Trev
 
very sorry its taken me so long to get back to you the site never mailed me about the reply ??

make it look something like this.....

incr lineNum
if ($lineNum>8) {
set lineNum 0

puts "<tr><th colspan=26 style=\"width:[expr $cellwidth * 26]px\">Channel</th>"
puts -nonewline "<th colspan=60 style=\"width:[expr $cellwidth * 60]px; text-align:left\">[clock format $StartBand -format %H]:00 "
puts [clock format $StartBand -format "%A %B %e %Y"]
puts "</th>"
for {set i 1} {$i < $HoursToDisplay} {incr i} {
puts "<th colspan=60 style=\"width:[expr $cellwidth * 60]px; text-align:left\">[clock format [expr $StartBand + [expr $i * 3600]] -format %H]:00</th>"
}
puts "</tr>"

}

I only came back here after looking how I did it after needing to redo it after an update!

Trev - you've got a bunch more code than you need ;) - let me know if the above doesn't work for you...
 
Thanks Chris. I wondered where you had gone :=). I'll give your code a stiff looking at to see if I can work out whats going on and then venture forth into the realms of editing and screwing up my Hummy :=).
I'll let you know how I get on, but it won't be for a couple of days. Busy and all that, places to go, people to see.
 
Brilliant, worked a treat. Thanks a lot Chris. Must see if I can make the repeat work in the Now/Next
 
cool really glad you got it working - this damn site hates me no notification email again :( ah well - just as well I checked...

PM me if you get stuck with Now/Next - you never know I might get a notification :rolleyes:
 
Works OK for me. Dummy question, but I suppose that you have set up the alert preferences in your profile?
 
Yeah, and here's the odd thing I got an email for you last post, just now, but not the previous one!
 
I wonder if it is it one of those things that does not email you again unless you have followed the link in the first email like some forums use, presumably to cut down on the number of emails they send?
 
nah it's some kind of bug I'm thinking, cause I always jump on email notifications and blast off a response - typically it now seems to be working exactly like it should be - bloody typical!
 
Hi Chris. Now here's a challenge for you. Instead of repeating the time headers every 8 rows, fix them at the top, so the data scrolls but the time does not. Oh, and while your'e at it, you might as well make the left hand colums fixed so that the channel is visible all the time instead of scrolling off to the left:):cool::hug: Or perhaps even the original author, can't remember who it was, could improve his 7day EPG by incorporating the above mods. That would make it even better than the excellent bit of programming that it is already.:D
 
I personally hate those bars that bounce round catching up with your window as it scrolls...

I think you can find out how to do it here if you are sufficiently interested.....
 
Back
Top