Compare commits

...

30 Commits

Author SHA1 Message Date
hummypkg
c3a41bed59 update to 0.7.4
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@441 2a923420-c742-0410-a762-8d5b09965624
2011-10-04 20:06:56 +00:00
hummypkg
903a4453bb more work on dedup
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@440 2a923420-c742-0410-a762-8d5b09965624
2011-10-04 20:02:59 +00:00
hummypkg
761def1a24 checkpoint
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@439 2a923420-c742-0410-a762-8d5b09965624
2011-10-03 22:47:44 +00:00
hummypkg
e832d05b17 update 0.7.3
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@437 2a923420-c742-0410-a762-8d5b09965624
2011-10-03 09:39:17 +00:00
hummypkg
3b8720c6d4 EPG update
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@436 2a923420-c742-0410-a762-8d5b09965624
2011-10-03 09:37:24 +00:00
hummypkg
2fb26975e2 new db based EPG
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@433 2a923420-c742-0410-a762-8d5b09965624
2011-09-29 23:22:02 +00:00
hummypkg
93f1b67ba1 add epg parser
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@432 2a923420-c742-0410-a762-8d5b09965624
2011-09-29 22:58:13 +00:00
hummypkg
6daa4e28f5 add alternate epg implementations
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@427 2a923420-c742-0410-a762-8d5b09965624
2011-09-27 20:26:36 +00:00
hummypkg
9a72e40c03 improve system busy detection
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@424 2a923420-c742-0410-a762-8d5b09965624
2011-09-26 20:31:17 +00:00
hummypkg
9b2f138fd9 update
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@420 2a923420-c742-0410-a762-8d5b09965624
2011-09-25 18:25:09 +00:00
hummypkg
22db1fbbd6 add icons, fix Mux name
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@418 2a923420-c742-0410-a762-8d5b09965624
2011-09-22 22:29:43 +00:00
hummypkg
a9f4bd4f0b remove iajax code for now
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@417 2a923420-c742-0410-a762-8d5b09965624
2011-09-22 20:27:41 +00:00
hummypkg
31688eaa1c add doctype to headers, fix iajax problem
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@416 2a923420-c742-0410-a762-8d5b09965624
2011-09-22 20:15:26 +00:00
hummypkg
926a49737a add new channel icons, detect MUX
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@413 2a923420-c742-0410-a762-8d5b09965624
2011-09-21 20:21:13 +00:00
hummypkg
fbb64a2e9f fix padding
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@409 2a923420-c742-0410-a762-8d5b09965624
2011-09-19 17:11:18 +00:00
hummypkg
ff322fdc39 update channel icons, support padding
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@407 2a923420-c742-0410-a762-8d5b09965624
2011-09-18 22:19:54 +00:00
hummypkg
d29ed50f7f allow scheduling reminders; flag for reboot after event cancel
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@402 2a923420-c742-0410-a762-8d5b09965624
2011-09-15 23:08:15 +00:00
hummypkg
7113208940 add totop
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@400 2a923420-c742-0410-a762-8d5b09965624
2011-09-14 22:38:22 +00:00
hummypkg
0b566bca72 add mod version to front page
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@397 2a923420-c742-0410-a762-8d5b09965624
2011-09-14 19:59:56 +00:00
hummypkg
f235b05026 fix insert bugs
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@396 2a923420-c742-0410-a762-8d5b09965624
2011-09-14 16:58:11 +00:00
hummypkg
af87e1a66e update
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@390 2a923420-c742-0410-a762-8d5b09965624
2011-09-13 19:16:02 +00:00
hummypkg
ed225ca751 fix split events, check for duplicates
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@385 2a923420-c742-0410-a762-8d5b09965624
2011-09-11 21:59:08 +00:00
hummypkg
cfb12b7da6 move scheduling code to class, support split events
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@384 2a923420-c742-0410-a762-8d5b09965624
2011-09-11 21:23:42 +00:00
hummypkg
1d44efdcdc add channel info page
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@381 2a923420-c742-0410-a762-8d5b09965624
2011-09-09 19:38:37 +00:00
hummypkg
0eb305c32c fix bug in restore
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@372 2a923420-c742-0410-a762-8d5b09965624
2011-09-07 18:07:06 +00:00
hummypkg
6797ee4416 minor tweaks and fix system diskspace
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@364 2a923420-c742-0410-a762-8d5b09965624
2011-09-05 22:23:29 +00:00
hummypkg
510c6c7407 fix reboot busy check
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@354 2a923420-c742-0410-a762-8d5b09965624
2011-09-04 00:18:07 +00:00
hummypkg
f6bf03691d use findhsvc class
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@352 2a923420-c742-0410-a762-8d5b09965624
2011-09-03 23:26:54 +00:00
hummypkg
b378ec1b9c create system class and use it. Expand rsv fetch to include ersvtype
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@344 2a923420-c742-0410-a762-8d5b09965624
2011-09-02 19:50:10 +00:00
hummypkg
df85584352 fix sql queries to use escaped parameters
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@339 2a923420-c742-0410-a762-8d5b09965624
2011-09-01 22:20:53 +00:00
69 changed files with 1536 additions and 242 deletions

View File

@@ -1,10 +1,10 @@
Package: webif
Priority: optional
Section: web
Version: 0.6.6
Version: 0.7.4
Architecture: mipsel
Maintainer: af123@hummypkg.org.uk
Depends: mongoose(>=3.0-2),jim(>=0.71-1),jim-sqlite3(>=0.71-1),jim-cgi(>=0.4),jim-oo,jim-pack,service-control,busybox(>=1.18.3-1),lsof,epg(>=1.0.3),hmt(>=1.0.6),ssmtp
Depends: mongoose(>=3.0-2),jim(>=0.71-1),jim-sqlite3(>=0.71-1),jim-cgi(>=0.4),jim-oo,jim-pack,service-control,busybox(>=1.18.3-1),lsof,epg(>=1.0.5),hmt(>=1.0.6),ssmtp
Replaces: af123-webif
Conflicts: af123-webif
Suggests: ffmpeg,webif-iphone

43
etc/init.d/S60parseepg Executable file
View File

@@ -0,0 +1,43 @@
#!/bin/sh
export PATH=/mod/bin:/mod/usr/bin:/mod/bin/busybox:/bin:/sbin
export LD_LIBRARY_PATH=/mod/lib:/lib:/usr/lib
export TZ=GMT+0BST,M3.5.0/1,M10.5.0/2
if [ -f /mnt/hd1/dvbepg/epg.dat ]; then
epg=/mnt/hd1/dvbepg/epg.dat
epgdb=/mnt/hd1/epg.db
else
epg=/media/drive1/epgsavedata
epgdb=/media/drive1/epg.db
fi
case "$1" in
start)
(
while [ 1 ]; do
if [ -f $epgdb ]; then
touch $epgdb.stamp
now=`stat -c %Z $epgdb.stamp`
dbstamp=`stat -c %Z $epgdb`
age=`expr $now - $dbstamp`
else
age=99999
fi
echo "EPG Database age: $age"
if [ $age -gt 28800 ]; then
sleep 120
echo "Generating EPG database..."
/mod/bin/epg -f $epg sqlitedump $epgdb
fi
sleep 3712
done
) &
;;
stop)
;;
*)
exit 1
;;
esac

View File

@@ -27,7 +27,7 @@ $(document).ready(function() {
});
});
$('#delete_button').click(function() {
var backup = $('input.restore').val();
var backup = $('input.restore:checked').val();
if (confirm('Confirm deletion of ' + backup))
{
$('#results').load('/cgi-bin/backup/delete.jim?' +
@@ -39,7 +39,7 @@ $(document).ready(function() {
}
});
$('#restore_button').click(function() {
var backup = $('input.restore').val();
var backup = $('input.restore:checked').val();
if (confirm('!!!!!!!!!!!!!!!!!!!!!!!!! PLEASE CONFIRM !!!!!!!!!!!!!!!!!!!!!!!!!\n\nAre you sure you wish to erase all scheduled recordings and favourite channels and then restore them from\n' + backup + '?'))
{
$('#restore_working').slideDown();

View File

@@ -3,7 +3,7 @@
package require cgi
source /mod/var/mongoose/lib/setup
require rsv.class
require rsv.class findhsvc system.class
set dir /mod/var/backup
@@ -29,29 +29,11 @@ if {![file exists $ffile]} {
}
if {[catch { set fd [open $ffile r] } msg]} {
puts "Error opening backup file. - $msg"
puts "Error opening <i>$file</i> - $msg"
exit
}
proc findhsvc {channel} {
global rsvdb
set hsvc [$rsvdb query "
select hSvc
from channel.TBL_SVC
where szSvcName = '$channel'
or szSvcname = '\025$channel'
limit 1
"]
if {[llength $hsvc] == 1} {
return [lindex [lindex $hsvc 0] 1]
} else {
return 0
}
}
puts "Restoring scheduled events..."
puts "Restoring scheduled events from <i>$file</i>..."
$rsvdb query {begin transaction;}
$rsvdb query {delete from TBL_RESERVATION;}
@@ -94,7 +76,11 @@ foreach line $data {
}
}
if {!$bad} { $rsv insert }
if {!$bad} {
if {[catch {$rsv insert pending 1} msg]} {
puts " Error inserting event, $msg"
}
}
}
$rsvdb query {commit transaction;}
@@ -111,7 +97,7 @@ foreach line $data {
set group [lindex $vals 1]
set type [lindex $vals 2]
set chan [lindex $vals 3]
set hsvc [findhsvc $chan]
set hsvc [get_channel_attr $chan]
if {$grp != $group} {
set grp $group
@@ -135,7 +121,7 @@ foreach line $data {
$rsvdb query {commit transaction;}
close [open /tmp/.restartpending w]
system restartpending
close $fd
rsv cleanup

View File

@@ -189,6 +189,32 @@ puts {
</form>
</div>
<div id=savestreamform title="Save streamed content"
style="display: none">
<div class=pre id=savestream_detail></div>
<form id=savestream_form>
}
puts "<input type=hidden name=dir value=\"$dir\">"
puts {
<table border=0>
<tr>
<th>
<label for="savestream_name">
<b>Filename</b>
</label>
</th>
<td>
<input type=text name="savestream_name"
id="savestream_name"
value="" size=70 maxlength=255
class="text ui-widget-content ui-corner-all">
<img id=savestream_spin src=/img/loading.gif>
</td>
</tr>
</table>
</form>
</div>
<div id=dialogue></div>
<div id=confirm title="Confirmation Required"></div>
@@ -232,5 +258,21 @@ foreach file [lsort [glob -nocomplain "$dir"]] {
puts "</fieldset>"
# De-duplicate
puts {
<small><button id=dedup>De-duplicate/tidy this folder</button></small>
}
# Streamer file
if {[file exists /mnt/hd3/Streamer_down_file]} {
puts {
<small><button id=save_stream file=/mnt/hd3/Streamer_down_file>
Save last streamed content (e.g. iPlayer/YouTube)
</button></small>
}
}
footer

View File

@@ -88,6 +88,18 @@ function rename_submit()
function() { window.location.reload(true); });
}
function savestream_submit()
{
var s = $('#savestream_form').serialize();
var sf = $('#save_stream').attr('file');
$('#savestream_spin').show();
$.get('/cgi-bin/browse/savestream.jim?sfile=' +
encodeURIComponent(sf) + '&' + s,
function() {
window.location.reload(true);
});
}
var $confirm; // Populated after DOM is loaded.
function confirm_action(action, callback, file, type, id)
@@ -266,6 +278,19 @@ var menuclick = function(action, el, pos)
close: function() { $('#rename').val(''); }
});
$('#savestreamform').dialog({
autoOpen: false,
height: 'auto', width: 'auto',
modal: true,
buttons: {
"Save": savestream_submit,
"Cancel": function() {
$(this).dialog('close');
}
},
close: function() { $('#savestream_name').val(''); }
});
// Create re-usable confirmation dialogue.
$confirm = $('#confirm').dialog({
modal: true, autoOpen: false,
@@ -283,5 +308,18 @@ var menuclick = function(action, el, pos)
// Flag folders with unwatched items
$.getJSON('/cgi-bin/browse/newdir.jim?dir=' + encodeURIComponent(dir),
new_folder_callback);
$('#dedup').button().click(function() {
window.location = '/cgi-bin/dedup.jim?dir='
+ encodeURIComponent(dir);
});
$('#save_stream').button().click(function() {
$('#savestream_spin').hide();
$('#savestreamform').dialog('open');
$('#savestream_detail').load(
'/cgi-bin/browse/ffmpeg.jim?file=' +
encodeURIComponent($('#save_stream').attr('file')));
});
});

View File

@@ -0,0 +1,21 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/ts.class
puts "Content-Type: text/html"
puts ""
cgi_input
#cgi_dump
set dir [cgi_get dir "/media/My Video"]
set file [file tail [cgi_get savestream_name]]
set sfile [cgi_get savestream_source "/mnt/hd3/Streamer_down_file"]
if {$file == "0"} { exit }
if {[string length [string trim $file]] == 0} { exit }
if {[file extension $file] ne ".mp4"} { append file ".mp4" }
file copy $sfile "$dir/$file"

134
var/mongoose/cgi-bin/channel.jim Executable file
View File

@@ -0,0 +1,134 @@
#!/mod/bin/jimsh
package require cgi
package require sqlite3
source /mod/var/mongoose/lib/setup
require altrow progressbar epg.class
puts "Content-Type: text/html"
puts ""
header
cgi_input
proc f2c {frequency} {
set ch int($((($frequency / 1000) - 303.25) / 8))
return [expr int($ch)]
}
if {[catch {set db [sqlite3.open /var/lib/humaxtv/channel.db]} msg]} {
puts "Error opening channel database: $msg"
exit
}
puts "
<button id=expandall>Expand All</button>
<button id=collapseall>Collapse All</button>
<br><br>
<table class=borders>
<tr>
<th>Channel</th>
<th>Frequency</th>
<th>Signal Strength</th>
<th>Signal Quality</th>
<th>Mux</th>
<th>Channels</th>
<th>&gt;799</th>
</tr>
"
foreach tw [$db query {
select tsIdx, usTsID, ulFrequency, ucLevel, ucQuality
from TBL_TS
order by ulFrequency
}] {
lassign $tw x tsIdx x usTsID x ulFrequency x ucLevel x ucQuality
altrow
puts "
<td>[f2c $ulFrequency]</td>
<td>[expr $ulFrequency / 1000.0] MHz</td>
"
puts "<td>[progressbar $ucLevel]</td>"
puts "<td>[progressbar $ucQuality]</td>"
set channels [$db query {
select usLcn, szSvcName, szPrvName, aucDefaultAuthority
from TBL_SVC left join TBL_PRV using (prvIdx)
where tsIdx = %s
order by usLcn
} $tsIdx]
set mux "???"
set ehs 0
foreach chan $channels {
lassign $chan x lcn x name
set name [string range $name 1 end]
if {$lcn >= 800} { incr ehs }
switch $name {
"BBC ONE" { set mux "PSB1/BBC A" }
"ITV1" { set mux "PSB2/D3&amp;4" }
"BBC One HD" { set mux "PSB3/BBC B (HD)" }
"ITV3" { set mux "COM4/SDN" }
"Dave" { set mux "COM5/ARQ A" }
"Film4" { set mux "COM6/ARQ B" }
}
}
puts "<td>$mux</td>"
puts "<td>[llength $channels]
<a class=mchan ts=$tsIdx href=#>
<img border=0 height=14
src=/images/421_1_00_CH_Title_2R_Arrow.png>
view
</a></td>"
puts "<td>$ehs</th>"
puts "</tr>"
puts "<tr id=mchan_$tsIdx class=mchan style=\"display: none\">
<td colspan=5>"
puts "<table style=\"margin-left: 5em\">"
puts "<tr>
<th colspan=3>Channel</th>
<th>Provider</th>
<th>Authority</th>
</tr>"
foreach chan $channels {
lassign $chan x lcn x name x prv x auth
set name [string range $name 1 end]
set prv [string range $prv 3 end]
altrow
puts "<td class=va>"
puts "[epg channelicon $name 50]</td>
<td>$lcn</td><td>$name</td>"
puts "</td><td>"
puts $prv
puts "</td><td>"
puts $auth
puts "</td>"
puts "</tr>"
}
puts "</table>"
puts "</td></tr>"
}
puts "</table>"
puts {
<script type=text/javascript>
$(document).ready(function() {
$('a.mchan').click(function(e) {
e.preventDefault();
$('#mchan_' + $(this).attr('ts')).slideToggle('slow');
});
$('#expandall').button().click(function() {
$('tr.mchan').slideDown('slow');
});
$('#collapseall').button().click(function() {
$('tr.mchan').slideUp('slow');
});
});
</script>
}

View File

@@ -8,6 +8,14 @@ require altrow
puts "Content-Type: text/html"
puts ""
set databases {
/var/lib/humaxtv/rsvp.db
/var/lib/humaxtv/rsv.db
/var/lib/humaxtv/setup.db
/var/lib/humaxtv/channel.db
/mnt/hd2/dms_cds.db
}
header
cgi_input
@@ -62,11 +70,16 @@ proc db_info {db_file} {
$db close
}
db_info /var/lib/humaxtv/rsvp.db
db_info /var/lib/humaxtv/rsv.db
db_info /var/lib/humaxtv/setup.db
db_info /var/lib/humaxtv/channel.db
db_info /mnt/hd2/dms_cds.db
if {$fdb == 0} {
puts "Please choose database to view:<ul>"
foreach db $databases {
puts "<li><a href=$::env(REQUEST_URI)?db=[file tail $db]>
$db</a></li>"
}
puts "</ul>"
} else {
foreach db $databases { db_info $db }
}
footer

122
var/mongoose/cgi-bin/dedup.jim Executable file
View File

@@ -0,0 +1,122 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
require ts.class pretty_size altrow
puts "Content-Type: text/html"
puts ""
cgi_input
#cgi_dump
set dir [cgi_get dir "/media/My Video"]
set doit [cgi_get doit 0]
# Strip double slashes
header
puts "<fieldset style=\"display: inline\">
<legend>De-duplicate <span id=dir>$dir</span></legend>
<table class=borders>
<tr>
<th>File</th>
<th>Proposed Filename</th>
<th>Proposed Title</th>
<th>Status</th>
</tr>
"
regsub -all -- {\/+} "$dir/*" "/" sdir
set seen {}
foreach file [lsort [glob -nocomplain "$sdir"]] {
if {[file extension $file] ne ".hmt"} { continue }
altrow
set ts [ts fetch $file 1]
set base [file tail [file rootname $file]]
puts "<td nowrap>$base</td>"
set syn [$ts get synopsis]
regsub -nocase -all -- {^new series\.* *} $syn "" syn
regsub -all -- { *[:].*$} $syn "" syn
if {[string length $syn] > 40} {
lassign [split $syn "."] v w
set syn $v
if {[string length $syn] < 6 && [string length $w] < 6} {
append syn "_$w"
}
}
if {[string length $syn] < 10} {
if {[string match "${syn}*" [$ts get title]]} {
set syn [$ts get title]
} else {
append syn " [$ts get title]"
}
}
regsub -all -- {[\/ &]} $syn "_" fn
puts "<td>$fn</td>"
puts "<td>$syn</td>"
puts "<td>"
if {$fn in $seen} {
puts -nonewline "Duplicate"
if {$doit} {
set dupdir "$dir/_duplicates"
if {![file exists $dupdir]} { file mkdir $dupdir }
while {[file exists $dupdir/$fn.hmt]} {
append fn "~"
}
ts renamegroup $file "_duplicates/$fn"
puts -nonewline " - Renamed to _duplicates/$fn"
}
} elseif {[string length $syn] > 40} {
puts -nonewline "Cannot process"
} elseif {$base eq $fn} {
puts -nonewline "Nothing to do"
} elseif {$doit} {
# Dooooo, it.
$ts settitle $syn
ts renamegroup $file $fn
puts -nonewline "Done"
}
lappend seen $fn
puts "</td>"
puts "</tr>"
}
puts {
</table>
</fieldset>
<div style="padding-top: 2em">
<small>
<button id=browse>Back to media browser</button>
}
if {!$doit} { puts "<button id=dedup>Process folder</button>" }
puts {
</small>
</div>
<script type=text/javascript>
$('#browse').button().click(function() {
window.location = '/cgi-bin/browse.jim?dir=' +
encodeURIComponent($('#dir').text());
});
}
if {!$doit} {
puts {
$('#dedup').button().click(function() {
window.location = window.location + '&doit=1';
});
}
}
puts "</script>"
footer

View File

@@ -2,7 +2,7 @@
package require cgi
source /mod/var/mongoose/lib/setup
require epg.class
require epg.class system.class
puts "Content-Type: text/html"
puts ""
@@ -10,10 +10,6 @@ puts ""
cgi_input
#cgi_dump
#set _cgi(service) 4170
#set _cgi(event) 38584
#set _cgi(type) 2
if {![dict exists $_cgi service] || ![dict exists $_cgi event]} {
puts "Error, insufficient parameters passed."
exit
@@ -35,48 +31,12 @@ if {[$event percent] > 0} {
exit
}
$event get_channel_info
set args {}
set args(ersvtype) 3
set args(hsvc) [$event get channel_hsvc]
set args(nsttime) [$event get start]
set args(nduration) [$event get duration]
set args(usevtid) [$event get event_id]
set args(szevtname) "\025[$event get name]"
set args(eReady) 30
set ccrid [$event get channel_crid]
if {$type == 1} {
# Event
set args(ucCRIDType) 49
set args(ucRecKind) 1
set args(szCRID) "$ccrid[$event get event_crid]"
set args(szEventToRecord) "1$args(szCRID)|"
set r [rsv construct $event $type]
if {[catch {$r insert} msg]} {
puts "Error encountered while scheduling: <i>$msg</i>"
} else {
# Series
set args(ucCRIDType) 50
set args(ucRecKind) 4
set args(szCRID) "$ccrid[$event get series_crid]"
set args(szFPBRecPath) "$args(szevtname)"
set progs [lmap i [epg fetch dump -scrid [$event get series_crid]] {
if {[set ecrid [$i get event_crid]] eq ""} { continue }
list "1$::ccrid$ecrid"
}]
set args(szEventToRecord) "[join $progs "|"]|"
}
#puts $args
set msg ""
#if {![file exists /mod/.schedule.testing]} { set msg "Disabled during testing" }
if {$msg ne "" || [catch {[rsv new $args] insert} msg]} {
puts "Error encountered while scheduling the recording: <i>$msg</i>"
} else {
puts "Successfully scheduled recording of <i>[$event get name]</i>"
close [open /tmp/.restartpending w]
puts "Successfully scheduled <i>[$event get name]</i>"
system restartpending
}
epg cleanup

View File

@@ -9,6 +9,8 @@ puts ""
header
require totop
puts "<script type=text/javascript src=/js/jquery.highlight.js></script>"
cgi_input

View File

@@ -9,6 +9,8 @@ puts ""
header
require totop
[spinner new {
text "Loading EPG Data..."
size "1.2em"

View File

@@ -2,7 +2,7 @@
package require cgi
source /mod/var/mongoose/lib/setup
require rsv.class
require rsv.class system.class
puts "Content-Type: text/html"
puts ""
@@ -11,8 +11,7 @@ cgi_input
if {[cgi_get now] eq "yes"} {
# - Busybox reboot does sync the disk but may still not be clean enough.
puts "Restarting."
exec /etc/init.d/S90settop shut
exec /sbin/reboot
system reboot
exit
}

View File

@@ -2,7 +2,7 @@
package require cgi
source /mod/var/mongoose/lib/setup
require rsv.class
require rsv.class system.class
puts "Content-Type: text/html"
puts ""
@@ -24,3 +24,5 @@ $event clear_ulslot
$event set_delete
$event insert
system restartpending

View File

@@ -2,7 +2,7 @@
package require cgi
source /mod/var/mongoose/lib/setup
require rsv.class
require rsv.class progressbar
puts "Content-Type: text/html"
puts ""

View File

@@ -16,6 +16,7 @@ set settings [settings new]
set hostname [$settings hostname]
set smtp_server [$settings smtp_server]
set channel_group [$settings channel_group]
set epg_style [$settings epg_style]
set pkgdev [$settings pkgdev]
# Handle updates
@@ -51,6 +52,7 @@ proc handle_str_update {var old {text "Value"}} {
handle_str_update hostname $hostname Hostname
_handle_update ascii smtp_server $smtp_server "SMTP Server"
handle_int_update channel_group $channel_group "Channel Group"
handle_str_update epg_style $epg_style "EPG Type"
if {[dict exists $_cgi pkgdevoff] && ![dict exists $_cgi pkgdev]} {
set _cgi(pkgdev) 0
}
@@ -107,13 +109,36 @@ puts "
</tr>
"
puts "
<tr>
<form class=auto id=epg_style method=get action=$env(REQUEST_URI)>
<th class=key>Default Now/Next style</th>
<td><select id=epg_style name=epg_style
class=\"text ui-widget-content ui-corner-all\">
"
puts "<option value=standard"
if {$epg_style ne "grid"} { puts " selected" }
puts ">Standard\n"
puts "<option value=grid"
if {$epg_style eq "grid"} { puts " selected" }
puts ">Grid\n"
puts "
</select>
<small>
<input name=epg_style value=\"set\" type=submit>
</small>
<div id=epg_style_output></div>
</td>
</form>
</tr>
"
puts "
<tr>
<form class=auto id=channel_group method=get action=$env(REQUEST_URI)>
<th class=key>Channel Group for EPG</th>
<td><select id=channel_group name=channel_group
class=\"text ui-widget-content ui-corner-all\"
value=[$settings channel_group]>
class=\"text ui-widget-content ui-corner-all\">
"
set i 0

229
var/mongoose/cgi-bin/xepg.jim Executable file
View File

@@ -0,0 +1,229 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
puts "Content-Type: text/html"
puts ""
header
require epg.class spinner.class altrow epg_search totop
cgi_input
puts {<link type="text/css" href="/css/xepg.css" rel="Stylesheet" />}
[spinner new {
text "Loading Now/Next Information..."
size "1.2em"
style "margin: 1em;"
}] start
require epg_popup
set stt [cgi_get stt [clock seconds]]
if {$stt <= [clock seconds]} {
set stt [clock seconds]
set current 1
} else {
set current 0
}
set favlist [epg favlist]
set hours 4.0
set seconds $($hours * 3600)
set ostt $stt
set stt [expr int($stt / 1800.0) * 1800]
set ett $(int($stt + $seconds))
set offset $(($ostt - $stt) / 1800.0)
set chanpx 120
set eventpx 1000
set totalpx $($chanpx + $eventpx)
set contwidth $($totalpx + 50)
set hourpx $($eventpx / $hours)
set minpx $($hourpx / 60.0)
set secpx $($minpx / 60.0)
set start [clock milliseconds]
if {$::qepg} {
set records [epg dbfetch dump -trange "$stt:$ett"]
} else {
require channelsort
set records [channelsort [epg fetch dump -trange "$stt:$ett"]]
}
set got [clock milliseconds]
puts "<div id=buttons style=\"width: $eventpx; margin-left: ${chanpx}px;\">"
if {$stt > [clock seconds]} {
puts "<button id=earlier>&lt;&lt;&lt; Earlier</button>"
}
puts "<button id=later>Later &gt;&gt;&gt;</button>"
puts "</div>"
puts "
<div id=xepg style=\"min-width: ${contwidth}px; overflow: auto\">
<div id=xepgnow></div>
<div id=xegrid>
"
puts "<div id=epgdate style=\"width: ${eventpx}px; margin-left: ${chanpx}px;\">"
puts [clock format $stt -format {%a %D}]
puts "</div>"
puts "<div class=xechan style=\"width: ${chanpx}px;\">&nbsp;</div>"
for {set i 0} {$i < $hours * 2} {incr i} {
puts "<div class=xetime id=xe$i
style=\"width: [expr $minpx * 30]px\">"
puts "[clock format $($stt + 1800 * $i) -format "%H:%M"]</div>"
}
set lim 0
set lcn 0
set bg "odd"
foreach e $records {
if {$favlist != "" && [$e get service_id] ni $favlist} {
continue
}
set chnum [$e get channel_num]
if {$chnum == 0} { continue }
if {$chnum != $lcn} {
puts "<div class=xechan style=\"width: ${chanpx}px;\">"
puts "[$e channel_icon 30]&nbsp;"
puts "$chnum
<a href=/cgi-bin/epg_service.jim?service=[$e get service_id]
title=\"[$e get channel_name]\">
[$e get channel_name]
</a></div>"
set lcn $chnum
set le 0
set pos 0
if {$bg eq "odd"} { set bg "even" } else { set bg "odd" }
}
set es [$e get start]
set ee [expr $es + [$e get duration]]
if {$es < $le} continue
if {$es < $stt} { set es $stt }
if {$ee > $ett} { set ee $ett }
set le $ee
set left [expr int(($es - $stt) * $secpx)]
set right [expr int(($ee - $stt - 1) * $secpx)]
set px $($right - $left)
if {$pos < $left} {
set px $($px + $left - $pos - 1)
} elseif {$pos > $left} {
set px $($px - ($pos - $left - 1))
}
incr pos $px
$e process_sched
set recopts 1
if {[$e get series_crid] ne ""} { set recopts 2 }
set perc [$e percent]
set showing 0
if {$perc > 0 && $perc < 100} { set showing 1 }
set txt "[cgi_quote_html [$e get name]] <span>([\
clock format $es -format "%H:%M"] - [\
clock format $ee -format "%H:%M"])"
if {$showing} { append txt " ($perc%)" }
append txt "</span>"
set htxt "[cgi_quote_html [$e get name]] ([\
clock format $es -format "%H:%M"] - [\
clock format $ee -format "%H:%M"])"
if {$showing} { append hxt " ($perc%)" }
puts "<div class=\"xeprog $bg\"
style=\"width: [expr $px - 4]px;\" title=\"$htxt\">
<a class=event href=# xs=[$e get service_id]
xe=[$e get event_id] sch=[$e get sched_type]
rec=$recopts>"
puts $txt
puts "</a>"
puts "</div>"
}
puts "<div id=keypos style=\"float: left; clear: left;\"></div>"
puts "</div>"
puts "</div>"
set earlier $($stt - 3600 * 4)
puts "
<div style=\"clear: both;\">
<small><button id=epgswitch>
Switch to standard now/next display.
</button></small>
</div>
<script type=text/javascript>
\$(document).ready(function() {
\$('#epgswitch').button().click(function() {
window.location = '/epg.shtml';
});
\$('#earlier').button().click(function() {
window.location = '/cgi-bin/xepg.jim?stt=$earlier';
});
\$('#later').button().click(function() {
window.location = '/cgi-bin/xepg.jim?stt=$ett';
});
"
if {$current} {
puts {
var kt = $('#xe0');
var ktpos = kt.position();
var height = $('#keypos').position().top - ktpos.top;
}
puts "var nowpos = ktpos.left + (kt.width() * $offset);"
puts {
if (window.console)
console.log('NOWPOS: %d', nowpos);
$('#xepgnow')
.css('left', nowpos + 'px')
.css('top', ktpos.top)
.height(height)
.show('slow');
}
}
puts "
});
</script>
"
puts "
<a href=/cgi-bin/settings.jim>
<img border=0 height=14 src=/images/421_1_00_CH_Title_2R_Arrow.png>
Visit settings to change EPG options.
</a><br>
"
set end [clock milliseconds]
puts "<font class=footnote>
Retrieved in: [expr [expr $got - $start] / 1000.0] seconds.
</font>"
epg cleanup
footer

View File

@@ -70,13 +70,13 @@ table.borders, table.borders td, table.borders th
empty-cells: show;
}
table tr.odd, table td.odd, table th.odd
.odd
{
background: #ccff99;
color: black;
}
table tr.even, table td.even, table th.even
.even
{
background: #ffffcc;
color: black;

View File

@@ -0,0 +1,30 @@
#toTop {
background: url("/img//ui.totop.png") no-repeat scroll left top transparent;
border: medium none;
bottom: 110px;
display: none;
height: 51px;
margin-left: 50px;
overflow: hidden;
position: fixed;
text-decoration: none;
text-indent: -999px;
width: 77px;
z-index: 2000;
}
#toTopHover {
background: url("/img/ui.totop.png") no-repeat scroll left -51px transparent;
display: block;
float: left;
height: 51px;
opacity: 0;
overflow: hidden;
width: 77px;
}
#toTop:active, #toTop:focus {
outline: medium none;
}

View File

@@ -0,0 +1,113 @@
div#xepg
{
position: relative;
}
div#xepgnow
{
display: none;
position: absolute;
width: 2px;
height: 100%;
background: yellow;
top: 0px;
left: 0px;
z-index: 9999;
box-shadow: 2px 2px 11px #666;
-moz-box-shadow: 2px 2px 11px #666;
-webkit-box-shadow: 2px 2px 11px #666;
opacity:0.7;
/*filter:alpha(opacity=70);*/
}
div.xetick
{
display: none;
position: absolute;
width: 1px;
height: 100%;
background: #ccc;
top: 0px;
left: 0px;
/*
z-index: 9999;
box-shadow: 2px 2px 11px #666;
-moz-box-shadow: 2px 2px 11px #666;
-webkit-box-shadow: 2px 2px 11px #666;
opacity:0.7;
*/
/*filter:alpha(opacity=70);*/
}
div#epgdate
{
border-left: 1px solid #669933;
border-right: 1px solid #669933;
border-top: 1px solid #669933;
clear: left;
float: left;
}
/*
div#xegrid
{
}
*/
div.xerow
{
}
div.xechan
{
vertical-align: middle;
float: left;
clear: left;
white-space: nowrap;
overflow: hidden;
height: 25px;
padding: 3px 0;
margin: 3px 0;
}
div.xechan img
{
vertical-align: middle;
}
div.xetime
{
float: left;
border-left: 1px solid #669933;
}
div.xeprog
{
overflow: hidden;
white-space: nowrap;
float: left;
vertical-align: middle;
height: 25px;
padding: 4px 0 3px 2px;
margin: 3px 0 3px 2px;
border: 1px solid #ccc;
border-radius: 10px;
-moz-border-radius: 10px;
}
div.xeprog span
{
font-style: italic;
font-size: 0.7em;
}
div#buttons
{
padding: 0.5em;
}
button#later
{
margin-left: 2em;
}

View File

@@ -0,0 +1 @@
blank.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

@@ -0,0 +1 @@
blank.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -0,0 +1 @@
../S4C.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -0,0 +1 @@
blank.png

View File

@@ -0,0 +1 @@
blank.png

View File

@@ -0,0 +1 @@
blank.png

View File

@@ -0,0 +1 @@
blank.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@@ -48,11 +48,11 @@ $(document).ready(function() {
</div>
<div style="float: left">
<center>
<a href=/epg.shtml>
<a href=<!--#exec cmd="/mod/var/mongoose/include/epgloc.jim" -->>
<img src=/images/328_1_26_Menu_TV_Guide.png border=0 width=217 height=228>
</a>
<br>
<a href=/epg.shtml>
<a href=<!--#exec cmd="/mod/var/mongoose/include/epgloc.jim" -->>
<b>EPG</b>
</a>
<br>
@@ -111,6 +111,8 @@ $(document).ready(function() {
<div class=footer>
<ul>
<li>
<a href=/cgi-bin/channel.jim>Channel Information</a>
</li><li>
<a href=/cgi-bin/db.jim target=_blank>SQLite3 Database Dump</a>
</li><li>
<a href=/jim/ref.html target=_blank>Jim Reference Manual</a> |
@@ -118,6 +120,7 @@ $(document).ready(function() {
<a href=/jim/sqlite.html target=_blank>Sqlite</a>
</li>
</ul>
<!--#exec cmd="/mod/var/mongoose/include/modversion.jim" -->
</div>
<!--#include virtual="/lib/footer.shtml" -->

View File

@@ -0,0 +1,142 @@
/*
* jQuery EasIng v1.1.2 - http://gsgd.co.uk/sandbox/jquery.easIng.php
*
* Uses the built In easIng capabilities added In jQuery 1.1
* to offer multiple easIng options
*
* Copyright (c) 2007 George Smith
* Licensed under the MIT License:
* http://www.opensource.org/licenses/mit-license.php
*/
// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.extend( jQuery.easing,
{
easeInQuad: function (x, t, b, c, d) {
return c*(t/=d)*t + b;
},
easeOutQuad: function (x, t, b, c, d) {
return -c *(t/=d)*(t-2) + b;
},
easeInOutQuad: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t + b;
return -c/2 * ((--t)*(t-2) - 1) + b;
},
easeInCubic: function (x, t, b, c, d) {
return c*(t/=d)*t*t + b;
},
easeOutCubic: function (x, t, b, c, d) {
return c*((t=t/d-1)*t*t + 1) + b;
},
easeInOutCubic: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t + b;
return c/2*((t-=2)*t*t + 2) + b;
},
easeInQuart: function (x, t, b, c, d) {
return c*(t/=d)*t*t*t + b;
},
easeOutQuart: function (x, t, b, c, d) {
return -c * ((t=t/d-1)*t*t*t - 1) + b;
},
easeInOutQuart: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
return -c/2 * ((t-=2)*t*t*t - 2) + b;
},
easeInQuint: function (x, t, b, c, d) {
return c*(t/=d)*t*t*t*t + b;
},
easeOutQuint: function (x, t, b, c, d) {
return c*((t=t/d-1)*t*t*t*t + 1) + b;
},
easeInOutQuint: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
return c/2*((t-=2)*t*t*t*t + 2) + b;
},
easeInSine: function (x, t, b, c, d) {
return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
},
easeOutSine: function (x, t, b, c, d) {
return c * Math.sin(t/d * (Math.PI/2)) + b;
},
easeInOutSine: function (x, t, b, c, d) {
return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
},
easeInExpo: function (x, t, b, c, d) {
return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
},
easeOutExpo: function (x, t, b, c, d) {
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
},
easeInOutExpo: function (x, t, b, c, d) {
if (t==0) return b;
if (t==d) return b+c;
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
},
easeInCirc: function (x, t, b, c, d) {
return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
},
easeOutCirc: function (x, t, b, c, d) {
return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
},
easeInOutCirc: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
},
easeInElastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
},
easeOutElastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
},
easeInOutElastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
},
easeInBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
return c*(t/=d)*t*((s+1)*t - s) + b;
},
easeOutBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
},
easeInOutBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
},
easeInBounce: function (x, t, b, c, d) {
return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
},
easeOutBounce: function (x, t, b, c, d) {
if ((t/=d) < (1/2.75)) {
return c*(7.5625*t*t) + b;
} else if (t < (2/2.75)) {
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
} else if (t < (2.5/2.75)) {
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
} else {
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
}
},
easeInOutBounce: function (x, t, b, c, d) {
if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
}
});

View File

@@ -33,7 +33,8 @@ jQuery.ajaxPrefilter(function(options, _, jqXHR) {
}
}
} catch(e) {
alert(e);
if (window.console)
console.log(e);
}
}, options.progressInterval);

60
var/mongoose/html/js/jquery.ui.totop.js vendored Normal file
View File

@@ -0,0 +1,60 @@
/*
|--------------------------------------------------------------------------
| UItoTop jQuery Plugin 1.1
| http://www.mattvarone.com/web-design/uitotop-jquery-plugin/
|--------------------------------------------------------------------------
*/
(function($){
$.fn.UItoTop = function(options) {
var defaults = {
text: 'To Top',
min: 400,
inDelay:600,
outDelay:300,
containerID: 'toTop',
containerHoverID: 'toTopHover',
scrollSpeed: 1000,
easingType: 'linear'
};
var settings = $.extend(defaults, options);
var containerIDhash = '#' + settings.containerID;
var containerHoverIDHash = '#'+settings.containerHoverID;
$('body').append('<a href="#" id="'+settings.containerID+'">'+settings.text+'</a>');
$(containerIDhash).hide().click(function(){
$('html, body').animate({scrollTop:0}, settings.scrollSpeed, settings.easingType);
$('#'+settings.containerHoverID, this).stop().animate({'opacity': 0 }, settings.inDelay, settings.easingType);
return false;
})
.prepend('<span id="'+settings.containerHoverID+'"></span>')
.hover(function() {
$(containerHoverIDHash, this).stop().animate({
'opacity': 1
}, 300, 'linear');
}, function() {
$(containerHoverIDHash, this).stop().animate({
'opacity': 0
}, 600, 'linear');
});
$(window).scroll(function() {
var sd = $(window).scrollTop();
if(typeof document.body.style.maxHeight === "undefined") {
$(containerIDhash).css({
'position': 'absolute',
'left': 20,
'top': $(window).scrollTop() + $(window).height() - 50
});
}
if ( sd > settings.min )
$(containerIDhash).fadeIn(settings.inDelay);
else
$(containerIDhash).fadeOut(settings.Outdelay);
});
};
})(jQuery);

View File

@@ -1,4 +1,5 @@
puts {
<!doctype html>
<html>
<head>
<title>

View File

@@ -1,3 +1,4 @@
<!doctype html>
<html>
<head>
<title><!--#exec cmd="/mod/var/mongoose/include/model.jim" --></title>

View File

@@ -42,7 +42,7 @@ Update package list from Internet
<div id=dspinner><img border=0 src=/img/loading.gif>Processing request...</div>
</div>
<script type=text/javascript src=/js/iajax.js></script>
<!-- <script type=text/javascript src=/js/iajax.js></script> -->
<script type=text/javascript>
var opkg = '/cgi-bin/opkg.jim?cmd=';
@@ -71,35 +71,38 @@ $(document).ready(function() {
close: function(e,u) { window.location.reload(true); }
});
jQuery.ajaxSetup({progressInterval: 1});
function loaddata(data, isfinal)
{
console.log('loaddata called, final=' + isfinal);
console.log('Data: ' + data);
$('#dresults').append(data);
if (isfinal)
$('#dspinner').hide('slow');
}
// jQuery.ajaxSetup({progressInterval: 1});
//
// function loaddata(data, isfinal)
// {
// console.log('loaddata called, final=' + isfinal);
// console.log('Data: ' + data);
// $('#dresults').append(data);
// if (isfinal)
// $('#dspinner').hide('slow');
// }
function execopkg(arg)
{
$('#dspinner').show();
$dialog.dialog('open');
$('#dresults').empty();
$.ajax({
type: "GET",
url: opkg + arg,
progress: loaddata,
success: function(data) {
console.log("ajax success");
loaddata(data, true);
},
error: function(_, _, e) {
console.log("ajax error");
alert(e);
}
$('#dresults').load(opkg + arg, function() {
$('#dspinner').hide('slow');
});
// $('#dresults').empty();
// $.ajax({
// type: "GET",
// url: opkg + arg,
// progress: loaddata,
// success: function(data) {
// console.log("ajax success");
// loaddata(data, true);
// },
// error: function(_, _, e) {
// console.log("ajax error");
// alert(e);
// }
// });
}
function setup_buttons()

View File

@@ -1,27 +1,9 @@
#!/mod/bin/jimsh
proc extract {line} {
regsub -all -- {[[:space:]]+} $line " " line
set fields [split $line]
set ::size [lindex $fields 1]
set ::used [lindex $fields 2]
set ::perc [string trimright [lindex $fields 4] "%"]
}
set used 0
set size 0
set perc 0
foreach df [split [exec df -h 2>>/dev/null] "\n\r"] {
if {[string match *sd?2* $df]} {
extract $df
break;
}
if {[string match *media/drive? $df]} {
extract $df
}
}
source /mod/var/mongoose/lib/setup
require system.class
lassign [system diskspace] size used perc
set file [format "%02d" [expr {$perc * 25 / 100 + 1}]]
# The HD model only has the USB images which are blue. I prefer the green

View File

@@ -2,7 +2,7 @@
package require cgi
source /mod/var/mongoose/lib/setup
require epg.class spinner.class altrow epg_search
require epg.class spinner.class altrow epg_search totop
[spinner new {
text "Loading Now/Next Information..."
@@ -13,51 +13,60 @@ require epg.class spinner.class altrow epg_search
require epg_popup
set start [clock milliseconds]
set records [epg fetch dump -time [clock seconds]]
set now [clock seconds]
set then $($now + 14400)
if {$::qepg} {
set records [epg dbfetch dump -trange "$now:$then"]
} else {
require channelsort
set records [channelsort [epg fetch dump -trange "$now:$then"]]
}
set got [clock milliseconds]
set favlist [epg favlist]
puts {
<small><button id=switch>Switch to grid-style Now/Next</button></small>
<script type=text/javascript>
$('#switch').button().click(function() {
window.location = '/cgi-bin/xepg.jim'; });
</script>
<table class=borders>
<tr>
<th colspan=3>Channel</th>
<th>On Now</th>
<th>On Next</th>
<th>On Later</th>
</tr>
}
proc rsort {v1 v2} {
set v1s [$v1 get channel_num]
set v2s [$v2 get channel_num]
if {$v1s == $v2s} { return 0 }
if {$v1s > $v2s } { return 1 }
return -1
}
set lcn 0
set num 0
foreach record $records {
$record get_channel_info
}
foreach record [lsort -command rsort $records] {
if {$favlist != "" && [$record get service_id] ni $favlist} {
continue
}
altrow
set num [$record get channel_num]
puts "<td>$num</td>"
puts "<td>[$record channel_icon 50]</td>
<td>
set chnum [$record get channel_num]
if {$chnum == 0} { continue }
if {$chnum != $lcn} {
if {$lcn > 0} { puts "</tr>" }
altrow
puts "<td>$chnum</td>"
puts "<td>[$record channel_icon 50]</td>
<td>
<a href=/cgi-bin/epg_service.jim?service=[$record get service_id]>
[$record get channel_name]
</a></td>"
catch {
puts [$record cell]
puts [[$record next] cell]
[$record get channel_name]
</a></td>"
set lcn $chnum
set num 0
}
incr num
if {$num < 4} {
catch { puts [$record cell] }
}
puts "</tr>"
}
if {$lcn > 0} { puts "</tr>" }
puts "</table>"
puts "

11
var/mongoose/include/epgloc.jim Executable file
View File

@@ -0,0 +1,11 @@
#!/mod/bin/jimsh
source /mod/var/mongoose/lib/setup
require settings.class
if {[[settings] epg_style] eq "grid"} {
puts -nonewline "/cgi-bin/xepg.jim"
} else {
puts -nonewline "/epg.shtml"
}

View File

@@ -1,15 +1,7 @@
#!/mod/bin/jimsh
if {[catch {set fp [open /etc/model r]}]} {
set model {HD[R]}
} else {
set model [string trim [read $fp]]
close $fp
}
source /mod/var/mongoose/lib/setup
require system.class
if {[catch {set hostname [string trim [exec hostname]]}]} {
set hostname "humax"
}
puts "Humax $model Fox T2 ($hostname)"
puts "Humax [system model] Fox T2 ([system hostname])"

View File

@@ -0,0 +1,10 @@
#!/mod/bin/jimsh
source /mod/var/mongoose/lib/setup
require system.class
puts "<font class=blood style=\"font-size: 0.9em; float: right; clear: right\">
Web interface version: [system pkgver webif]<br>
Custom firmware version: [system modversion]
</font>"

View File

@@ -1,5 +1,8 @@
#!/mod/bin/jimsh
source /mod/var/mongoose/lib/setup
require system.class
if {[file exists /tmp/.restartpending]} {
puts {
@@ -12,12 +15,7 @@ puts {
<font class=blood>
}
# Is humaxtv doing anything?
set pid [exec pgrep humaxtv]
set c 0
catch { set c [exec /mod/bin/lsof -p $pid | grep Video | fgrep .ts | wc -l] }
if {$c > 0} {
if {[system busy]} {
puts "Cannot restart whilst box is busy."
} else {
puts {

View File

@@ -1,7 +1,7 @@
#!/mod/bin/jimsh
source /mod/var/mongoose/lib/setup
require altrow rsv.class progressbar
require altrow rsv.class progressbar epg.class
puts {
<div id=dialogue></div>
@@ -91,8 +91,14 @@ $(document).ready(function() {
</script>
}
proc eventheader {{table TBL_RESERVATION}} {
proc eventheader {{table TBL_RESERVATION} note} {
puts {
<fieldset style="display: inline; padding: 1em">
<legend>
}
puts "<h3>$note</h3>"
puts {
</legend>
<table class="borders tablesorter">
<thead>
<tr>
@@ -148,8 +154,7 @@ proc eventrow {event {table TBL_RESERVATION}} {
if {[$event get usLcn] ne ""} {
puts "
<td>
<img src=\"/img/channels/[$event channel_name].png\"
width=50>
[epg channelicon [$event channel_name] 50]
</td>
<td nowrap>[$event get usLcn]<br>
[$event channel_name]</td>
@@ -168,25 +173,29 @@ proc eventrow {event {table TBL_RESERVATION}} {
set e $($s + $d)
set n [clock seconds]
if { $n > $e } {
puts "<td class=blood nowrap class=va>"
} else {
puts "<td nowrap class=va>"
}
puts "[clock format $s -format "%a %d %b %Y"]<br>
set ds "[clock format $s -format "%a %d %b %Y"]<br>
[clock format $s -format "%H:%M %Z"]"
if {$d > 0 && $n > $s && $n < $e} {
puts "<br>"
set perc [expr [expr $n - $s] * 100 / $d]
puts "<img class=va src=/images/745_1_11_Video_1REC.png>"
puts [progressbar $perc]
if { $n > $e && [$event get ersvtype] <= 3} {
puts "<td nowrap class=va
alt=\"$ds\" title=\"$ds\">
--- -- --- ----<br>--:--"
puts "</td><td>--:--:--</td>"
} else {
puts "<td nowrap class=\"va"
if {$n > $e} { puts " blood" }
puts "\">$ds"
if {$d > 0 && $n > $s && $n < $e} {
puts "<br>"
set perc [expr [expr $n - $s] * 100 / $d]
puts "<img class=va
src=/images/745_1_11_Video_1REC.png>"
puts [progressbar $perc]
}
puts "</td><td>"
puts "[clock format [$event get nduration] -format %T]</td>"
}
puts "</td>"
puts "<td>[clock format [$event get nduration] -format %T]</td>"
puts "<td nowrap>$rsvicon $RKIcon</td>"
if {[$event get aulEventToRecordInfo] != ""} {
puts "<td><img src=/img/lightning.png
@@ -199,13 +208,12 @@ proc eventrow {event {table TBL_RESERVATION}} {
}
proc eventfooter {} {
puts "</tbody></table>"
puts "</tbody></table></fieldset>"
}
set events [rsv list pending]
if {[llength $events] > 0} {
puts "<h2>Pending Schedule Events</h2>"
eventheader pending
eventheader pending "Pending Scheduled Events"
foreach event $events {eventrow $event pending}
eventfooter
puts {
@@ -217,13 +225,13 @@ if {[llength $events] > 0} {
}
}
puts "<h2>Scheduled Events</h2>"
set events [rsv list]
eventheader
eventheader "live" "Scheduled Events"
foreach event $events {eventrow $event}
eventfooter
puts {
<br>
<small>
<button onclick="window.location='/backup.shtml';">
Backup/Restore Scheduled Recordings/Events

View File

@@ -0,0 +1,22 @@
proc _channelsort {v1 v2} {
set v1s [$v1 get channel_num]
set v2s [$v2 get channel_num]
if {$v1s > $v2s } { return 1 }
if {$v1s == $v2s} {
set v1t [$v1 get start]
set v2t [$v2 get start]
if {$v1t > $v2t} { return 1 }
if {$v1t == $v2t} { return 0 }
return -1
}
return -1
}
proc channelsort {records} {
foreach record $records {
$record get_channel_info
}
return [lsort -command _channelsort $records]
}

View File

@@ -5,13 +5,21 @@ if {![exists -proc sqlite3.open ]} { package require sqlite3 }
require settings.class progressbar rsv.class
set ::channeldb 0
catch { set ::channeldb [sqlite3.open /var/lib/humaxtv/channel.db] }
set ::epgpath /mnt/hd1/dvbepg/epg.dat
set ::epgdbpath /mnt/hd1/epg.db
set ::hdepgpath /media/drive1/epgsavedata
if {![file exists $::epgpath] && [file exists $::hdepgpath]} {
set ::epgpath $::hdepgpath
set ::epgdbpath /media/drive1/epg.db
}
set ::channeldb 0
set ::qepg 0
catch { set ::channeldb [sqlite3.open /var/lib/humaxtv/channel.db] }
if {[file exists $::epgdbpath]} {
$::channeldb query {attach database '%s' as epg} $::epgdbpath
set ::qepg 1
}
set ::rsvlookup [rsv lookuptab]
@@ -136,7 +144,7 @@ epg method get_channel_info {} {
set chan [lindex [$channeldb query {
select szSvcName, usLcn, aucDefaultAuthority, hsvc
from TBL_SVC
where usSvcId = %s} $service_id
where usSvcId = '%s'} $service_id
] 0]
if {[dict exists $chan usLcn]} {
set channel_num $chan(usLcn)
@@ -197,13 +205,18 @@ epg method icon_set {{height 0}} {
"<img src=/images/178_1_26_Icon_Recommend.png $height>"
}
if {[string match {/*#?} $event_crid]} {
lappend set \
"<img src=/images/178_1_26_Icon_Split.png $height>"
}
return $set
}
epg method cell {} {
set percent [$self percent]
puts "<td nowrap valign=top title=\"$text\">"
puts "<td nowrap valign=top>"
puts [join [$self icon_set 14] ""]
@@ -291,6 +304,7 @@ proc {epg exec} {mode args} {
-service { lappend cmd -S $args($arg) }
-event { lappend cmd -E $args($arg) }
-time { lappend cmd -@ $args($arg) }
-trange { lappend cmd -= $args($arg) }
-day { lappend cmd -/ $args($arg) }
-extra { set extra $args($arg) }
default { error "Invalid option, $arg" }
@@ -306,6 +320,56 @@ proc {epg exec} {mode args} {
return [exec {*}$cmd]
}
proc {epg dbfetch} {mode args} {
set records {}
set extra ""
set q "select distinct *,
usLcn as channel_num,
substr(szSvcName, 2) as channel_name,
aucDefaultAuthority as channel_crid,
hSvc as channel_hsvc
from epg.epg e join TBL_SVC c
on e.service_id = c.usSvcId where 1 "
foreach arg $args {
if {[string first "-" $arg] == 0} {
set v $args($arg)
switch -- $arg {
-crid { append q \
"and e.event_crid = '$v' " }
-scrid { append q \
"and e.series_crid = '$v' " }
-type { append q \
"and e.content_type = $v " }
-service { append q \
"and e.service_id = $v " }
-event { append q \
"and e.event_id = $v " }
-time { append q \
"and e.start < $v and e.end > $v " }
-trange {
lassign [split $v :] stt ett
append q "and (
(e.start > $stt and e.start < $ett) or
(e.end > $stt and e.end < $ett) or
(e.start < $stt and e.end > $stt)
) "
}
default { error "Invalid option, $arg" }
}
}
}
append q "order by channel_num, start"
#puts "QUERY -$q-"
set records {}
foreach rec [$::channeldb query $q] {
lappend records [epg new $rec]
}
return $records
}
proc {epg fetch} {mode args} {
set records ""
foreach line [split [epg exec $mode {*}$args] "\n"] {

View File

@@ -14,6 +14,7 @@ $(document).ready(function() {
.load('/cgi-bin/restartblock.jim');
});
$(":button:contains('Record')").fadeOut('slow');
$(":button:contains('Reminder')").fadeOut('slow');
}
var $buttons1 = {
@@ -21,6 +22,7 @@ $(document).ready(function() {
};
var $buttons2 = $.extend(
{"Record Programme": function() { doschedule(1) }},
{"Set Reminder": function() { doschedule(3) }},
$buttons1);
var $buttons3 = $.extend(
{"Record Series": function() { doschedule(2) }},

View File

@@ -55,7 +55,14 @@ cts 9 "Education" "Education/Science/Factual"
puts "</td><td>"
cts 10 "Leisure" "Leisure"
puts "</td><td><a href=/epg.shtml>Now/Next</a>"
puts "</td><td>"
if {[[settings] epg_style] eq "grid"} {
puts "<a href=/cgi-bin/xepg.jim>"
} else {
puts "<a href=/epg.shtml>"
}
puts "Now/Next</a>"
puts "</td></tr><tr><td>"

View File

@@ -1,41 +1,38 @@
if {![exists -proc findhsvc]} {
if {![exists -proc get_channel_attr]} {
require rsv.class
proc findhsvc {channel} {
proc get_channel_attr {channel {field hSvc}} {
global rsvdb
set hsvc [$rsvdb query "
select hSvc
set ff [$rsvdb query "
select $field
from channel.TBL_SVC
where szSvcName = '$channel'
or szSvcname = '\025$channel'
limit 1
"]
if {[llength $hsvc] == 1} {
return [lindex [lindex $hsvc 0] 1]
} else {
return 0
if {[llength $ff] == 1} {
return [lindex [lindex $ff 0] 1]
}
return ""
}
proc findhsvcbylcn {lcn} {
proc get_channel_attr_bylcn {lcn {field hSvc}} {
global rsvdb
set hsvc [$rsvdb query "
select hSvc
set ff [$rsvdb query "
select $field
from channel.TBL_SVC
where usLcn = $lcn
limit 1
"]
if {[llength $hsvc] == 1} {
return [lindex [lindex $hsvc 0] 1]
} else {
return 0
if {[llength $ff] == 1} {
return [lindex [lindex $ff 0] 1]
}
return 0
}
}

View File

@@ -2,7 +2,7 @@ source /mod/var/mongoose/lib/setup
if {![exists -proc class ]} { package require oo }
if {![exists -proc sqlite3.open ]} { package require sqlite3 }
if {![exists -proc settings ]} { require settings.class }
require settings.class system.class
set rsvdb [sqlite3.open /var/lib/humaxtv/rsv.db]
$rsvdb query {attach database '/var/lib/humaxtv/channel.db' as channel}
@@ -76,13 +76,21 @@ rsv method name {} {
return $name
}
rsv method padded {} {
if {$ulPreOffset > 0 || $ulPostOffset > 0} {
return 1
} else {
return 0
}
}
rsv method channel_name {} {
return [string range $szSvcName 1 end]
}
rsv method icon {} {
set rsvicon ""
switch [$self get ersvtype] {
switch $ersvtype {
1 { set rsvicon "175_1_00_Reservation_Watch.png" }
2 { set rsvicon "175_1_00_Reservation_Watch.png" }
3 { set rsvicon "175_1_11_Reservation_Record.png" }
@@ -94,16 +102,18 @@ rsv method icon {} {
}
rsv method RKIcon {} {
if {[$self get ucRecKind] == 4} {
set RKIcon "175_1_11_Series_Record.png"
} else {
switch [$self get erepeat] {
switch $ucRecKind {
2 { set RKIcon "178_1_26_Icon_Split.png" }
4 { set RKIcon "175_1_11_Series_Record.png" }
default {
switch $erepeat {
1 {set RKIcon "521_1_00_RP_Daily_C.png"}
2 {set RKIcon "521_1_00_RP_Weekly_C.png"}
3 {set RKIcon "521_1_00_RP_Weekdays_C.png"}
4 {set RKIcon "521_1_00_RP_Weekend_C.png"}
default {set RKIcon ""}
}
}
}
return $RKIcon
}
@@ -113,19 +123,19 @@ rsv method set_delete {} {
}
rsv method remove_pending {} {
$::rsvdb query "delete from pending where ulslot = [$self get ulslot]"
$::rsvdb query "delete from pending where ulslot = $ulslot"
}
rsv method fix_hsvc {} {
global rsvdb
set _hsvc [$rsvdb query "
set _hsvc [$rsvdb query {
select hSvc
from channel.TBL_SVC
where szSvcName = '$szSvcName'
or szSvcname = '\025$szSvcName'
where szSvcName = '%s'
or szSvcname = '\025%s'
limit 1
"]
} $szSvcName $szSvcName]
if {[llength $_hsvc] == 1} {
set hsvc [lindex [lindex $_hsvc 0] 1]
@@ -135,9 +145,23 @@ rsv method fix_hsvc {} {
return $hsvc
}
rsv method insert {{table pending}} {
rsv method insert {{table pending} {force 0}} {
global rsvdb
# Duplicate check - all tables
if {!$force && $szCRID ne "" && $action == 0} {
foreach tab {pending TBL_RESERVATION} {
set rec [$rsvdb query "
select ulslot from $tab
where szCRID = '%s'
" $szCRID]
if {[llength $rec] > 0} {
throw 20 "Duplicate reservation."
return
}
}
}
# Find a spare slot.
if {$ulslot < 0} {
set slotlist [$rsvdb query "
@@ -191,11 +215,13 @@ proc {rsv list} {{table tbl_reservation}} {
set res [$::rsvdb query "
select $table.*,
channel.TBL_SVC.szSvcName, channel.TBL_SVC.usLcn,
case when ersvtype > 3 then 1 else 0 end as sort
case when ersvtype > 3 then 1 else 0 end as sort1,
case when nsttime + nduration < [clock seconds]
then 0 else 1 end as sort2
from $table
left join channel.TBL_SVC
on $table.hSvc = channel.TBL_SVC.hSvc
order by sort, nsttime
order by sort1, sort2 desc, nsttime
"]
set records {}
@@ -240,18 +266,19 @@ proc {rsv entry} {{table TBL_RESERVATION} crid svc} {
return 0
}
proc {rsv fetch} {{table TBL_RESERVATION} hsvc nsttime usevtid events} {
proc {rsv fetch} {{table TBL_RESERVATION} ersvtype hsvc nsttime usevtid events} {
set res [$::rsvdb query "
select $table.*,
channel.TBL_SVC.szSvcName, channel.TBL_SVC.usLcn
from $table
left join channel.TBL_SVC
on $table.hSvc = channel.TBL_SVC.hSvc
where $table.hsvc = '%s'
where $table.ersvtype = '%s'
and $table.hsvc = '%s'
and $table.nsttime = '%s'
and $table.usevtid = '%s'
and $table.szEventToRecord = '%s'
" $hsvc $nsttime $usevtid $events]
" $ersvtype $hsvc $nsttime $usevtid $events]
if {[llength $res] > 0} {
return [rsv new [lindex $res 0]]
@@ -283,10 +310,68 @@ proc {rsv commit} {} {
foreach rec [rsv list pending] {
if {[$rec get action] == 0} {
$rec clear_ulslot
$rec insert TBL_RESERVATION
$rec insert TBL_RESERVATION 1
}
}
$::rsvdb query {delete from pending}
$::rsvdb query {commit transaction}
}
proc {rsv construct} {event type} {
global ccrid
$event get_channel_info
set args {}
set args(ersvtype) 3
set args(hsvc) [$event get channel_hsvc]
set args(nsttime) [$event get start]
set args(nduration) [$event get duration]
set args(usevtid) [$event get event_id]
set args(szevtname) "\025[$event get name]"
set args(eReady) 30
lassign [system padding] args(ulPreOffset) args(ulPostOffset)
set ccrid [$event get channel_crid]
if {$type == 1} {
# Event
set args(ucCRIDType) 49
set args(ucRecKind) 1
set ecrid [$event get event_crid]
if {$ecrid ne ""} {
set args(szCRID) "$ccrid$ecrid"
set args(szEventToRecord) "1$args(szCRID)|"
# Handle split events
if {[string match {*#?} $args(szCRID)]} {
set args(ucRecKind) 2
set args(szCRID) [
string range $args(szCRID) 0 end-2]
# TODO - check to see how many parts there
# are...
append args(szEventToRecord) \
$args(szEventToRecord)
}
}
} elseif {$type == 3} {
# Reminder
set args(ersvtype) 2
set args(szsttime) [clock format $args(nsttime) \
-format {%Y%m%d%H%M%S}]
} else {
# Series
set args(ucCRIDType) 50
set args(ucRecKind) 4
set args(szCRID) "$ccrid[$event get series_crid]"
set args(szFPBRecPath) "$args(szevtname)"
set progs [lmap i [epg fetch dump -scrid [$event get series_crid]] {
if {[set ecrid [$i get event_crid]] eq ""} { continue }
list "1$::ccrid$ecrid"
}]
set args(szEventToRecord) "[join $progs "|"]|"
}
return [rsv new $args]
}

View File

@@ -19,6 +19,7 @@ if {![file exists /mod/etc/webif.db]} {
class settings {
hostname ""
channel_group 0
epg_style "standard"
smtp_server ""
pkgdev 0
}
@@ -99,6 +100,18 @@ settings method channel_group {{group -1}} {
return [$self _nval_setting channel_group $group]
}
settings method epg_style {{style -1}} {
if {$style != -1} {
if {$style eq "grid"} { set style 1 } else { set style 0}
return [$self _nval_setting epg_style $style]
}
set val [$self _nval_setting epg_style]
if {$val == 1} {
return "grid"
}
return "standard"
}
settings method pkgdev {{val -1}} {
return [$self _nval_setting pkgdev $val]
}

View File

@@ -0,0 +1,102 @@
if {![exists -proc class ]} { package require oo }
if {![exists -proc sqlite3.open ]} { package require sqlite3 }
class system {}
proc {system model} {} {
if {[catch {set fp [open /etc/model r]}]} {
set model {HD[R]}
} else {
set model [string trim [read $fp]]
close $fp
}
return $model
}
proc {system hostname} {} {
if {[catch {set hostname [string trim [exec hostname]]}]} {
set hostname "humax"
}
return $hostname
}
proc {system modversion} {} {
if {[catch {set fp [open /etc/modversion r]}]} {
set modver "1.02"
} else {
set modver [string trim [read $fp]]
close $fp
}
lassign [split $modver ""] a b c
return [format "%d.%d%d" $a $b $c]
}
proc {system pkgver} {{pkg webif}} {
return [lrange [split [exec opkg list-installed $pkg] " "] 2 end]
}
proc {system diskspace} {} {
switch [system model] {
HDR { set part /mnt/hd2 }
HD { set part /media/drive1 }
}
set size 0
set used 0
set perc 0
foreach line [split [exec /mod/bin/busybox/df -h $part 2>>/dev/null] "\n\r"] {
if {[string match "/*" $line]} {
regsub -all -- {[[:space:]]+} $line " " line
set fields [split $line]
set size [lindex $fields 1]
set used [lindex $fields 2]
set perc [string trimright [lindex $fields 4] "%"]
break
}
}
return [list $size $used $perc]
}
proc {system busy} {} {
# Is humaxtv doing anything important?
set pid [exec /mod/bin/busybox/pgrep humaxtv]
set c 0
foreach line [split [exec /mod/bin/lsof -p $pid] "\n"] {
if {[string match {*Video*.ts} $line]} { incr c }
}
if {$c > 0} { return 1 }
return 0
}
proc {system reboot} {} {
exec /etc/init.d/S90settop shut
exec /sbin/reboot
}
proc {system restartpending} {} {
close [open /tmp/.restartpending w]
}
proc {system padding} {} {
set start 0
set stop 0
if {[catch {set db [sqlite3.open /var/lib/humaxtv/setup.db]} msg]} {
return {0 0}
}
foreach l [$db query "
select itemName, itemValue
from TBL_MENUCONFIG
where itemName in ('START_PADDING_TIME', 'STOP_PADDING_TIME')
"] {
lassign $l x name x val
switch $name {
"START_PADDING_TIME" { set start $val }
"STOP_PADDING_TIME" { set stop $val }
}
}
$db close
return [list $start $stop]
}

13
var/mongoose/lib/totop Normal file
View File

@@ -0,0 +1,13 @@
puts {
<script type="text/javascript" src="/js/jquery.ui.totop.js"></script>
<script type="text/javascript" src="/js/easing.js"></script>
<link href=/css/ui.totop.css rel=stylesheet type=text/css />
<script type=text/javascript>
$(document).ready(function() {
$().UItoTop({easingType: 'easeOutQuart'});
$('.backtotop').click(function() {
$('html, body').animate({scrollTop: 0}, 500);
});
});
</script>
}