Compare commits
24 Commits
0.6.2@2148
...
0.7.0@2148
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
af87e1a66e | ||
|
|
ed225ca751 | ||
|
|
cfb12b7da6 | ||
|
|
1d44efdcdc | ||
|
|
0eb305c32c | ||
|
|
6797ee4416 | ||
|
|
510c6c7407 | ||
|
|
f6bf03691d | ||
|
|
b378ec1b9c | ||
|
|
df85584352 | ||
|
|
b7310e9765 | ||
|
|
3f02bf8365 | ||
|
|
1d6917a782 | ||
|
|
0852c70891 | ||
|
|
981c8312cd | ||
|
|
3559a430ab | ||
|
|
945c6d1b4b | ||
|
|
81c3ef4f73 | ||
|
|
2c61281b09 | ||
|
|
d5b27acd46 | ||
|
|
767021557f | ||
|
|
4f900f47b4 | ||
|
|
8383651367 | ||
|
|
d764969b8f |
@@ -1,11 +1,11 @@
|
||||
Package: webif
|
||||
Priority: optional
|
||||
Section: web
|
||||
Version: 0.6.2
|
||||
Version: 0.7.0
|
||||
Architecture: mipsel
|
||||
Maintainer: af123@hummypkg.org.uk
|
||||
Depends: mongoose(>=3.0),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.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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -33,24 +33,6 @@ if {[catch { set fd [open $ffile r] } 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..."
|
||||
|
||||
$rsvdb query {begin transaction;}
|
||||
@@ -111,7 +93,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 +117,7 @@ foreach line $data {
|
||||
|
||||
$rsvdb query {commit transaction;}
|
||||
|
||||
close [open /tmp/.restartpending w]
|
||||
system restartpending
|
||||
|
||||
close $fd
|
||||
rsv cleanup
|
||||
|
||||
@@ -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 "}"
|
||||
|
||||
|
||||
113
var/mongoose/cgi-bin/channel.jim
Executable file
113
var/mongoose/cgi-bin/channel.jim
Executable file
@@ -0,0 +1,113 @@
|
||||
#!/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>Channels</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]
|
||||
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 "</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>
|
||||
}
|
||||
|
||||
@@ -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,10 +70,16 @@ proc db_info {db_file} {
|
||||
$db close
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
|
||||
@@ -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,7 +40,29 @@ 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]
|
||||
@@ -60,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>
|
||||
"
|
||||
}
|
||||
|
||||
@@ -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)|"
|
||||
} 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]} {
|
||||
set r [rsv construct $event $type]
|
||||
if {[catch {$r 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]
|
||||
system restartpending
|
||||
}
|
||||
|
||||
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]
|
||||
@@ -55,13 +52,14 @@ 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,9 +1,56 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/setup
|
||||
require rsv.class system.class
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
|
||||
#puts [exec /etc/init.d/S90settop restart]
|
||||
#file delete /tmp/.restartpending
|
||||
puts [exec killall humaxtv]
|
||||
cgi_input
|
||||
if {[cgi_get now] eq "yes"} {
|
||||
# - Busybox reboot does sync the disk but may still not be clean enough.
|
||||
puts "Restarting."
|
||||
system 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 progressbar
|
||||
|
||||
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>"
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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 |
@@ -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> |
|
||||
|
||||
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);
|
||||
@@ -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
|
||||
|
||||
@@ -44,8 +44,9 @@ foreach record [lsort -command rsort $records] {
|
||||
if {$favlist != "" && [$record get service_id] ni $favlist} {
|
||||
continue
|
||||
}
|
||||
altrow
|
||||
set num [$record get channel_num]
|
||||
if {$num == 0 || $num >= 800} { continue }
|
||||
altrow
|
||||
puts "<td>$num</td>"
|
||||
puts "<td>[$record channel_icon 50]</td>
|
||||
<td>
|
||||
|
||||
@@ -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])"
|
||||
|
||||
|
||||
@@ -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 {
|
||||
@@ -35,15 +33,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>
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
source /mod/var/mongoose/lib/setup
|
||||
require altrow rsv.class progressbar
|
||||
|
||||
set events [rsv list]
|
||||
require altrow rsv.class progressbar epg.class
|
||||
|
||||
puts {
|
||||
<div id=dialogue></div>
|
||||
<script type=text/javascript>
|
||||
|
||||
$.tablesorter.addParser({
|
||||
@@ -28,7 +27,7 @@ $.tablesorter.addParser({
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#schedtable').tablesorter({
|
||||
$('table.tablesorter').tablesorter({
|
||||
headers: {
|
||||
1: { sorter: false },
|
||||
3: { sorter: 'programme' },
|
||||
@@ -40,58 +39,114 @@ $(document).ready(function() {
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<table id=schedtable class="borders tablesorter">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th> </th><th>Channel</th>
|
||||
<th>Programme</th>
|
||||
<th>Start Time</th>
|
||||
<th>Duration</th>
|
||||
<th>Mode</th>
|
||||
<th>Event/Series ID</th>
|
||||
<th>Events</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
$(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} note} {
|
||||
puts {
|
||||
<fieldset style="display: inline; padding: 1em">
|
||||
<legend>
|
||||
}
|
||||
puts "<h3>$note</h3>"
|
||||
puts {
|
||||
</legend>
|
||||
<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>"
|
||||
@@ -99,8 +154,7 @@ foreach event $events {
|
||||
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>
|
||||
@@ -109,70 +163,75 @@ foreach event $events {
|
||||
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]
|
||||
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>"
|
||||
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>"
|
||||
}
|
||||
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>"
|
||||
if {[$event get aulEventToRecordInfo] != ""} {
|
||||
puts "<td>*</td>"
|
||||
puts "<td><img src=/img/lightning.png
|
||||
alt=\"Accepted by Humax\"
|
||||
title=\"Accepted by Humax\"></td>"
|
||||
} else {
|
||||
puts "<td> </td>"
|
||||
}
|
||||
puts "</tr>"
|
||||
}
|
||||
puts "</tbody></table>"
|
||||
puts "<font class=footnote>Click on the CRID to view episodes.</font>"
|
||||
|
||||
proc eventfooter {} {
|
||||
puts "</tbody></table></fieldset>"
|
||||
}
|
||||
|
||||
set events [rsv list pending]
|
||||
if {[llength $events] > 0} {
|
||||
eventheader pending "Pending Scheduled Events"
|
||||
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>
|
||||
}
|
||||
}
|
||||
|
||||
set events [rsv list]
|
||||
eventheader "live" "Scheduled Events"
|
||||
foreach event $events {eventrow $event}
|
||||
eventfooter
|
||||
|
||||
puts {
|
||||
<br>
|
||||
<small>
|
||||
<button onclick="window.location='/backup.shtml';">
|
||||
Backup/Restore Scheduled Recordings/Events
|
||||
|
||||
@@ -70,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 {} {
|
||||
@@ -129,7 +136,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)
|
||||
@@ -152,6 +159,16 @@ epg method get_rsv {} {
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
epg method icon_set {{height 0}} {
|
||||
if {$height > 0} { set height "height=$height" } else { set height "" }
|
||||
set icon [$self type_icon]
|
||||
@@ -161,14 +178,10 @@ epg method icon_set {{height 0}} {
|
||||
alt=\"$content_type\" title=\"$content_type\">"
|
||||
}
|
||||
|
||||
set sched_type 0
|
||||
if {$event_crid ne "" && "$channel_hsvc$event_crid" in $::rsvlookup} {
|
||||
set sched_type 1
|
||||
$self process_sched
|
||||
if {$sched_type == 1} {
|
||||
lappend set \
|
||||
"<img src=/images/175_1_11_Reservation_Record.png $height>"
|
||||
} elseif {$series_crid ne "" &&
|
||||
"$channel_hsvc$series_crid" in $::rsvlookup} {
|
||||
set sched_type 2
|
||||
}
|
||||
|
||||
if {$sched_type == 2} {
|
||||
@@ -184,6 +197,11 @@ 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
|
||||
}
|
||||
|
||||
@@ -240,6 +258,18 @@ epg method recommended {} {
|
||||
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
|
||||
@@ -266,6 +296,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,63 +1,70 @@
|
||||
puts {
|
||||
<div id=dialogue></div>
|
||||
<script type=text/javascript>
|
||||
$(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);
|
||||
$(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 $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">'); }
|
||||
});
|
||||
$('a.event').click(function(e) {
|
||||
e.preventDefault();
|
||||
var sch = $(this).attr('sch');
|
||||
var rec = $(this).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=' +
|
||||
$(this).attr('xs') + '&event=' +
|
||||
$(this).attr('xe') + '&bare=1';
|
||||
$('#dialogue').load(url);
|
||||
$('#dialogue')
|
||||
.attr('xs', $(this).attr('xs'))
|
||||
.attr('xe', $(this).attr('xe'));
|
||||
$dialog.dialog('open');
|
||||
});
|
||||
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
|
||||
|
||||
|
||||
38
var/mongoose/lib/findhsvc
Executable file
38
var/mongoose/lib/findhsvc
Executable file
@@ -0,0 +1,38 @@
|
||||
|
||||
if {![exists -proc get_channel_attr]} {
|
||||
require rsv.class
|
||||
|
||||
proc get_channel_attr {channel {field hSvc}} {
|
||||
global rsvdb
|
||||
|
||||
set ff [$rsvdb query "
|
||||
select $field
|
||||
from channel.TBL_SVC
|
||||
where szSvcName = '$channel'
|
||||
or szSvcname = '\025$channel'
|
||||
limit 1
|
||||
"]
|
||||
|
||||
if {[llength $ff] == 1} {
|
||||
return [lindex [lindex $ff 0] 1]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
proc get_channel_attr_bylcn {lcn {field hSvc}} {
|
||||
global rsvdb
|
||||
|
||||
set ff [$rsvdb query "
|
||||
select $field
|
||||
from channel.TBL_SVC
|
||||
where usLcn = $lcn
|
||||
limit 1
|
||||
"]
|
||||
|
||||
if {[llength $ff] == 1} {
|
||||
return [lindex [lindex $ff 0] 1]
|
||||
}
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,20 @@ 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}
|
||||
catch { $rsvdb query {.mode tcl} }
|
||||
|
||||
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 -1
|
||||
@@ -38,6 +51,11 @@ class rsv {
|
||||
szSvcName {}
|
||||
usLcn 0
|
||||
sort 0
|
||||
action 0
|
||||
}
|
||||
|
||||
rsv method clear_ulslot {} {
|
||||
set ulslot -1
|
||||
}
|
||||
|
||||
rsv method name {} {
|
||||
@@ -50,7 +68,7 @@ rsv method name {} {
|
||||
5 { set name "--- Wake-up ---" }
|
||||
6 { set name "--- Sleep ---" }
|
||||
7 { set name "--- Auto Update ---" }
|
||||
11 { set name "--- DSO Event? ---" }
|
||||
11 { set name "--- DSO Event ---" }
|
||||
default { set name "--- Unknown event type $ersvtype ---" }
|
||||
}
|
||||
}
|
||||
@@ -62,16 +80,54 @@ rsv method channel_name {} {
|
||||
return [string range $szSvcName 1 end]
|
||||
}
|
||||
|
||||
rsv method icon {} {
|
||||
set rsvicon ""
|
||||
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" }
|
||||
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 {} {
|
||||
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
|
||||
}
|
||||
|
||||
rsv method set_delete {} {
|
||||
set action 1
|
||||
}
|
||||
|
||||
rsv method remove_pending {} {
|
||||
$::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]
|
||||
@@ -81,25 +137,41 @@ rsv method fix_hsvc {} {
|
||||
return $hsvc
|
||||
}
|
||||
|
||||
rsv method insert {} {
|
||||
rsv method insert {{table pending}} {
|
||||
global rsvdb
|
||||
|
||||
# Duplicate check - all tables
|
||||
if {$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 slots [lmap i [
|
||||
$rsvdb query {
|
||||
select ulslot FROM TBL_RESERVATION
|
||||
order by ulslot;
|
||||
}] {lindex $i 1}]
|
||||
|
||||
set max [lindex $i end]
|
||||
for {set i 0} {$i < $max} {incr i} {
|
||||
if {$i ni $slots} {
|
||||
set ulslot $i
|
||||
break
|
||||
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 == -1} { set ulslot $($max + 1) }
|
||||
if {$ulslot < 0} { set ulslot 0 }
|
||||
}
|
||||
|
||||
set fields [lsort [$self vars]]
|
||||
@@ -109,6 +181,11 @@ rsv method insert {} {
|
||||
set fields [lreplace $fields $df $df]
|
||||
}
|
||||
|
||||
if {$table ne "pending"} {
|
||||
set df [lsearch $fields "action"]
|
||||
set fields [lreplace $fields $df $df]
|
||||
}
|
||||
|
||||
set vals {}
|
||||
foreach field $fields {
|
||||
# Escape any quotes embedded in the data.
|
||||
@@ -117,7 +194,7 @@ rsv method insert {} {
|
||||
#lappend vals "'[$self get $field]'"
|
||||
}
|
||||
|
||||
set query "insert into TBL_RESERVATION("
|
||||
set query "insert into ${table}("
|
||||
append query [join $fields ","]
|
||||
append query ") values("
|
||||
append query [join $vals ","]
|
||||
@@ -126,16 +203,18 @@ rsv method insert {} {
|
||||
$rsvdb query $query
|
||||
}
|
||||
|
||||
proc {rsv list} {} {
|
||||
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
|
||||
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 main.TBL_RESERVATION.hSvc = channel.TBL_SVC.hSvc
|
||||
order by sort, nsttime
|
||||
}]
|
||||
on $table.hSvc = channel.TBL_SVC.hSvc
|
||||
order by sort1, sort2 desc, nsttime
|
||||
"]
|
||||
|
||||
set records {}
|
||||
foreach rec $res {
|
||||
@@ -146,31 +225,67 @@ proc {rsv list} {} {
|
||||
}
|
||||
|
||||
proc {rsv lookuptab} {} {
|
||||
set res [$::rsvdb query {
|
||||
select tbl_reservation.szCRID, channel.TBL_SVC.hSvc
|
||||
from tbl_reservation left join channel.TBL_SVC
|
||||
on main.TBL_RESERVATION.hSvc = channel.TBL_SVC.hSvc
|
||||
where ersvtype <= 3
|
||||
}]
|
||||
|
||||
|
||||
set records {}
|
||||
foreach rec $res {
|
||||
lappend records "$rec(hSvc)/[file tail $rec(szCRID)]"
|
||||
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} {crid svc} {
|
||||
set res [$::rsvdb query {
|
||||
select tbl_reservation.*,
|
||||
proc {rsv entry} {{table TBL_RESERVATION} crid svc} {
|
||||
set res [$::rsvdb query "
|
||||
select $table.*,
|
||||
channel.TBL_SVC.szSvcName, channel.TBL_SVC.usLcn
|
||||
from tbl_reservation
|
||||
from $table
|
||||
left join channel.TBL_SVC
|
||||
on main.TBL_RESERVATION.hSvc = channel.TBL_SVC.hSvc
|
||||
where szCRID like '%%%s' and tbl_reservation.hsvc = '%s'
|
||||
} $crid $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} 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.ersvtype = '%s'
|
||||
and $table.hsvc = '%s'
|
||||
and $table.nsttime = '%s'
|
||||
and $table.usevtid = '%s'
|
||||
and $table.szEventToRecord = '%s'
|
||||
" $ersvtype $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]]
|
||||
@@ -182,3 +297,67 @@ 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}
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
} 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]
|
||||
}
|
||||
|
||||
|
||||
64
var/mongoose/lib/system.class
Normal file
64
var/mongoose/lib/system.class
Normal file
@@ -0,0 +1,64 @@
|
||||
|
||||
if {![exists -proc class ]} { package require oo }
|
||||
|
||||
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 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?
|
||||
set pid [exec /mod/bin/busybox/pgrep humaxtv]
|
||||
set c 0
|
||||
catch { set c [exec /mod/bin/lsof -p $pid | grep Video | fgrep .ts | wc -l] }
|
||||
|
||||
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]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user