Compare commits
25 Commits
0.6.0@2148
...
0.6.6@2148
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7310e9765 | ||
|
|
3f02bf8365 | ||
|
|
1d6917a782 | ||
|
|
0852c70891 | ||
|
|
981c8312cd | ||
|
|
3559a430ab | ||
|
|
945c6d1b4b | ||
|
|
81c3ef4f73 | ||
|
|
2c61281b09 | ||
|
|
d5b27acd46 | ||
|
|
767021557f | ||
|
|
4f900f47b4 | ||
|
|
8383651367 | ||
|
|
d764969b8f | ||
|
|
301336b778 | ||
|
|
1b8761b8f3 | ||
|
|
b2f5f2c48a | ||
|
|
64b73ee14b | ||
|
|
dbc3d21807 | ||
|
|
d1267cbd1e | ||
|
|
7643a92550 | ||
|
|
b1176d9f64 | ||
|
|
ded9495595 | ||
|
|
2a224c1055 | ||
|
|
33a72aa43f |
@@ -1 +0,0 @@
|
||||
etc/webif.db
|
||||
@@ -1,11 +1,11 @@
|
||||
Package: webif
|
||||
Priority: optional
|
||||
Section: web
|
||||
Version: 0.6.0
|
||||
Version: 0.6.6
|
||||
Architecture: mipsel
|
||||
Maintainer: af123@hummypkg.org.uk
|
||||
Depends: mongoose(>=2.11-6),jim(>=0.71-1),jim-sqlite3(>=0.71-1),jim-cgi(>=0.3),jim-oo,jim-pack,service-control,busybox(>=1.18.3-1),lsof,epg(>=1.0.2),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.3),hmt(>=1.0.6),ssmtp
|
||||
Replaces: af123-webif
|
||||
Conflicts: af123-webif
|
||||
Suggests: ffmpeg
|
||||
Suggests: ffmpeg,webif-iphone
|
||||
Description: An evolving web interface for the Humax.
|
||||
|
||||
BIN
etc/webif.db
BIN
etc/webif.db
Binary file not shown.
@@ -6,7 +6,7 @@ source /mod/var/mongoose/lib/setup
|
||||
set dir /mod/var/backup
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts "Pragma: nocache"
|
||||
puts "Pragma: no-cache"
|
||||
puts "Expires: Thu, 01 Jan 1970 00:00:00 GMT"
|
||||
puts ""
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
package require cgi
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts "Pragma: nocache"
|
||||
puts "Pragma: no-cache"
|
||||
puts "Expires: Thu, 01 Jan 1970 00:00:00 GMT"
|
||||
puts ""
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ puts ""
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
#set _cgi(restore_file) "backup-2011-Jul-05-19:22"
|
||||
#set _cgi(restore_file) "backup-2011-Jul-09-20:37"
|
||||
|
||||
if {![dict exists $_cgi restore_file]} {
|
||||
puts "No filename supplied."
|
||||
@@ -53,7 +53,8 @@ proc findhsvc {channel} {
|
||||
|
||||
puts "Restoring scheduled events..."
|
||||
|
||||
$rsvdb query {delete from TBL_RESERVATION}
|
||||
$rsvdb query {begin transaction;}
|
||||
$rsvdb query {delete from TBL_RESERVATION;}
|
||||
|
||||
set fields [lsort [[rsv] vars]]
|
||||
|
||||
@@ -96,7 +97,10 @@ foreach line $data {
|
||||
if {!$bad} { $rsv insert }
|
||||
}
|
||||
|
||||
$rsvdb query {commit transaction;}
|
||||
|
||||
puts "Restoring favourite channels..."
|
||||
$rsvdb query {begin transaction;}
|
||||
$rsvdb query {delete from channel.TBL_FAV}
|
||||
|
||||
set grp 0
|
||||
@@ -129,6 +133,8 @@ foreach line $data {
|
||||
$rsvdb query $query
|
||||
}
|
||||
|
||||
$rsvdb query {commit transaction;}
|
||||
|
||||
close [open /tmp/.restartpending w]
|
||||
|
||||
close $fd
|
||||
|
||||
@@ -203,7 +203,8 @@ var menuclick = function(action, el, pos)
|
||||
break;
|
||||
|
||||
case 'download':
|
||||
window.location.href = file;
|
||||
window.location.href = '/cgi-bin/browse/download.jim?file=' +
|
||||
encodeURIComponent(file);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
49
var/mongoose/cgi-bin/browse/download.jim
Executable file
49
var/mongoose/cgi-bin/browse/download.jim
Executable file
@@ -0,0 +1,49 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
package require sqlite3
|
||||
source /mod/var/mongoose/lib/setup
|
||||
require ts.class
|
||||
|
||||
#puts "Content-Type: text/plain\r\n\r\n"
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
set file [dict get $_cgi file]
|
||||
set rfile [file normalize $file]
|
||||
set ts [ts fetch $file]
|
||||
|
||||
set dmsfile /mnt/hd2/dms_cds.db
|
||||
|
||||
set url $file
|
||||
set mime "video/ts"
|
||||
if {[file exists $dmsfile]} {
|
||||
set db [sqlite3.open /mnt/hd2/dms_cds.db]
|
||||
set muri [$db query "
|
||||
select tblresource.mimetype, contenturi
|
||||
from tblresource join tblmedia using (mediaid)
|
||||
where localurl = '%s'" $rfile]
|
||||
if {$muri != ""} {
|
||||
set rec [lindex $muri 0]
|
||||
set xuri [lindex $rec 3]
|
||||
set mime [lindex $rec 1]
|
||||
set url "http://$env(HTTP_HOST):9000/web/$xuri"
|
||||
}
|
||||
}
|
||||
|
||||
puts "Content-Type: text/plain"
|
||||
puts "Refresh: 0; url=$url"
|
||||
puts "Content-length: 0"
|
||||
puts ""
|
||||
|
||||
#puts "Pragma: public"
|
||||
#puts "Expires: 0"
|
||||
#puts "Cache-Control: must-revalidate, post-check=0, pre-check=0"
|
||||
#puts "Content-Type: application/force-download"
|
||||
#puts "Content-Type: application/download"
|
||||
#puts "Content-Type: $mime"
|
||||
#puts "Content-Disposition: attachment; filename=\"[file tail $file]\""
|
||||
#puts "Content-Transfer-Encoding: binary"
|
||||
#puts "Content-Length: [file size $rfile]"
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
package require cgi
|
||||
|
||||
#puts "Content-Type: text/plain"
|
||||
puts "Content-Type: application/json"
|
||||
puts ""
|
||||
|
||||
@@ -18,9 +19,28 @@ puts "{"
|
||||
foreach line [split [exec /mod/bin/busybox/du -h "$dir/"] "\n"] {
|
||||
set fields [split $line "\t"]
|
||||
set size [lindex $fields 0]
|
||||
set node [lindex [split [lindex $fields 1] /] end]
|
||||
set node [file tail [lindex $fields 1]]
|
||||
# set node [lindex [split [lindex $fields 1] /] end]
|
||||
puts "\"$node\" : \"$size\","
|
||||
}
|
||||
|
||||
# Handle symbolic links.
|
||||
foreach file [glob -nocomplain "$dir/*"] {
|
||||
if {[catch {set lk [file readlink $file]}]} continue
|
||||
|
||||
if {![string match "/*" $lk]} { set lk "$dir/$lk" }
|
||||
|
||||
if {![file isdirectory $lk]} continue
|
||||
foreach line [split [exec /mod/bin/busybox/du -h "$lk"] "\n"] {
|
||||
set fields [split $line "\t"]
|
||||
if {[lindex $fields 1] eq $lk} {
|
||||
set node [file tail $file]
|
||||
set size [lindex $fields 0]
|
||||
puts "\"$node\" : \"@$size\","
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
puts "\"dummy\" : \"\""
|
||||
puts "}"
|
||||
|
||||
|
||||
72
var/mongoose/cgi-bin/db.jim
Executable file
72
var/mongoose/cgi-bin/db.jim
Executable file
@@ -0,0 +1,72 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
package require sqlite3
|
||||
source /mod/var/mongoose/lib/setup
|
||||
require altrow
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
|
||||
header
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
set ftab [cgi_get tab]
|
||||
set fdb [cgi_get db]
|
||||
|
||||
if {$fdb != 0} {
|
||||
puts "<h1><a href=/cgi-bin/db.jim>Remove filters</a></h1>"
|
||||
}
|
||||
|
||||
proc db_info {db_file} {
|
||||
global _cgi fdb ftab
|
||||
|
||||
if {$fdb != 0 && [file tail $db_file] ne $fdb} { return }
|
||||
if {![file exists $db_file]} { return }
|
||||
|
||||
set db [sqlite3.open $db_file]
|
||||
set tables [$db query {
|
||||
select name from sqlite_master
|
||||
where type='table' order by name
|
||||
}]
|
||||
|
||||
puts "<h1><a href=/cgi-bin/db.jim?db=[file tail $db_file]>
|
||||
$db_file</a></h1>"
|
||||
|
||||
foreach table $tables {
|
||||
set table [lindex $table 1]
|
||||
if {$ftab != 0 && $ftab ne $table} { continue }
|
||||
set columns [$db query "pragma table_info($table)"]
|
||||
set datas [$db query "SELECT * FROM $table order by 1"]
|
||||
|
||||
puts "<h2><a href=/cgi-bin/db.jim?db=[file tail $db_file]&tab=$table>$table</a></h2>"
|
||||
puts "<table class=borders>"
|
||||
puts " <tr>"
|
||||
foreach column $columns {
|
||||
puts " <th>[lindex $column 3]</th>"
|
||||
}
|
||||
puts " </tr>"
|
||||
foreach data $datas {
|
||||
altrow
|
||||
|
||||
for {set i 1} {$i < [llength $data]} {incr i 2} {
|
||||
puts " <td>[lindex $data $i]</td>"
|
||||
}
|
||||
puts " </tr>"
|
||||
}
|
||||
puts "</table>"
|
||||
}
|
||||
|
||||
$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
|
||||
|
||||
footer
|
||||
|
||||
@@ -10,17 +10,25 @@ puts ""
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
set service 0
|
||||
catch { set service [dict get $_cgi service] }
|
||||
set event 0
|
||||
catch { set event [dict get $_cgi event] }
|
||||
set service [cgi_get service 0]
|
||||
set event [cgi_get event 0]
|
||||
if {! [dict exists $_cgi bare]} { header }
|
||||
|
||||
#set service 8384
|
||||
#set event 25293
|
||||
|
||||
set record [lindex [epg fetch dump -service $service -event $event] 0]
|
||||
$record get_channel_info
|
||||
set others [$record othertimes]
|
||||
|
||||
puts {
|
||||
<style type=text/css>
|
||||
font.also
|
||||
{
|
||||
font-size: 0.9em;
|
||||
font-style: italic;
|
||||
color: #333;
|
||||
background: transparent;
|
||||
}
|
||||
</style>
|
||||
}
|
||||
|
||||
puts "
|
||||
<table class=keyval>
|
||||
@@ -32,10 +40,38 @@ puts "
|
||||
<td>[$record get text]</td>
|
||||
</tr><tr>
|
||||
<th>Start</th>
|
||||
<td>[clock format [$record get start] -format {%c %Z}]</td>
|
||||
<td>[clock format [$record get start] -format {%c %Z}]
|
||||
"
|
||||
|
||||
foreach o $others {
|
||||
if {[$o ended]} { continue }
|
||||
$o get_channel_info
|
||||
$o process_sched
|
||||
if {[$o get series_crid] eq ""} { set ro 1 } else { set ro 2 }
|
||||
puts -nonewline "<br><font class=also> "
|
||||
puts -nonewline "Also: "
|
||||
puts -nonewline "<a class=event href=# xs=[$o get service_id] "
|
||||
puts -nonewline "xe=[$o get event_id] "
|
||||
puts -nonewline "sch=[$o get sched_type] rec=$ro>"
|
||||
puts -nonewline "[clock format [$o get start] -format {%c %Z}]"
|
||||
puts -nonewline " on "
|
||||
puts -nonewline [$o channel_icon 16]
|
||||
puts -nonewline "[$o get channel_name] "
|
||||
puts "</a>"
|
||||
puts "</font>"
|
||||
}
|
||||
|
||||
puts "
|
||||
</td>
|
||||
</tr><tr>
|
||||
<th>Duration</th>
|
||||
<td>[clock format [$record get duration] -format %T]</td>
|
||||
<td>[clock format [$record get duration] -format %T]
|
||||
"
|
||||
if {[$record showing]} {
|
||||
puts [progressbar [$record percent]]
|
||||
}
|
||||
puts "
|
||||
</td>
|
||||
</tr><tr>
|
||||
<th>Type</th>
|
||||
<td>[$record get content_type] ([$record get content_code])</td>
|
||||
@@ -54,8 +90,13 @@ if {[$record get warning] != ""} {
|
||||
if {[$record get event_crid] != ""} {
|
||||
puts "
|
||||
<tr>
|
||||
<th>CRID</th>
|
||||
<td>[$record get channel_crid][$record get event_crid]</td>
|
||||
<th>CRID</th><td>
|
||||
<a href=/cgi-bin/epg_search.jim?crid=[$record get event_crid]>
|
||||
<img border=0 height=14
|
||||
src=/images/421_1_00_CH_Title_2R_Arrow.png>
|
||||
[$record get channel_crid][$record get event_crid]
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
"
|
||||
}
|
||||
@@ -103,6 +144,8 @@ puts "
|
||||
</a>
|
||||
"
|
||||
|
||||
puts "<div id=epginfo_extra class=footnote></div>"
|
||||
|
||||
epg cleanup
|
||||
if {! [dict exists $_cgi bare]} { footer }
|
||||
|
||||
|
||||
83
var/mongoose/cgi-bin/epg_schedule.jim
Executable file
83
var/mongoose/cgi-bin/epg_schedule.jim
Executable file
@@ -0,0 +1,83 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/setup
|
||||
require epg.class
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
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
|
||||
}
|
||||
|
||||
set service $_cgi(service)
|
||||
set event $_cgi(event)
|
||||
set type 1
|
||||
if {[dict exists $_cgi type]} { set type $_cgi(type) }
|
||||
|
||||
set event [lindex [epg fetch dump -service $service -event $event] 0]
|
||||
if {$event eq ""} {
|
||||
puts "Error, cannot find event to schedule."
|
||||
exit
|
||||
}
|
||||
if {[$event percent] > 0} {
|
||||
puts "Error, cannot record programme which has already started showing"
|
||||
puts "or occurred in the past."
|
||||
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)|"
|
||||
} 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]
|
||||
}
|
||||
|
||||
epg cleanup
|
||||
|
||||
@@ -95,9 +95,14 @@ foreach record [lsort -command rsort $records] {
|
||||
}
|
||||
altrow
|
||||
$record get_channel_info
|
||||
puts "<td nowrap>
|
||||
|
||||
set ended [$record ended]
|
||||
|
||||
if $ended { puts "<td nowrap class=blood>" } else { puts "<td nowrap>"}
|
||||
puts "
|
||||
[clock format [$record get start] -format "%a %d %b %Y"]<br>
|
||||
[clock format [$record get start] -format "%H:%M %Z"]</td>"
|
||||
[clock format [$record get start] -format "%H:%M %Z"]"
|
||||
puts "</td>"
|
||||
puts "<td>[$record get channel_num]</td>"
|
||||
puts "<td>[$record channel_icon 50]</td>"
|
||||
puts "<td nowrap>
|
||||
|
||||
@@ -20,10 +20,7 @@ cgi_input
|
||||
|
||||
require epg_popup
|
||||
|
||||
set service 0
|
||||
set service 4351
|
||||
catch { set service [dict get $_cgi service] }
|
||||
|
||||
set service [cgi_get service 4351]
|
||||
set records [epg fetch dump -service $service]
|
||||
|
||||
set tr [lindex $records 0]
|
||||
@@ -54,13 +51,15 @@ puts {
|
||||
set i 0
|
||||
foreach record $records {
|
||||
altrow
|
||||
$record get_channel_info
|
||||
set ended [$record ended]
|
||||
if {[$record showing]} {
|
||||
puts "<td><img src=/images/111_1_00_Cursor_2R_Arrow.png></td>"
|
||||
} else { puts "<td></td>" }
|
||||
puts "<td nowrap>
|
||||
[clock format [$record get start] -format "%a %d %b %Y"]</td>"
|
||||
puts "<td nowrap>
|
||||
[clock format [$record get start] -format "%H:%M"]</td>"
|
||||
if $ended { puts "<td nowrap class=blood>" } else { puts "<td nowrap>" }
|
||||
puts "[clock format [$record get start] -format "%a %d %b %Y"]</td>"
|
||||
if $ended { puts "<td nowrap class=blood>" } else { puts "<td nowrap>" }
|
||||
puts "[clock format [$record get start] -format "%H:%M"]</td>"
|
||||
puts [$record cell]
|
||||
puts "<td>[$record get text]</td>"
|
||||
puts "<td>[$record get warning]</td>"
|
||||
|
||||
@@ -1,18 +1,29 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
source /mod/var/mongoose/lib/setup
|
||||
require pkg.class chunked
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
#set _cgi(cmd) {remove binutils}
|
||||
set cmd [cgi_get cmd update]
|
||||
|
||||
if {![dict exists $_cgi cmd]} { set _cgi(cmd) status }
|
||||
start_chunked
|
||||
|
||||
set cmd [dict get $_cgi cmd]
|
||||
set bcmd "|/mod/var/mongoose/lib/opkg $cmd"
|
||||
set fd [open $bcmd r]
|
||||
while {[gets $fd line] >= 0} {
|
||||
chunk "$line\r\n"
|
||||
#chunk_pad
|
||||
}
|
||||
close $fd
|
||||
|
||||
puts [exec /mod/var/mongoose/lib/opkg {*}$cmd]
|
||||
if {$cmd eq "update"} {
|
||||
chunk "Updating package meta information\r\n"
|
||||
pkg fetchmeta
|
||||
chunk "Done.\r\n"
|
||||
}
|
||||
|
||||
end_chunked
|
||||
|
||||
|
||||
98
var/mongoose/cgi-bin/pkg.jim
Executable file
98
var/mongoose/cgi-bin/pkg.jim
Executable file
@@ -0,0 +1,98 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/setup
|
||||
require settings.class pkg.class altrow
|
||||
|
||||
if {[[settings] pkgdev]} { set filter 0 } else { set filter 1 }
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts "Pragma: no-cache"
|
||||
puts "Expires: Thu, 01 Jan 1970 00:00:00 GMT"
|
||||
puts ""
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
if {![dict exists $_cgi type]} { set _cgi(type) avail }
|
||||
|
||||
proc pkgrow {pkg} {
|
||||
set name [$pkg get name]
|
||||
altrow
|
||||
puts "
|
||||
<td nowrap>$name</td>
|
||||
"
|
||||
|
||||
if {$::type eq "avail"} {
|
||||
puts "<td nowrap>[$pkg get latest]</td>"
|
||||
} else {
|
||||
puts "<td nowrap>[$pkg get installed]</td>"
|
||||
}
|
||||
|
||||
if {$::type eq "upgr"} {
|
||||
puts "<td nowrap>[$pkg get latest]</td>"
|
||||
}
|
||||
|
||||
if {[dict exists $::pkgmeta $name]} {
|
||||
puts "<td>$::pkgmeta($name)</td>"
|
||||
} else {
|
||||
puts "<td>[$pkg get descr]</td>"
|
||||
}
|
||||
|
||||
if {![$pkg is installed]} {
|
||||
set type Install
|
||||
} elseif {$::type eq "upgr" && [$pkg is upgradable]} {
|
||||
set type Upgrade
|
||||
} else {
|
||||
set type Remove
|
||||
}
|
||||
|
||||
puts "<td align=center><small><button id=\"[$pkg get name]\"
|
||||
action=[string tolower $type]
|
||||
class=[string tolower $type]>$type</button></small></td>"
|
||||
|
||||
puts "</tr>"
|
||||
}
|
||||
|
||||
pkg loadmeta
|
||||
|
||||
set type $_cgi(type)
|
||||
|
||||
set pkgs [pkg $type]
|
||||
|
||||
if {[llength $pkgs] > 0} {
|
||||
puts "<table><tr><th>Package</th>"
|
||||
|
||||
if {$type eq "avail"} {
|
||||
puts "<th>Available</th>"
|
||||
} else {
|
||||
puts "<th>Installed</th>"
|
||||
}
|
||||
|
||||
if {$type eq "upgr"} {
|
||||
puts "<th>Avail</th>"
|
||||
}
|
||||
|
||||
puts "
|
||||
<th>Description</th>
|
||||
<th> Action </th>
|
||||
</tr>
|
||||
"
|
||||
|
||||
foreach pkg $pkgs {
|
||||
if {$filter && ![dict exists $::pkgmeta $pkg]} { continue }
|
||||
pkgrow [pkg load $pkg]
|
||||
}
|
||||
puts "</table>"
|
||||
if {$filter} {
|
||||
puts "<font class=footnote>This is a filtered package list. To show all packages, enable the <i>Show development and advanced packages</i> in the settings screen.</font>"
|
||||
}
|
||||
} else {
|
||||
puts "<i>No packages "
|
||||
switch $type {
|
||||
inst { puts "are installed." }
|
||||
upgr { puts "are available for upgrade." }
|
||||
avail { puts "are available for installation." }
|
||||
}
|
||||
puts "</i>"
|
||||
}
|
||||
|
||||
@@ -1,8 +1,57 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/setup
|
||||
require rsv.class
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
|
||||
puts [exec /etc/init.d/S90settop restart]
|
||||
file delete /tmp/.restartpending
|
||||
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
|
||||
exit
|
||||
}
|
||||
|
||||
file delete /tmp/.restartpending
|
||||
header
|
||||
|
||||
# Commit pending reservations on older mod versions.
|
||||
if {![file exists /sbin/rsvsync] && ![file exists /mod/boot/rsvsync]} {
|
||||
rsv commit
|
||||
}
|
||||
|
||||
puts {
|
||||
<link href=/css/jquery.progressbar.css rel=stylesheet type=text/css />
|
||||
<script type="text/javascript" src="/js/jquery.progressbar.js"></script>
|
||||
|
||||
<script type=text/javascript>
|
||||
var handle = 0;
|
||||
var pct = 0;
|
||||
function update()
|
||||
{
|
||||
$('#progressbar').reportprogress(++pct);
|
||||
if (pct == 100)
|
||||
{
|
||||
clearInterval(handle);
|
||||
pct = 0;
|
||||
window.location = '/';
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#progressbar').reportprogress(0);
|
||||
handle = setInterval("update()", 300);
|
||||
$.get('/cgi-bin/restart.jim?now=yes');
|
||||
});
|
||||
</script>
|
||||
|
||||
Please wait while the Humax restarts...<br>
|
||||
<div id=progressbar></div>
|
||||
}
|
||||
|
||||
footer
|
||||
|
||||
|
||||
26
var/mongoose/cgi-bin/sched_cancel.jim
Executable file
26
var/mongoose/cgi-bin/sched_cancel.jim
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/setup
|
||||
require rsv.class
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
set slot [cgi_get slot 0]
|
||||
set table [cgi_get table TBL_RESERVATION]
|
||||
|
||||
set event [rsv slot $table $slot]
|
||||
|
||||
if {$table eq "pending"} {
|
||||
$event remove_pending
|
||||
exit
|
||||
}
|
||||
|
||||
$event clear_ulslot
|
||||
$event set_delete
|
||||
$event insert
|
||||
|
||||
123
var/mongoose/cgi-bin/sched_info.jim
Executable file
123
var/mongoose/cgi-bin/sched_info.jim
Executable file
@@ -0,0 +1,123 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/setup
|
||||
require rsv.class
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
set table [cgi_get table TBL_RESERVATION]
|
||||
set slot [cgi_get slot 0]
|
||||
|
||||
set event [rsv slot $table $slot]
|
||||
|
||||
set rsvicon [$event icon]
|
||||
if {$rsvicon ne ""} {
|
||||
set rsvicon "<img src='images/$rsvicon' height=20>
|
||||
}
|
||||
|
||||
set RKIcon [$event RKIcon]
|
||||
if {$RKIcon ne ""} {
|
||||
set RKIcon "<img src='images/$RKIcon' height=20>
|
||||
}
|
||||
|
||||
if {[$event get ucRecKind] == 4} {
|
||||
set series 1
|
||||
} else {
|
||||
set series 0
|
||||
}
|
||||
|
||||
puts "
|
||||
<table class=keyval>
|
||||
<tr>
|
||||
<th>Event [$event get ulslot]</th>
|
||||
<td class=va>$rsvicon $RKIcon</td>
|
||||
</tr><tr>
|
||||
<th>Channel</th>
|
||||
<td class=va>
|
||||
"
|
||||
if {[$event get usLcn] ne ""} {
|
||||
puts "
|
||||
<img class=va width=50
|
||||
src=\"/img/channels/[$event channel_name].png\">
|
||||
- [$event get usLcn] - [$event channel_name]
|
||||
"
|
||||
}
|
||||
|
||||
puts "
|
||||
</td>
|
||||
</tr><tr>
|
||||
<th>Event Name</th>
|
||||
<td>[$event name]</td>
|
||||
</tr><tr>
|
||||
<th>Start</th>
|
||||
"
|
||||
|
||||
set s [$event get nsttime]
|
||||
set d [$event get nduration]
|
||||
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"]
|
||||
[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]
|
||||
}
|
||||
|
||||
puts "
|
||||
</td>
|
||||
</tr><tr>
|
||||
<th>Duration</th>
|
||||
<td>[clock format [$event get nduration] -format %T]</td>
|
||||
</tr>
|
||||
"
|
||||
|
||||
set crid [join [lrange [split [$event get szCRID] /] 1 end]]
|
||||
if {$crid != ""} {
|
||||
puts "<tr><th>"
|
||||
if $series { puts "Series" } else { puts "Event" }
|
||||
puts " CRID</th><td>"
|
||||
puts -nonewline "<a href=/cgi-bin/epg_search.jim?"
|
||||
if $series { puts -nonewline "s" }
|
||||
puts "crid=/$crid>
|
||||
<img border=0 src=/images/421_1_00_CH_Title_2R_Arrow.png
|
||||
height=14>
|
||||
[$event get szCRID]"
|
||||
puts "</a></td></tr>"
|
||||
}
|
||||
puts "<tr><th>Events</th><td>"
|
||||
set flag 0
|
||||
foreach ev [split [$event get szEventToRecord] "|"] {
|
||||
if {$ev eq ""} { continue }
|
||||
set ev [string range $ev 1 end]
|
||||
if {$flag} { puts "<br>" }
|
||||
incr flag
|
||||
set crid [join [lrange [split $ev /] 1 end]]
|
||||
puts -nonewline "<a href=/cgi-bin/epg_search.jim?"
|
||||
puts "crid=/$crid>
|
||||
<img border=0 src=/images/421_1_00_CH_Title_2R_Arrow.png
|
||||
height=14>
|
||||
$ev"
|
||||
puts "</a>"
|
||||
}
|
||||
puts "</td></tr>"
|
||||
puts "<tr><th>Accepted</th><td>"
|
||||
if {[$event get aulEventToRecordInfo] != ""} {
|
||||
puts "Yes"
|
||||
}
|
||||
puts "</td></tr>"
|
||||
puts "</table>"
|
||||
|
||||
@@ -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 pkgdev [$settings pkgdev]
|
||||
|
||||
# Handle updates
|
||||
|
||||
@@ -50,6 +51,10 @@ 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"
|
||||
if {[dict exists $_cgi pkgdevoff] && ![dict exists $_cgi pkgdev]} {
|
||||
set _cgi(pkgdev) 0
|
||||
}
|
||||
handle_int_update pkgdev $pkgdev "Development Package Display"
|
||||
|
||||
header
|
||||
|
||||
@@ -76,6 +81,9 @@ puts {
|
||||
}
|
||||
|
||||
puts "
|
||||
<link href=/css/iphone-style-checkboxes.css rel=stylesheet type=text/css />
|
||||
<script type=\"text/javascript\" src=\"/js/iphone-style-checkboxes.js\">
|
||||
</script>
|
||||
<fieldset style=\"display: inline\">
|
||||
<legend>
|
||||
General Settings
|
||||
@@ -155,6 +163,34 @@ puts "
|
||||
</tr>
|
||||
"
|
||||
|
||||
puts "
|
||||
</table>
|
||||
</fieldset>
|
||||
<br><br>
|
||||
<fieldset style=\"display: inline\">
|
||||
<legend> Advanced Settings </legend>
|
||||
<table>
|
||||
"
|
||||
|
||||
puts "
|
||||
<tr>
|
||||
<form class=auto id=pkgdev method=get action=$env(REQUEST_URI)>
|
||||
<th class=key>Show development and advanced packages?</th>
|
||||
<td><input name=pkgdevoff value=0 type=hidden>
|
||||
<input name=pkgdev id=pkgdev value=1 type=checkbox
|
||||
"
|
||||
if {$pkgdev} { puts " checked" }
|
||||
puts {
|
||||
>
|
||||
<small>
|
||||
<input id=pkgdev_submit value="save" type=submit>
|
||||
</small>
|
||||
<div id=pkgdev_output></div>
|
||||
</td>
|
||||
</form>
|
||||
</tr>
|
||||
}
|
||||
|
||||
puts "
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
13
var/mongoose/cgi-bin/transmission.jim
Executable file
13
var/mongoose/cgi-bin/transmission.jim
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
set url "http://$env(HTTP_HOST):9091/"
|
||||
|
||||
puts "Content-Type: text/html
|
||||
Location: $url
|
||||
|
||||
<meta http-equiv=refresh content=\"0; url=$url\">
|
||||
|
||||
Transmission is available <a href=$url>here</a>
|
||||
|
||||
"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* Generic context menu styles */
|
||||
.contextMenu {
|
||||
position: absolute;
|
||||
width: 140px;
|
||||
width: 150px;
|
||||
z-index: 99999;
|
||||
border: solid 1px #CCC;
|
||||
background: #EEE;
|
||||
|
||||
31
var/mongoose/html/css/jquery.progressbar.css
Normal file
31
var/mongoose/html/css/jquery.progressbar.css
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
/* progress bar container */
|
||||
#progressbar{
|
||||
border:1px solid black;
|
||||
width:200px;
|
||||
height:20px;
|
||||
position:relative;
|
||||
color:black;
|
||||
}
|
||||
/* color bar */
|
||||
#progressbar div.progress{
|
||||
position:absolute;
|
||||
width:0;
|
||||
height:100%;
|
||||
overflow:hidden;
|
||||
background-color:#369;
|
||||
}
|
||||
/* text on bar */
|
||||
#progressbar div.progress .text{
|
||||
position:absolute;
|
||||
text-align:center;
|
||||
color:white;
|
||||
}
|
||||
/* text off bar */
|
||||
#progressbar div.text{
|
||||
position:absolute;
|
||||
width:100%;
|
||||
height:100%;
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
21
var/mongoose/html/css/tsort.css
Normal file
21
var/mongoose/html/css/tsort.css
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
table.tablesorter .header {
|
||||
background-image: url(/img/tsort/bg.png);
|
||||
background-repeat: no-repeat;
|
||||
border-left: 1px solid #FFF;
|
||||
border-right: 1px solid #000;
|
||||
border-top: 1px solid #FFF;
|
||||
padding-left: 30px;
|
||||
padding-top: 8px;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
table.tablesorter .headerSortUp {
|
||||
background-image: url(/img/tsort/asc.png);
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
table.tablesorter .headerSortDown {
|
||||
background-image: url(/img/tsort/desc.png);
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
<!--#include virtual="/lib/header.shtml" -->
|
||||
<!--#exec cmd="/mod/var/mongoose/include/db.jim" -->
|
||||
<!--#include virtual="/lib/footer.shtml" -->
|
||||
|
||||
BIN
var/mongoose/html/img/add.png
Normal file
BIN
var/mongoose/html/img/add.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.0 KiB |
BIN
var/mongoose/html/img/close.png
Normal file
BIN
var/mongoose/html/img/close.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
BIN
var/mongoose/html/img/transmission.png
Normal file
BIN
var/mongoose/html/img/transmission.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.8 KiB |
BIN
var/mongoose/html/img/tsort/asc.png
Normal file
BIN
var/mongoose/html/img/tsort/asc.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
BIN
var/mongoose/html/img/tsort/bg.png
Normal file
BIN
var/mongoose/html/img/tsort/bg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
BIN
var/mongoose/html/img/tsort/desc.png
Normal file
BIN
var/mongoose/html/img/tsort/desc.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
@@ -41,7 +41,7 @@ $(document).ready(function() {
|
||||
</a>
|
||||
<br>
|
||||
<a href=/sched.shtml>
|
||||
<b>Scheduled Recordings</b>
|
||||
<b>Scheduled Events</b>
|
||||
</a>
|
||||
<br>
|
||||
</center>
|
||||
@@ -60,7 +60,7 @@ $(document).ready(function() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="clear: both">
|
||||
<div style="clear: both; padding-top: 1em">
|
||||
|
||||
<div style="float: left">
|
||||
<center>
|
||||
@@ -77,11 +77,11 @@ $(document).ready(function() {
|
||||
|
||||
<div style="float: left">
|
||||
<center>
|
||||
<a href=/packages.shtml>
|
||||
<a href=/pkg.shtml>
|
||||
<img src=/img/packages.jpg border=0 width=217 height=228>
|
||||
</a>
|
||||
<br>
|
||||
<a href=/packages.shtml>
|
||||
<a href=/pkg.shtml>
|
||||
<b>Package Management</b>
|
||||
</a>
|
||||
<br>
|
||||
@@ -106,11 +106,12 @@ $(document).ready(function() {
|
||||
|
||||
<div style="clear: both">
|
||||
<!--#exec cmd="/mod/var/mongoose/include/mediatomb.jim" -->
|
||||
<!--#exec cmd="/mod/var/mongoose/include/transmission.jim" -->
|
||||
</div>
|
||||
<div class=footer>
|
||||
<ul>
|
||||
<li>
|
||||
<a href=/db.shtml target=_blank>SQLite3 Database Dump</a>
|
||||
<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> |
|
||||
<a href=/jim/oo.html target=_blank>OO</a> |
|
||||
|
||||
50
var/mongoose/html/js/iajax.js
Normal file
50
var/mongoose/html/js/iajax.js
Normal file
@@ -0,0 +1,50 @@
|
||||
|
||||
jQuery.ajaxPrefilter(function(options, _, jqXHR) {
|
||||
|
||||
if (jQuery.isFunction(options.progress)) {
|
||||
|
||||
var xhrFactory = options.xhr,
|
||||
interval;
|
||||
|
||||
options.xhr = function() {
|
||||
|
||||
var xhr = xhrFactory.apply(this, arguments),
|
||||
partial = "",
|
||||
prevcount = 1;
|
||||
|
||||
interval = setInterval(function() {
|
||||
|
||||
var responseText,
|
||||
jQueryPartial;
|
||||
|
||||
try {
|
||||
|
||||
responseText = xhr.responseText;
|
||||
|
||||
if (responseText && (responseText.length > partial.length))
|
||||
{
|
||||
|
||||
partial = responseText;
|
||||
jQueryPartial = $(partial).filter("*")
|
||||
|
||||
if (jQueryPartial.length > prevcount) {
|
||||
prevcount = jQueryPartial.length;
|
||||
options.progress(jQueryPartial.filter("*:not(:last)"));
|
||||
}
|
||||
}
|
||||
} catch(e) {
|
||||
alert(e);
|
||||
}
|
||||
}, options.progressInterval);
|
||||
|
||||
return xhr;
|
||||
};
|
||||
function stop()
|
||||
{
|
||||
if (interval)
|
||||
clearInterval(interval);
|
||||
}
|
||||
jqXHR.then(stop, stop);
|
||||
}
|
||||
});
|
||||
|
||||
54
var/mongoose/html/js/jquery.progressbar.js
Normal file
54
var/mongoose/html/js/jquery.progressbar.js
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Josh Bush (digitalbush.com)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Progress Bar Plugin for jQuery
|
||||
* Version: Alpha 2
|
||||
* Release: 2007-02-26
|
||||
*/
|
||||
(function($) {
|
||||
//Main Method
|
||||
$.fn.reportprogress = function(val,maxVal) {
|
||||
var max=100;
|
||||
if(maxVal)
|
||||
max=maxVal;
|
||||
return this.each(
|
||||
function(){
|
||||
var div=$(this);
|
||||
var innerdiv=div.find(".progress");
|
||||
|
||||
if(innerdiv.length!=1){
|
||||
innerdiv=$("<div class='progress'></div>");
|
||||
div.append("<div class='text'> </div>");
|
||||
$("<span class='text'> </span>").css("width",div.width()).appendTo(innerdiv);
|
||||
div.append(innerdiv);
|
||||
}
|
||||
var width=Math.round(val/max*100);
|
||||
innerdiv.css("width",width+"%");
|
||||
div.find(".text").html(width+" %");
|
||||
}
|
||||
);
|
||||
};
|
||||
})(jQuery);
|
||||
4
var/mongoose/html/js/jquery.tablesorter.js
Normal file
4
var/mongoose/html/js/jquery.tablesorter.js
Normal file
File diff suppressed because one or more lines are too long
@@ -1,33 +0,0 @@
|
||||
|
||||
$(document).ready(function() {
|
||||
$('button').button();
|
||||
|
||||
var $dialog = $('#dialogue').dialog({
|
||||
title: "Package Management Results",
|
||||
modal: false, autoOpen: false,
|
||||
height: 500, width: 700,
|
||||
show: 'scale', hide: 'fade',
|
||||
draggable: true, resizable: true,
|
||||
buttons: { "Close":
|
||||
function() {$(this).dialog('close');}},
|
||||
close: function(e,u) { window.location.reload(true); }
|
||||
});
|
||||
|
||||
var opkg = '/cgi-bin/opkg.jim?cmd=';
|
||||
|
||||
$('#opkgupdate').click(function() {
|
||||
$('#result_txt').load(opkg + 'update');
|
||||
$('#results').show('slow');
|
||||
});
|
||||
|
||||
$('button.remove, button.install, button.upgrade').click(function() {
|
||||
$('#dspinner').show();
|
||||
$('#dresults').load(
|
||||
opkg + encodeURIComponent(
|
||||
$(this).attr('action') + ' ' + $(this).attr('id')
|
||||
),
|
||||
function() { $('#dspinner').hide('slow') });
|
||||
$dialog.dialog('open');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -6,8 +6,6 @@ puts {
|
||||
source /mod/var/mongoose/include/model.jim
|
||||
puts {
|
||||
</title>
|
||||
<meta http-equiv="expires" value="Thu, 01 Jan 1970 00:00:00 GMT" />
|
||||
<meta http-equiv="pragma" content="no-cache" />
|
||||
<link rel="shortcut icon" href=/img/favicon.ico />
|
||||
<link href=/css/style.css rel=stylesheet type=text/css />
|
||||
<link type="text/css" href="/css/jquery-ui.css" rel="Stylesheet" />
|
||||
@@ -18,7 +16,9 @@ puts {
|
||||
}
|
||||
|
||||
source /mod/var/mongoose/html/lib/topbar.jim
|
||||
puts "<div id=restart_block>"
|
||||
source /mod/var/mongoose/include/restart.jim
|
||||
puts "</div>"
|
||||
|
||||
puts {
|
||||
<div style="clear: both">
|
||||
|
||||
@@ -12,7 +12,9 @@
|
||||
<body>
|
||||
|
||||
<!--#include virtual="/lib/topbar.shtml" -->
|
||||
<div id=restart_block>
|
||||
<!--#exec cmd="/mod/var/mongoose/include/restart.jim" -->
|
||||
</div>
|
||||
|
||||
<div style="clear: both">
|
||||
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
<!--#include virtual="/lib/header.shtml" -->
|
||||
|
||||
<h1 class=vam>Package Management
|
||||
<button class=vam id=opkgupdate>Update package list from Internet</button>
|
||||
</h1>
|
||||
<div id=results class=shadowbox style="width: 90%; display: none; margin: 1 0 1em 0">
|
||||
<div>
|
||||
<pre id=result_txt>
|
||||
Results...
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id=dialogue style="display: none; align: center">
|
||||
<pre id=dresults></pre>
|
||||
<div id=dspinner><img src=/img/loading.gif>Processing...</div>
|
||||
</div>
|
||||
|
||||
<!--#exec cmd="/mod/var/mongoose/include/packages.jim" -->
|
||||
|
||||
<!--#include virtual="/lib/footer.shtml" -->
|
||||
141
var/mongoose/html/pkg.shtml
Normal file
141
var/mongoose/html/pkg.shtml
Normal file
@@ -0,0 +1,141 @@
|
||||
<!--#include virtual="/lib/header.shtml" -->
|
||||
|
||||
<style type=text/css>
|
||||
button.install
|
||||
{
|
||||
display: none;
|
||||
background-image: none;
|
||||
background: #ccff99;
|
||||
}
|
||||
button.remove
|
||||
{
|
||||
display: none;
|
||||
background-image: none;
|
||||
background: #ff6666;
|
||||
}
|
||||
button.upgrade
|
||||
{
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class=va style="padding: 0 0 1em 0">
|
||||
<h1 style="display: inline" class=va>Package Management</h1>
|
||||
<small>
|
||||
<button class=va id=opkgupdate style="display: none">
|
||||
Update package list from Internet
|
||||
</button>
|
||||
</small>
|
||||
</div>
|
||||
|
||||
<div id=results class=shadowbox
|
||||
style="width: 90%; display: none; margin: 1 0 1em 0">
|
||||
<div>
|
||||
<pre id=result_txt>
|
||||
Updating package list...
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id=dialogue style="display: none; align: center">
|
||||
<pre id=dresults></pre>
|
||||
<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>
|
||||
|
||||
var opkg = '/cgi-bin/opkg.jim?cmd=';
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#opkgupdate')
|
||||
.button()
|
||||
.click(function() { execopkg('update'); })
|
||||
.fadeIn('slow');
|
||||
|
||||
$('#pkgtabs').tabs({
|
||||
load: setup_buttons,
|
||||
spinner: '<img border=0 src=/img/loading.gif> ' +
|
||||
'<em>Loading...</em>'
|
||||
});
|
||||
|
||||
var $dialog = $('#dialogue').dialog({
|
||||
title: "Package Management Results",
|
||||
modal: false, autoOpen: false,
|
||||
height: 500, width: 700,
|
||||
show: 'scale', hide: 'fade',
|
||||
draggable: true, resizable: true,
|
||||
buttons: { "Close":
|
||||
function() {$(this).dialog('close');}},
|
||||
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');
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function setup_buttons()
|
||||
{
|
||||
$('button.remove, button.install, button.upgrade')
|
||||
.button()
|
||||
.click(function() {
|
||||
if ($(this).attr('action') == 'remove' &&
|
||||
!confirm('Please confirm removal of the ' +
|
||||
$(this).attr('id') + ' package.'))
|
||||
return;
|
||||
execopkg(encodeURIComponent($(this).attr('action') +
|
||||
' ' + $(this).attr('id')));
|
||||
}).fadeIn('slow');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<div id=pkgtabs>
|
||||
<ul>
|
||||
<li>
|
||||
<a href=/cgi-bin/pkg.jim?type=inst>
|
||||
<span>Installed</span>
|
||||
</a>
|
||||
</li><li>
|
||||
<a href=/cgi-bin/pkg.jim?type=upgr>
|
||||
<span>Upgrades</span>
|
||||
</a>
|
||||
</li><li>
|
||||
<a href=/cgi-bin/pkg.jim?type=avail>
|
||||
<span>Available</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!--#include virtual="/lib/footer.shtml" -->
|
||||
@@ -1,4 +1,6 @@
|
||||
<!--#include virtual="/lib/header.shtml" -->
|
||||
<script type="text/javascript" src="/js/jquery.tablesorter.js"></script>
|
||||
<link type=text/css href=/css/tsort.css rel=Stylesheet />
|
||||
<!--#exec cmd="/mod/var/mongoose/include/sched.jim" -->
|
||||
<!--#include virtual="/lib/footer.shtml" -->
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ puts {
|
||||
<script type=text/javascript src=/cgi-bin/backup/backup.js></script>
|
||||
<h2>Backup/Restore</h2>
|
||||
|
||||
<div id=restart_block></div>
|
||||
<div id=restore_warning class="hidden warningbox">
|
||||
<center>
|
||||
<b>!!!!!!!!!!!!!! PLEASE NOTE !!!!!!!!!!!!!!
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require sqlite3
|
||||
source /mod/var/mongoose/lib/setup
|
||||
require altrow
|
||||
|
||||
proc db_info {db_file} {
|
||||
if {![file exists $db_file]} { return }
|
||||
set db [sqlite3.open $db_file]
|
||||
set tables [$db query {SELECT name FROM sqlite_master WHERE type='table' ORDER BY name}]
|
||||
|
||||
puts "<h1>$db_file</h1>"
|
||||
|
||||
foreach table $tables {
|
||||
set table_name [lindex $table 1]
|
||||
set columns [$db query "pragma table_info($table_name)"]
|
||||
set datas [$db query "SELECT * FROM $table_name"]
|
||||
|
||||
puts "<h2>$table_name</h2>"
|
||||
puts "<table>"
|
||||
puts " <tr>"
|
||||
foreach column $columns {
|
||||
puts " <th>[lindex $column 3]</th>"
|
||||
}
|
||||
puts " </tr>"
|
||||
foreach data $datas {
|
||||
altrow
|
||||
|
||||
for {set i 1} {$i < [llength $data]} {incr i 2} {
|
||||
puts " <td>[lindex $data $i]</td>"
|
||||
}
|
||||
puts " </tr>"
|
||||
}
|
||||
puts "</table>"
|
||||
}
|
||||
|
||||
$db close
|
||||
}
|
||||
|
||||
puts {<style type="text/css">table, td, th {border-collapse:collapse; border:1px solid black;}</style>}
|
||||
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
|
||||
|
||||
@@ -1,18 +1,24 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
if {[os.gethostname] eq "hosting"} {
|
||||
set size "1TB"
|
||||
set used "100GB"
|
||||
set perc "10"
|
||||
} else {
|
||||
foreach df [split [exec df -h 2>>/dev/null] "\n\r"] {
|
||||
if [string match *sd*2* $df] {
|
||||
regsub -all -- {[[:space:]]+} $df " " df
|
||||
set fields [split $df]
|
||||
set size [lindex $fields 1]
|
||||
set used [lindex $fields 2]
|
||||
set perc [string trimright [lindex $fields 4] "%"]
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ puts "
|
||||
<div style=\"float: left; padding-top: 5em\">
|
||||
<center>
|
||||
<a href=$url>
|
||||
<img src=/img/mediatomb.png width=180>
|
||||
<img border=0 src=/img/mediatomb.png width=180>
|
||||
</a>
|
||||
<br>
|
||||
<a href=$url>
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
source /mod/var/mongoose/lib/setup
|
||||
require pkg.class
|
||||
|
||||
puts {
|
||||
|
||||
<style type=text/css>
|
||||
.ui-button, .ui-button-text { padding: 0; font-size: 12px; }
|
||||
</style>
|
||||
|
||||
<script type=text/javascript src=/js/packages.js></script>
|
||||
|
||||
<table class=borders>
|
||||
<tr>
|
||||
<th>Package</th>
|
||||
<th>Installed</th>
|
||||
<th>Avail</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
|
||||
}
|
||||
|
||||
set avail [pkg avail]
|
||||
foreach name [lsort [array names avail]] {
|
||||
set pkg [pkg load $name $avail($name)]
|
||||
|
||||
if {![$pkg is installed]} {
|
||||
puts "<tr>"
|
||||
} elseif {[$pkg is upgradable]} {
|
||||
puts "<tr class=yellowshade>"
|
||||
} else {
|
||||
puts "<tr class=greenshade>"
|
||||
}
|
||||
|
||||
puts "
|
||||
<td>$name</td>
|
||||
<td>[$pkg get installed]</td>
|
||||
<td>[$pkg get latest]</td>
|
||||
<td>[$pkg get descr]</td>
|
||||
"
|
||||
|
||||
if {![$pkg is installed]} {
|
||||
set type Install
|
||||
} elseif {[$pkg is upgradable]} {
|
||||
set type Upgrade
|
||||
} else {
|
||||
set type Remove
|
||||
}
|
||||
|
||||
puts "<td align=center><button id=\"$name\"
|
||||
action=[string tolower $type]
|
||||
class=[string tolower $type]>$type</button></td>"
|
||||
|
||||
puts "</tr>"
|
||||
}
|
||||
|
||||
puts "</table>"
|
||||
|
||||
46
var/mongoose/include/pkg.jim
Executable file
46
var/mongoose/include/pkg.jim
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
source /mod/var/mongoose/lib/setup
|
||||
|
||||
puts {
|
||||
<script type=text/javascript src=/js/packages.js></script>
|
||||
|
||||
<style type=text/css>
|
||||
button.install
|
||||
{
|
||||
display: none;
|
||||
background-image: none;
|
||||
background: #ccff99;
|
||||
}
|
||||
button.remove
|
||||
{
|
||||
display: none;
|
||||
background-image: none;
|
||||
background: #ff6666;
|
||||
}
|
||||
button.upgrade
|
||||
{
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id=pkgtabs>
|
||||
<ul>
|
||||
<li>
|
||||
<a href=/cgi-bin/pkg.jim?type=inst>
|
||||
<span>Installed</span>
|
||||
</a>
|
||||
</li><li>
|
||||
<a href=/cgi-bin/pkg.jim?type=upgr>
|
||||
<span>Upgrades</span>
|
||||
</a>
|
||||
</li><li>
|
||||
<a href=/cgi-bin/pkg.jim?type=avail>
|
||||
<span>Available</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ puts {
|
||||
<div style="width: 60%; height: 0.7em;
|
||||
background: url(/img/stripes.gif) repeat-x;"></div>
|
||||
<div style="font-size: 1.2em; width: 60%; text-align: center; padding: 0.5em">
|
||||
A warm restart is required in order to complete a scheduling operation.
|
||||
A restart is required in order to complete a scheduling operation.
|
||||
<br>
|
||||
<font class=blood>
|
||||
}
|
||||
@@ -35,15 +35,8 @@ puts {
|
||||
<script type=text/javascript>
|
||||
$('#restart_humaxtv').button();
|
||||
$('#restart_humaxtv').click(function() {
|
||||
if (confirm('Are you sure you wish to perform a warm restart now?'))
|
||||
{
|
||||
$.ajax({
|
||||
url: '/cgi-bin/restart.jim',
|
||||
success: function() {
|
||||
window.location.reload(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (confirm('Are you sure you wish to perform a restart now?'))
|
||||
window.location = '/cgi-bin/restart.jim';
|
||||
});
|
||||
</script>
|
||||
}
|
||||
|
||||
@@ -3,56 +3,144 @@
|
||||
source /mod/var/mongoose/lib/setup
|
||||
require altrow rsv.class progressbar
|
||||
|
||||
set events [rsv list]
|
||||
|
||||
puts {
|
||||
<table class=borders>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th colspan=2>Channel</th>
|
||||
<th>Programme</th>
|
||||
<th>Start Time</th>
|
||||
<th>Duration</th>
|
||||
<th>Mode</th>
|
||||
<th>Event/Series ID</th>
|
||||
<th>Events</th>
|
||||
</tr>
|
||||
<div id=dialogue></div>
|
||||
<script type=text/javascript>
|
||||
|
||||
$.tablesorter.addParser({
|
||||
id: 'programme',
|
||||
is: function () { return false; },
|
||||
format: function(s) {
|
||||
return s.toLowerCase().replace(/---/, 'zzz');
|
||||
},
|
||||
type: 'text'
|
||||
});
|
||||
|
||||
$.tablesorter.addParser({
|
||||
id: 'date',
|
||||
is: function () { return false; },
|
||||
format: function(s) {
|
||||
var d = new Date(s.substring(0, s.length - 4));
|
||||
return d.getTime();
|
||||
},
|
||||
type: 'numeric'
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
$('table.tablesorter').tablesorter({
|
||||
headers: {
|
||||
1: { sorter: false },
|
||||
3: { sorter: 'programme' },
|
||||
4: { sorter: 'date' },
|
||||
5: { sorter: 'date' },
|
||||
5: { sorter: false },
|
||||
6: { sorter: false },
|
||||
7: { sorter: false }
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
function docancel()
|
||||
{
|
||||
var table = $('#dialogue').attr('table');
|
||||
var slot = $('#dialogue').attr('slot');
|
||||
|
||||
if (confirm('Really remove scheduled event?'))
|
||||
{
|
||||
$.get('/cgi-bin/sched_cancel.jim?slot=' + slot +
|
||||
'&table=' + table, function() {
|
||||
window.location.reload(true);
|
||||
});
|
||||
$('#dialogue').dialog('close');
|
||||
}
|
||||
}
|
||||
|
||||
var $buttons1 = {
|
||||
"Close" : function() {$(this).dialog('close');}
|
||||
};
|
||||
var $buttons2 = $.extend(
|
||||
{"Cancel Event": function() { docancel() }},
|
||||
$buttons1);
|
||||
|
||||
var $dialog = $('#dialogue').dialog({
|
||||
title: "Schedule Details",
|
||||
modal: false, autoOpen: false,
|
||||
height: 500, width: 700,
|
||||
show: 'scale', hide: 'fade',
|
||||
draggable: true, resizable: true,
|
||||
buttons: $buttons2,
|
||||
close: function(e,u) { $('#dialogue').empty().html(
|
||||
'<img src="/img/loading.gif" alt="loading">'); }
|
||||
});
|
||||
|
||||
function schedpopup(e, o)
|
||||
{
|
||||
e.preventDefault();
|
||||
var slot = o.attr('slot');
|
||||
var table = o.attr('table');
|
||||
$('#dialogue').attr('slot', slot).attr('table', table);
|
||||
|
||||
var url = '/cgi-bin/sched_info.jim?slot=' + slot +
|
||||
'&table=' + table;
|
||||
$('#dialogue').load(url);
|
||||
$dialog.dialog('open');
|
||||
}
|
||||
$('a.schedule').click(function(e) { schedpopup(e, $(this)) });
|
||||
});
|
||||
</script>
|
||||
}
|
||||
|
||||
foreach event $events {
|
||||
proc eventheader {{table TBL_RESERVATION}} {
|
||||
puts {
|
||||
<table class="borders tablesorter">
|
||||
<thead>
|
||||
<tr>
|
||||
}
|
||||
|
||||
if {$table eq "pending" } { puts "<th>Action</th>" }
|
||||
|
||||
puts {
|
||||
<th></th>
|
||||
<th> </th><th>Channel</th>
|
||||
<th>Programme</th>
|
||||
<th>Start Time</th>
|
||||
<th>Duration</th>
|
||||
<th>Mode</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
}
|
||||
}
|
||||
|
||||
proc eventrow {event {table TBL_RESERVATION}} {
|
||||
set name [$event name]
|
||||
|
||||
altrow
|
||||
|
||||
set rsvicon ""
|
||||
switch [$event get 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" }
|
||||
5 { set rsvicon "745_1_10_Video_2Live.png" }
|
||||
6 { set rsvicon "745_1_11_Video_1REC.png" }
|
||||
7 { set rsvicon "345_6_08_ST_Ad_Hoc.png" }
|
||||
}
|
||||
|
||||
set series 0
|
||||
set rsvicon [$event icon]
|
||||
set RKIcon [$event RKIcon]
|
||||
if {[$event get ucRecKind] == 4} {
|
||||
set RKIcon "175_1_11_Series_Record.png"
|
||||
set series 1
|
||||
} else {
|
||||
switch [$event get 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 ""}
|
||||
}
|
||||
set series 0
|
||||
}
|
||||
|
||||
if {$rsvicon ne ""} {
|
||||
set rsvicon "<img src='images/$rsvicon' height=20>
|
||||
set rsvicon "<img src='/images/$rsvicon' height=20>
|
||||
}
|
||||
if {$RKIcon ne ""} {
|
||||
set RKIcon "<img src='images/$RKIcon' height=20>
|
||||
set RKIcon "<img src='/images/$RKIcon' height=20>
|
||||
}
|
||||
|
||||
if {$table eq "pending"} {
|
||||
if {[$event get action] == 0} {
|
||||
set icon "add"
|
||||
} else {
|
||||
set icon "close"
|
||||
}
|
||||
puts "<td align=center>
|
||||
<img class=va width=30 src=/img/$icon.png></td>"
|
||||
}
|
||||
|
||||
puts "<td>[$event get ulslot]</td>"
|
||||
@@ -67,10 +155,13 @@ foreach event $events {
|
||||
[$event channel_name]</td>
|
||||
"
|
||||
} else {
|
||||
puts "<td colspan=2> <br><br></td>"
|
||||
puts "<td> <br><br></td><td> </td>"
|
||||
}
|
||||
|
||||
puts "<td nowrap>$name</td>"
|
||||
puts "<td nowrap>
|
||||
<a slot=[$event get ulslot] table=$table
|
||||
href=# class=schedule>$name</a>
|
||||
</td>"
|
||||
|
||||
set s [$event get nsttime]
|
||||
set d [$event get nduration]
|
||||
@@ -97,42 +188,51 @@ foreach event $events {
|
||||
puts "<td>[clock format [$event get nduration] -format %T]</td>"
|
||||
|
||||
puts "<td nowrap>$rsvicon $RKIcon</td>"
|
||||
puts "<td nowrap>"
|
||||
set crid [join [lrange [split [$event get szCRID] /] 1 end]]
|
||||
if {$crid != ""} {
|
||||
puts -nonewline "<a href=/cgi-bin/epg_search.jim?"
|
||||
if $series { puts -nonewline "s" }
|
||||
puts "crid=/$crid>
|
||||
<img border=0 src=/images/421_1_00_CH_Title_2R_Arrow.png
|
||||
height=14>
|
||||
[$event get szCRID]"
|
||||
puts "</a>"
|
||||
if {[$event get aulEventToRecordInfo] != ""} {
|
||||
puts "<td><img src=/img/lightning.png
|
||||
alt=\"Accepted by Humax\"
|
||||
title=\"Accepted by Humax\"></td>"
|
||||
} else {
|
||||
puts "<td> </td>"
|
||||
}
|
||||
puts "</td>"
|
||||
puts "<td nowrap>"
|
||||
set flag 0
|
||||
foreach ev [split [$event get szEventToRecord] "|"] {
|
||||
if {$ev eq ""} { continue }
|
||||
set ev [string range $ev 1 end]
|
||||
if {$flag} { puts "<br>" }
|
||||
incr flag
|
||||
set crid [join [lrange [split $ev /] 1 end]]
|
||||
puts -nonewline "<a href=/cgi-bin/epg_search.jim?"
|
||||
puts "crid=/$crid>
|
||||
<img border=0 src=/images/421_1_00_CH_Title_2R_Arrow.png
|
||||
height=14>
|
||||
$ev"
|
||||
puts "</a>"
|
||||
}
|
||||
puts "</td>"
|
||||
puts "</tr>"
|
||||
}
|
||||
puts "</table>"
|
||||
puts "<font class=footnote>Click on the CRID to view episodes.</font>"
|
||||
|
||||
puts {
|
||||
<button onclick="window.location='/backup.shtml';">
|
||||
Backup/Restore Scheduled Recordings/Events.
|
||||
</button>
|
||||
proc eventfooter {} {
|
||||
puts "</tbody></table>"
|
||||
}
|
||||
|
||||
set events [rsv list pending]
|
||||
if {[llength $events] > 0} {
|
||||
puts "<h2>Pending Schedule Events</h2>"
|
||||
eventheader pending
|
||||
foreach event $events {eventrow $event pending}
|
||||
eventfooter
|
||||
puts {
|
||||
<small>
|
||||
<button onclick="window.location='/cgi-bin/db.jim?db=rsvp.db&tab=pending';">
|
||||
Raw database view
|
||||
</button>
|
||||
</small>
|
||||
}
|
||||
}
|
||||
|
||||
puts "<h2>Scheduled Events</h2>"
|
||||
set events [rsv list]
|
||||
eventheader
|
||||
foreach event $events {eventrow $event}
|
||||
eventfooter
|
||||
|
||||
puts {
|
||||
<small>
|
||||
<button onclick="window.location='/backup.shtml';">
|
||||
Backup/Restore Scheduled Recordings/Events
|
||||
</button>
|
||||
<button onclick="window.location='/cgi-bin/db.jim?db=rsv.db&tab=TBL_RESERVATION';">
|
||||
Raw database view
|
||||
</button>
|
||||
<script type=text/javascript>
|
||||
$('button').button();
|
||||
</script>
|
||||
}
|
||||
|
||||
|
||||
21
var/mongoose/include/transmission.jim
Executable file
21
var/mongoose/include/transmission.jim
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
if {![file exists /mod/sbin/transmission-daemon]} { exit 0 }
|
||||
|
||||
set url "/cgi-bin/transmission.jim"
|
||||
|
||||
puts "
|
||||
<div style=\"float: left; padding-top: 5em\">
|
||||
<center>
|
||||
<a href=$url>
|
||||
<img border=0 src=/img/transmission.png>
|
||||
</a>
|
||||
<br>
|
||||
<a href=$url>
|
||||
<b>Transmission</b>
|
||||
</a>
|
||||
<br>
|
||||
</center>
|
||||
</div>
|
||||
"
|
||||
|
||||
21
var/mongoose/lib/chunked
Executable file
21
var/mongoose/lib/chunked
Executable file
@@ -0,0 +1,21 @@
|
||||
|
||||
proc chunk {chk} {
|
||||
puts -nonewline [format "%x\r\n" [string length $chk]]
|
||||
puts -nonewline "$chk\r\n"
|
||||
flush stdout
|
||||
}
|
||||
|
||||
proc chunk_pad {{len 256}} {
|
||||
incr len
|
||||
chunk [string range [format "%${len}d" 0] 1 end-1]
|
||||
}
|
||||
|
||||
proc start_chunked {{type "text/html"}} {
|
||||
puts -nonewline "Content-Type: $type\r\n"
|
||||
puts -nonewline "Transfer-Encoding: chunked\r\n\r\n"
|
||||
}
|
||||
|
||||
proc end_chunked {} {
|
||||
puts -nonewline "0\r\n\r\n\r\n"
|
||||
}
|
||||
|
||||
@@ -2,9 +2,8 @@ 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 progressbar
|
||||
require settings.class progressbar rsv.class
|
||||
|
||||
set ::channeldb 0
|
||||
catch { set ::channeldb [sqlite3.open /var/lib/humaxtv/channel.db] }
|
||||
@@ -15,6 +14,8 @@ if {![file exists $::epgpath] && [file exists $::hdepgpath]} {
|
||||
set ::epgpath $::hdepgpath
|
||||
}
|
||||
|
||||
set ::rsvlookup [rsv lookuptab]
|
||||
|
||||
# * service_id, event_id, start, duration, encrypted, name, text
|
||||
# * warning, content code, content type,
|
||||
# * event CRID, series CRID, rec CRID
|
||||
@@ -37,6 +38,10 @@ class epg {
|
||||
channel_num 0
|
||||
channel_name ""
|
||||
channel_crid ""
|
||||
channel_hsvc 0
|
||||
|
||||
sched_type 0
|
||||
rsv 0
|
||||
}
|
||||
|
||||
epg method _parse {line} {
|
||||
@@ -65,8 +70,15 @@ epg method percent {} {
|
||||
}
|
||||
|
||||
epg method showing {} {
|
||||
set percent [$self percent]
|
||||
if {$percent > 0 && $percent < 100} { return 1 } else { return 0 }
|
||||
set now [clock seconds]
|
||||
if {$start > $now} { return 0 }
|
||||
if {$start + $duration < $now} { return 0 }
|
||||
return 1
|
||||
}
|
||||
|
||||
epg method ended {} {
|
||||
if {$start + $duration < [clock seconds]} { return 1 }
|
||||
return 0
|
||||
}
|
||||
|
||||
epg method elapsed {} {
|
||||
@@ -82,7 +94,7 @@ epg method remaining {} {
|
||||
|
||||
epg method type_icon {} {
|
||||
set img ""
|
||||
switch -- [$self get content_code] {
|
||||
switch -- $content_code {
|
||||
1 { set img "Movie" }
|
||||
2 { set img "News" }
|
||||
3 { set img "Show" }
|
||||
@@ -110,7 +122,7 @@ proc {epg channelicon} {name {width 0} {style ""}} {
|
||||
}
|
||||
|
||||
epg method channel_icon {{width 0} {style ""}} {
|
||||
set str "<img src=\"/img/channels/[$self get channel_name].png\"";
|
||||
set str "<img src=\"/img/channels/$channel_name.png\"";
|
||||
if {$width > 0} { append str " width=$width" }
|
||||
if {$style ne ""} { append str " style=\"$style\" }
|
||||
append str " alt=\"\">"
|
||||
@@ -122,13 +134,38 @@ epg method get_channel_info {} {
|
||||
|
||||
if {!$channel_num && $channeldb != ""} {
|
||||
set chan [lindex [$channeldb query {
|
||||
select szSvcName, usLcn, aucDefaultAuthority
|
||||
select szSvcName, usLcn, aucDefaultAuthority, hsvc
|
||||
from TBL_SVC
|
||||
where usSvcId = %s} "[$self get service_id]"
|
||||
where usSvcId = %s} $service_id
|
||||
] 0]
|
||||
set channel_num $chan(usLcn)
|
||||
set channel_name [string range $chan(szSvcName) 1 end]
|
||||
set channel_crid [string toupper $chan(aucDefaultAuthority)]
|
||||
if {[dict exists $chan usLcn]} {
|
||||
set channel_num $chan(usLcn)
|
||||
set channel_name [string range $chan(szSvcName) 1 end]
|
||||
set channel_crid [string toupper $chan(aucDefaultAuthority)]
|
||||
set channel_hsvc $chan(hSvc)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
epg method get_rsv {} {
|
||||
if {$hsvc == 0} { $self get_channel_info }
|
||||
if {$hsvc == 0} { return }
|
||||
|
||||
if {$rsv == 0 && $event_crid ne ""} {
|
||||
set rsv [rsv entry $event_crid $hsvc]
|
||||
}
|
||||
if {$rsv == 0 && $series_crid ne ""} {
|
||||
set rsv [rsv entry $series_crid $hsvc]
|
||||
}
|
||||
}
|
||||
|
||||
epg method process_sched {} {
|
||||
set sched_type 0
|
||||
if {$event_crid ne "" && "$channel_hsvc$event_crid" in $::rsvlookup} {
|
||||
set sched_type 1
|
||||
} elseif {$series_crid ne "" &&
|
||||
"$channel_hsvc$series_crid" in $::rsvlookup} {
|
||||
set sched_type 2
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,40 +175,55 @@ epg method icon_set {{height 0}} {
|
||||
set set ""
|
||||
if {$icon != ""} {
|
||||
lappend set "<img src=$icon $height
|
||||
alt=\"[$self get content_type]\"
|
||||
title=\"[$self get content_type]\">"
|
||||
alt=\"$content_type\" title=\"$content_type\">"
|
||||
}
|
||||
if {[$self get rec_crid] != ""} {
|
||||
|
||||
$self process_sched
|
||||
if {$sched_type == 1} {
|
||||
lappend set \
|
||||
"<img src=/images/178_1_26_Icon_Recommend.png $height>"
|
||||
"<img src=/images/175_1_11_Reservation_Record.png $height>"
|
||||
}
|
||||
if {[$self get series_crid] != ""} {
|
||||
|
||||
if {$sched_type == 2} {
|
||||
lappend set \
|
||||
"<img src=/images/175_1_11_Series_Record.png $height>"
|
||||
} elseif {$series_crid ne ""} {
|
||||
lappend set \
|
||||
"<img src=/images/178_1_00_Icon_Serise.png $height>"
|
||||
}
|
||||
|
||||
if {$rec_crid ne ""} {
|
||||
lappend set \
|
||||
"<img src=/images/178_1_26_Icon_Recommend.png $height>"
|
||||
}
|
||||
|
||||
return $set
|
||||
}
|
||||
|
||||
epg method cell {} {
|
||||
set name [$self get name]
|
||||
set text [$self get text]
|
||||
|
||||
set percent [$self percent]
|
||||
|
||||
puts "<td nowrap valign=top title=\"$text\">"
|
||||
|
||||
puts [join [$self icon_set 14] ""]
|
||||
|
||||
if {$series_crid ne ""} {
|
||||
set recopts 2
|
||||
} else {
|
||||
set recopts 1
|
||||
}
|
||||
|
||||
puts "
|
||||
<a class=event href=# xs=[$self get service_id]
|
||||
xe=[$self get event_id]>
|
||||
$name</a>"
|
||||
<a class=event href=# xs=$service_id xe=$event_id
|
||||
sch=$sched_type rec=$recopts>
|
||||
$name</a>
|
||||
"
|
||||
|
||||
puts "<br>"
|
||||
|
||||
puts "<font class=footnote>"
|
||||
puts "[clock format [$self get start] -format %H:%M]"
|
||||
puts " ([clock format [$self get duration] -format %T])"
|
||||
puts "[clock format $start -format %H:%M]"
|
||||
puts " ([clock format $duration -format %T])"
|
||||
if {$percent > 0 && $percent < 100} {
|
||||
puts "<br>[progressbar $percent]"
|
||||
puts "$percent% [clock format [$self elapsed] -format %T] /
|
||||
@@ -182,8 +234,8 @@ epg method cell {} {
|
||||
}
|
||||
|
||||
epg method next {} {
|
||||
set tm [expr [$self get start] + [$self get duration] + 60]
|
||||
set nextlist [epg fetch dump -service [$self get service_id] -time $tm]
|
||||
set tm $($start + $duration + 60)
|
||||
set nextlist [epg fetch dump -service $service_id -time $tm]
|
||||
|
||||
if {[llength nextlist] > 0} {
|
||||
return [lindex $nextlist 0]
|
||||
@@ -194,13 +246,25 @@ epg method next {} {
|
||||
|
||||
epg method recommended {} {
|
||||
set rec ""
|
||||
if {[$self get rec_crid] != ""} {
|
||||
if {$rec_crid ne ""} {
|
||||
catch { set rec [lindex [
|
||||
epg fetch dump -crid [$self get rec_crid]] 0] }
|
||||
epg fetch dump -crid $rec_crid] 0] }
|
||||
}
|
||||
return $rec
|
||||
}
|
||||
|
||||
epg method othertimes {} {
|
||||
if {$event_crid eq ""} { return "" }
|
||||
|
||||
set others ""
|
||||
foreach other [epg fetch dump -crid $event_crid] {
|
||||
if {[$other get service_id] == $service_id &&
|
||||
[$other get event_id] == $event_id} { continue }
|
||||
lappend others $other
|
||||
}
|
||||
return $others
|
||||
}
|
||||
|
||||
proc {epg parse} {line} {
|
||||
set e [epg new]
|
||||
$e _parse $line
|
||||
@@ -227,6 +291,7 @@ proc {epg exec} {mode args} {
|
||||
-service { lappend cmd -S $args($arg) }
|
||||
-event { lappend cmd -E $args($arg) }
|
||||
-time { lappend cmd -@ $args($arg) }
|
||||
-day { lappend cmd -/ $args($arg) }
|
||||
-extra { set extra $args($arg) }
|
||||
default { error "Invalid option, $arg" }
|
||||
}
|
||||
|
||||
@@ -1,27 +1,70 @@
|
||||
puts {
|
||||
<div id=dialogue></div>
|
||||
<script type=text/javascript>
|
||||
$(document).ready(function() {
|
||||
var $dialog = $('#dialogue').dialog({
|
||||
title: "Programme Details",
|
||||
modal: false, autoOpen: false,
|
||||
height: 500, width: 700,
|
||||
show: 'scale', hide: 'fade',
|
||||
draggable: true, resizable: true,
|
||||
buttons: { "Close":
|
||||
function() {$(this).dialog('close');}},
|
||||
close: function(e,u) { $('#dialogue').empty().html(
|
||||
'<img src="/img/loading.gif" alt="loading">'); }
|
||||
});
|
||||
$('a.event').click(function(e) {
|
||||
e.preventDefault();
|
||||
var url = '/cgi-bin/epg_info.jim?service=' +
|
||||
$(this).attr('xs') + '&event=' +
|
||||
$(this).attr('xe') + '&bare=1';
|
||||
$('#dialogue').load(url);
|
||||
$dialog.dialog('open');
|
||||
$(document).ready(function() {
|
||||
function doschedule(type)
|
||||
{
|
||||
$('#epginfo_extra').load('/cgi-bin/epg_schedule.jim?' +
|
||||
'service=' +
|
||||
encodeURIComponent($('#dialogue').attr('xs')) +
|
||||
'&event=' +
|
||||
encodeURIComponent($('#dialogue').attr('xe')) +
|
||||
'&type=' + type, function() {
|
||||
$('#restart_block')
|
||||
.load('/cgi-bin/restartblock.jim');
|
||||
});
|
||||
$(":button:contains('Record')").fadeOut('slow');
|
||||
}
|
||||
|
||||
var $buttons1 = {
|
||||
"Close" : function() {$(this).dialog('close');}
|
||||
};
|
||||
var $buttons2 = $.extend(
|
||||
{"Record Programme": function() { doschedule(1) }},
|
||||
$buttons1);
|
||||
var $buttons3 = $.extend(
|
||||
{"Record Series": function() { doschedule(2) }},
|
||||
$buttons2);
|
||||
|
||||
var $dialog = $('#dialogue').dialog({
|
||||
title: "Programme Details",
|
||||
modal: false, autoOpen: false,
|
||||
height: 500, width: 700,
|
||||
show: 'scale', hide: 'fade',
|
||||
draggable: true, resizable: true,
|
||||
buttons: $buttons1,
|
||||
close: function(e,u) { $('#dialogue').empty().html(
|
||||
'<img src="/img/loading.gif" alt="loading">'); }
|
||||
});
|
||||
|
||||
function epgpopup(e, o)
|
||||
{
|
||||
e.preventDefault();
|
||||
var sch = o.attr('sch');
|
||||
var rec = o.attr('rec');
|
||||
if (sch != 0)
|
||||
$dialog.dialog("option", "buttons", $buttons1);
|
||||
else if (rec == 2)
|
||||
$dialog.dialog("option", "buttons", $buttons3);
|
||||
else if (rec == 1)
|
||||
$dialog.dialog("option", "buttons", $buttons2);
|
||||
else
|
||||
$dialog.dialog("option", "buttons", $buttons1);
|
||||
var url = '/cgi-bin/epg_info.jim?service=' +
|
||||
o.attr('xs') + '&event=' +
|
||||
o.attr('xe') + '&bare=1';
|
||||
$('#dialogue').load(url, function() {
|
||||
$('#dialogue a.event').click(function(e) {
|
||||
epgpopup(e, $(this));
|
||||
});
|
||||
});
|
||||
$('#dialogue')
|
||||
.attr('xs', o.attr('xs'))
|
||||
.attr('xe', o.attr('xe'));
|
||||
$dialog.dialog('open');
|
||||
}
|
||||
$('a.event').click(function(e) { epgpopup(e, $(this)) });
|
||||
});
|
||||
</script>
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,8 @@ 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></tr><tr><td>"
|
||||
|
||||
cts 7 "Art" "Arts/Culture"
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
/mod/bin/ffmpeg "$@" 2>&1 | sed '
|
||||
1,8d
|
||||
$d
|
||||
'
|
||||
if [ -x /mod/bin/ffprobe ]; then
|
||||
/mod/bin/ffprobe "$@" 2>&1 | sed '
|
||||
1,10d
|
||||
'
|
||||
else
|
||||
/mod/bin/ffmpeg "$@" 2>&1 | sed '
|
||||
1,8d
|
||||
$d
|
||||
'
|
||||
fi
|
||||
exit 0
|
||||
|
||||
|
||||
41
var/mongoose/lib/findhsvc
Executable file
41
var/mongoose/lib/findhsvc
Executable file
@@ -0,0 +1,41 @@
|
||||
|
||||
if {![exists -proc findhsvc]} {
|
||||
|
||||
require rsv.class
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
proc findhsvcbylcn {lcn} {
|
||||
global rsvdb
|
||||
|
||||
set hsvc [$rsvdb query "
|
||||
select hSvc
|
||||
from channel.TBL_SVC
|
||||
where usLcn = $lcn
|
||||
limit 1
|
||||
"]
|
||||
|
||||
if {[llength $hsvc] == 1} {
|
||||
return [lindex [lindex $hsvc 0] 1]
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
# stderr is always unbuffered so use that...
|
||||
/bin/opkg "$@" 1>&2
|
||||
/bin/opkg "$@" 2>&1
|
||||
exit 0
|
||||
|
||||
|
||||
@@ -3,25 +3,25 @@ if {[expr ! [exists -proc class ]]} { package require oo }
|
||||
|
||||
class pkg {
|
||||
name ""
|
||||
latest ""
|
||||
descr ""
|
||||
installed ""
|
||||
latest ""
|
||||
install_time 0
|
||||
}
|
||||
|
||||
pkg method _load {nm info} {
|
||||
set name $nm
|
||||
set latest [lindex $info 0]
|
||||
set descr [lrange $info 1 end]
|
||||
set ::pkgmeta {}
|
||||
|
||||
foreach line [split [exec /bin/opkg status $name] "\n"] {
|
||||
if {[string match {Version: *} $line]} {
|
||||
set installed [string range $line 9 end]
|
||||
}
|
||||
if {[string match {Installed-Time: } $line]} {
|
||||
set install_time [string range $line 16 end]
|
||||
}
|
||||
}
|
||||
pkg method _load {nm} {
|
||||
set name $nm
|
||||
set info [join [split [exec /bin/opkg list $nm] "\n"] " "]
|
||||
regexp {^([^ ]+) - ([^ ]+) - (.*)$} $info full xname latest descr
|
||||
set info [exec /bin/opkg list-installed $nm]
|
||||
regexp {^([^ ]+) - ([^ ]+)$} $info full xname installed
|
||||
|
||||
return $self
|
||||
}
|
||||
|
||||
proc {pkg load} {nm} {
|
||||
return [[pkg] _load $nm]
|
||||
}
|
||||
|
||||
pkg method is {what} {
|
||||
@@ -38,28 +38,19 @@ pkg method is {what} {
|
||||
return 0
|
||||
}
|
||||
|
||||
proc {pkg load} {nm info} {
|
||||
set e [pkg]
|
||||
$e _load $nm $info
|
||||
return $e
|
||||
}
|
||||
|
||||
proc {pkg avail} {} {
|
||||
set inst_pkgs [pkg inst]
|
||||
set avail_pkgs {}
|
||||
foreach pkg [split [exec /bin/opkg list] "\n"] {
|
||||
if [regexp {^ } $pkg] {
|
||||
append descr $pkg
|
||||
} else {
|
||||
if {[regexp {^([^ ]+) - ([^ ]+) - (.*)$} \
|
||||
$pkg full name ver descr] == 0} { continue }
|
||||
}
|
||||
set avail_pkgs($name) [concat $ver "$descr"]
|
||||
#puts "Set: $name = ($ver, $descr)<br>"
|
||||
if [regexp {^ } $pkg] { continue }
|
||||
if {[regexp {^([^ ]+)} $pkg name] == 0} { continue }
|
||||
if {$name ni $inst_pkgs} { lappend avail_pkgs $name }
|
||||
#puts "New: $name<br>"
|
||||
}
|
||||
return $avail_pkgs
|
||||
}
|
||||
|
||||
proc {pkg installed} {} {
|
||||
proc {pkg inst} {} {
|
||||
# Build a list of installed packages - just the names
|
||||
set inst_pkgs {}
|
||||
foreach pkg [split [exec /bin/opkg list-installed] "\n"] {
|
||||
@@ -70,15 +61,43 @@ proc {pkg installed} {} {
|
||||
return $inst_pkgs
|
||||
}
|
||||
|
||||
proc {pkg upgradable} {} {
|
||||
proc {pkg upgr} {} {
|
||||
#webif - 0.5.3 - 0.5.7
|
||||
set upgr_pkgs {}
|
||||
foreach pkg [split [exec /bin/opkg list-upgradable] "\n"] {
|
||||
if {[regexp {^([^ ]+) - ([^ ]+) - (.*)$} $pkg \
|
||||
dummy name oldver newver] == 0} { continue }
|
||||
set upgr_pkgs($name) [concat $oldver $newver]
|
||||
#puts "Set: $name = ($oldver, $newver)<br>"
|
||||
if {[regexp {^([^ ]+)} $pkg name] == 0} { continue }
|
||||
lappend upgr_pkgs $name
|
||||
#puts "Upgr: $name<br>"
|
||||
}
|
||||
return $upgr_pkgs
|
||||
}
|
||||
|
||||
proc {pkg loadmeta} {} {
|
||||
if {[llength $::pkgmeta]} { return }
|
||||
if {![file exists "/mod/var/pkg.meta"]} {
|
||||
pkg fetchmeta
|
||||
} else {
|
||||
set meta [open "/mod/var/pkg.meta" r]
|
||||
set ::pkgmeta [read $meta]
|
||||
$meta close
|
||||
}
|
||||
}
|
||||
|
||||
proc {pkg fetchmeta} {} {
|
||||
set f [socket stream hummypkg.org.uk:80]
|
||||
$f puts -nonewline "GET /pkg.meta HTTP/1.1\r\n"
|
||||
$f puts -nonewline "Host: hummypkg.org.uk\r\n"
|
||||
$f puts -nonewline "\r\n"
|
||||
|
||||
set line [string trim [$f gets]]
|
||||
while {[string length $line]} {
|
||||
set line [string trim [$f gets]]
|
||||
}
|
||||
set ::pkgmeta [$f read]
|
||||
$f close
|
||||
|
||||
set ff [open "/mod/var/pkg.meta" w]
|
||||
puts $ff $::pkgmeta
|
||||
$ff close
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
proc eval_plugins {hook} {
|
||||
foreach plugin [glob /mod/var/mongoose/plugin/*] {
|
||||
foreach plugin [glob -nocomplain /mod/var/mongoose/plugin/*] {
|
||||
if {[file isfile "$plugin/$hook.hook"]} {
|
||||
uplevel source "$plugin/$hook.hook"
|
||||
}
|
||||
|
||||
@@ -7,12 +7,26 @@ if {![exists -proc settings ]} { require settings.class }
|
||||
set rsvdb [sqlite3.open /var/lib/humaxtv/rsv.db]
|
||||
$rsvdb query {attach database '/var/lib/humaxtv/channel.db' as channel}
|
||||
|
||||
if {![file exists /var/lib/humaxtv/rsvp.db]} {
|
||||
file copy /var/lib/humaxtv/rsv.db /var/lib/humaxtv/rsvp.db
|
||||
set tdb [sqlite3.open /var/lib/humaxtv/rsvp.db]
|
||||
$tdb query {drop table TBL_VERSION}
|
||||
$tdb query {alter table TBL_RESERVATION rename to pending}
|
||||
$tdb query {alter table pending add column action int}
|
||||
$tdb query {delete from pending}
|
||||
$tdb close
|
||||
}
|
||||
$rsvdb query {attach database '/var/lib/humaxtv/rsvp.db' as pending}
|
||||
# This is required to upgrade old tables and will be removed in a future
|
||||
# version.
|
||||
catch { $rsvdb query {alter table pending add column action int} }
|
||||
|
||||
class rsv {
|
||||
ulslot 0
|
||||
ulslot -1
|
||||
ersvtype 0
|
||||
hsvc 0
|
||||
nsttime 0
|
||||
szsttime 0
|
||||
szsttime "00000000000000"
|
||||
nduration 0
|
||||
erepeat 0
|
||||
usevtid 0
|
||||
@@ -37,6 +51,11 @@ class rsv {
|
||||
szSvcName {}
|
||||
usLcn 0
|
||||
sort 0
|
||||
action 0
|
||||
}
|
||||
|
||||
rsv method clear_ulslot {} {
|
||||
set ulslot -1
|
||||
}
|
||||
|
||||
rsv method name {} {
|
||||
@@ -49,6 +68,7 @@ rsv method name {} {
|
||||
5 { set name "--- Wake-up ---" }
|
||||
6 { set name "--- Sleep ---" }
|
||||
7 { set name "--- Auto Update ---" }
|
||||
11 { set name "--- DSO Event ---" }
|
||||
default { set name "--- Unknown event type $ersvtype ---" }
|
||||
}
|
||||
}
|
||||
@@ -60,6 +80,42 @@ rsv method channel_name {} {
|
||||
return [string range $szSvcName 1 end]
|
||||
}
|
||||
|
||||
rsv method icon {} {
|
||||
set rsvicon ""
|
||||
switch [$self get 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" }
|
||||
5 { set rsvicon "745_1_10_Video_2Live.png" }
|
||||
6 { set rsvicon "745_1_11_Video_1REC.png" }
|
||||
7 { set rsvicon "345_6_08_ST_Ad_Hoc.png" }
|
||||
}
|
||||
return $rsvicon
|
||||
}
|
||||
|
||||
rsv method RKIcon {} {
|
||||
if {[$self get ucRecKind] == 4} {
|
||||
set RKIcon "175_1_11_Series_Record.png"
|
||||
} else {
|
||||
switch [$self get 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
|
||||
}
|
||||
|
||||
rsv method set_delete {} {
|
||||
set action 1
|
||||
}
|
||||
|
||||
rsv method remove_pending {} {
|
||||
$::rsvdb query "delete from pending where ulslot = [$self get ulslot]"
|
||||
}
|
||||
|
||||
rsv method fix_hsvc {} {
|
||||
global rsvdb
|
||||
|
||||
@@ -79,13 +135,27 @@ rsv method fix_hsvc {} {
|
||||
return $hsvc
|
||||
}
|
||||
|
||||
rsv method insert {} {
|
||||
rsv method insert {{table pending}} {
|
||||
global rsvdb
|
||||
if {!$ulslot} {
|
||||
set slot [
|
||||
$rsvdb query {select max(ulslot) FROM TBL_RESERVATION}]
|
||||
set slot [expr 1 + [lindex [lindex $slot 0] 1]]
|
||||
set ulslot $slot
|
||||
|
||||
# Find a spare slot.
|
||||
if {$ulslot < 0} {
|
||||
set slotlist [$rsvdb query "
|
||||
select ulslot FROM $table
|
||||
order by ulslot;
|
||||
"]
|
||||
if {[llength $slotlist] > 0} {
|
||||
set slots [lmap i $slotlist {lindex $i 1}]
|
||||
set max [lindex $i end]
|
||||
for {set i 0} {$i < $max} {incr i} {
|
||||
if {$i ni $slots} {
|
||||
set ulslot $i
|
||||
break
|
||||
}
|
||||
}
|
||||
if {$ulslot < 0} { set ulslot $($max + 1) }
|
||||
}
|
||||
if {$ulslot < 0} { set ulslot 0 }
|
||||
}
|
||||
|
||||
set fields [lsort [$self vars]]
|
||||
@@ -95,12 +165,20 @@ rsv method insert {} {
|
||||
set fields [lreplace $fields $df $df]
|
||||
}
|
||||
|
||||
set vals {}
|
||||
foreach field $fields {
|
||||
lappend vals "'[$self get $field]'"
|
||||
if {$table ne "pending"} {
|
||||
set df [lsearch $fields "action"]
|
||||
set fields [lreplace $fields $df $df]
|
||||
}
|
||||
|
||||
set query "insert into TBL_RESERVATION("
|
||||
set vals {}
|
||||
foreach field $fields {
|
||||
# Escape any quotes embedded in the data.
|
||||
regsub -all {'} [$self get $field] {''} f
|
||||
lappend vals "'$f'"
|
||||
#lappend vals "'[$self get $field]'"
|
||||
}
|
||||
|
||||
set query "insert into ${table}("
|
||||
append query [join $fields ","]
|
||||
append query ") values("
|
||||
append query [join $vals ","]
|
||||
@@ -109,18 +187,16 @@ rsv method insert {} {
|
||||
$rsvdb query $query
|
||||
}
|
||||
|
||||
proc {rsv list} {} {
|
||||
catch { $::rsvdb query {.mode tcl} }
|
||||
|
||||
set res [$::rsvdb query {
|
||||
select tbl_reservation.*,
|
||||
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
|
||||
from tbl_reservation
|
||||
from $table
|
||||
left join channel.TBL_SVC
|
||||
on main.TBL_RESERVATION.hSvc = channel.TBL_SVC.hSvc
|
||||
on $table.hSvc = channel.TBL_SVC.hSvc
|
||||
order by sort, nsttime
|
||||
}]
|
||||
"]
|
||||
|
||||
set records {}
|
||||
foreach rec $res {
|
||||
@@ -130,7 +206,87 @@ proc {rsv list} {} {
|
||||
return $records
|
||||
}
|
||||
|
||||
proc {rsv lookuptab} {} {
|
||||
set records {}
|
||||
foreach tab {tbl_reservation pending} {
|
||||
set res [$::rsvdb query "
|
||||
select $tab.szCRID, channel.TBL_SVC.hSvc
|
||||
from $tab left join channel.TBL_SVC
|
||||
on $tab.hSvc = channel.TBL_SVC.hSvc
|
||||
where ersvtype <= 3
|
||||
"]
|
||||
|
||||
foreach rec $res {
|
||||
lappend records "$rec(hSvc)/[file tail $rec(szCRID)]"
|
||||
}
|
||||
}
|
||||
|
||||
return $records
|
||||
}
|
||||
|
||||
proc {rsv entry} {{table TBL_RESERVATION} crid svc} {
|
||||
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 szCRID like '%%%s' and $table.hsvc = '%s'
|
||||
" $crid $svc]
|
||||
|
||||
if {[llength $res] > 0} {
|
||||
return [rsv new [lindex $res 0]]
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
proc {rsv fetch} {{table TBL_RESERVATION} 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'
|
||||
and $table.nsttime = '%s'
|
||||
and $table.usevtid = '%s'
|
||||
and $table.szEventToRecord = '%s'
|
||||
" $hsvc $nsttime $usevtid $events]
|
||||
|
||||
if {[llength $res] > 0} {
|
||||
return [rsv new [lindex $res 0]]
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
proc {rsv slot} {{table TBL_RESERVATION} slot} {
|
||||
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 ulslot = %s" $slot]
|
||||
|
||||
if {[llength $res] > 0} {
|
||||
return [rsv new [lindex $res 0]]
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
proc {rsv cleanup} {} {
|
||||
catch {$::rsvdb close}
|
||||
}
|
||||
|
||||
proc {rsv commit} {} {
|
||||
$::rsvdb query {begin transaction}
|
||||
foreach rec [rsv list pending] {
|
||||
if {[$rec get action] == 0} {
|
||||
$rec clear_ulslot
|
||||
$rec insert TBL_RESERVATION
|
||||
}
|
||||
}
|
||||
$::rsvdb query {delete from pending}
|
||||
$::rsvdb query {commit transaction}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,12 +2,25 @@
|
||||
if {![exists -proc class ]} { package require oo }
|
||||
if {![exists -proc sqlite3.open ]} { package require sqlite3 }
|
||||
|
||||
set settingsdb [sqlite3.open /mod/etc/webif.db]
|
||||
if {![file exists /mod/etc/webif.db]} {
|
||||
set settingsdb [sqlite3.open /mod/etc/webif.db]
|
||||
catch {
|
||||
$settingsdb query {
|
||||
CREATE TABLE settings(name text, nval int, tval text);
|
||||
}
|
||||
$settingsdb query {
|
||||
CREATE UNIQUE INDEX key on settings(name);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
set settingsdb [sqlite3.open /mod/etc/webif.db]
|
||||
}
|
||||
|
||||
class settings {
|
||||
hostname ""
|
||||
channel_group 0
|
||||
smtp_server ""
|
||||
pkgdev 0
|
||||
}
|
||||
|
||||
settings method hostname {{name ""}} {
|
||||
@@ -86,6 +99,10 @@ settings method channel_group {{group -1}} {
|
||||
return [$self _nval_setting channel_group $group]
|
||||
}
|
||||
|
||||
settings method pkgdev {{val -1}} {
|
||||
return [$self _nval_setting pkgdev $val]
|
||||
}
|
||||
|
||||
settings method channel_groups {} {
|
||||
set ret ""
|
||||
set db [sqlite3.open /var/lib/humaxtv/setup.db]
|
||||
|
||||
Reference in New Issue
Block a user