Compare commits
6 Commits
0.64@2148
...
0.6.5@2148
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
981c8312cd | ||
|
|
3559a430ab | ||
|
|
945c6d1b4b | ||
|
|
81c3ef4f73 | ||
|
|
2c61281b09 | ||
|
|
d5b27acd46 |
@@ -1,11 +1,11 @@
|
||||
Package: webif
|
||||
Priority: optional
|
||||
Section: web
|
||||
Version: 0.6.4
|
||||
Version: 0.6.5
|
||||
Architecture: mipsel
|
||||
Maintainer: af123@hummypkg.org.uk
|
||||
Depends: mongoose(>=3.0-2),jim(>=0.71-1),jim-sqlite3(>=0.71-1),jim-cgi(>=0.4),jim-oo,jim-pack,service-control,busybox(>=1.18.3-1),lsof,epg(>=1.0.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.
|
||||
|
||||
@@ -5,6 +5,8 @@ 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
|
||||
|
||||
@@ -21,8 +23,7 @@ if {[file exists $dmsfile]} {
|
||||
set muri [$db query "
|
||||
select tblresource.mimetype, contenturi
|
||||
from tblresource join tblmedia using (mediaid)
|
||||
where localurl = '$rfile'
|
||||
"]
|
||||
where localurl = '%s'" $rfile]
|
||||
if {$muri != ""} {
|
||||
set rec [lindex $muri 0]
|
||||
set xuri [lindex $rec 3]
|
||||
|
||||
@@ -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 "}"
|
||||
|
||||
|
||||
@@ -62,6 +62,7 @@ proc db_info {db_file} {
|
||||
$db close
|
||||
}
|
||||
|
||||
db_info /var/lib/humaxtv/rsvp.db
|
||||
db_info /var/lib/humaxtv/rsv.db
|
||||
db_info /var/lib/humaxtv/setup.db
|
||||
db_info /var/lib/humaxtv/channel.db
|
||||
|
||||
@@ -1,9 +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
|
||||
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."
|
||||
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
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -36,14 +36,7 @@ puts {
|
||||
$('#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);
|
||||
}
|
||||
});
|
||||
}
|
||||
window.location = '/cgi-bin/restart.jim';
|
||||
});
|
||||
</script>
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
source /mod/var/mongoose/lib/setup
|
||||
require altrow rsv.class progressbar
|
||||
|
||||
set events [rsv list]
|
||||
|
||||
puts {
|
||||
<script type=text/javascript>
|
||||
|
||||
@@ -28,7 +26,7 @@ $.tablesorter.addParser({
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#schedtable').tablesorter({
|
||||
$('table.tablesorter').tablesorter({
|
||||
headers: {
|
||||
1: { sorter: false },
|
||||
3: { sorter: 'programme' },
|
||||
@@ -41,24 +39,28 @@ $(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>
|
||||
}
|
||||
|
||||
foreach event $events {
|
||||
proc eventheader {} {
|
||||
puts {
|
||||
<table 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>
|
||||
}
|
||||
}
|
||||
|
||||
proc eventrow {event} {
|
||||
set name [$event name]
|
||||
|
||||
altrow
|
||||
@@ -169,8 +171,31 @@ foreach event $events {
|
||||
}
|
||||
puts "</tr>"
|
||||
}
|
||||
puts "</tbody></table>"
|
||||
puts "<font class=footnote>Click on the CRID to view episodes.</font>"
|
||||
|
||||
proc eventfooter {} {
|
||||
puts "</tbody></table>"
|
||||
}
|
||||
|
||||
set events [rsv list pending]
|
||||
if {[llength $events] > 0} {
|
||||
puts "<h2>Pending Scheduled Events</h2>"
|
||||
eventheader
|
||||
foreach event $events {eventrow $event}
|
||||
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>
|
||||
|
||||
@@ -291,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" }
|
||||
}
|
||||
|
||||
@@ -6,7 +6,16 @@ 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 {delete from pending}
|
||||
$tdb close
|
||||
}
|
||||
$rsvdb query {attach database '/var/lib/humaxtv/rsvp.db' as pending}
|
||||
|
||||
class rsv {
|
||||
ulslot -1
|
||||
@@ -40,6 +49,10 @@ class rsv {
|
||||
sort 0
|
||||
}
|
||||
|
||||
rsv method clear_ulslot {} {
|
||||
set ulslot -1
|
||||
}
|
||||
|
||||
rsv method name {} {
|
||||
set name [string range $szevtname 1 end]
|
||||
if {[string first "i7" $name] == 0} {
|
||||
@@ -81,25 +94,27 @@ rsv method fix_hsvc {} {
|
||||
return $hsvc
|
||||
}
|
||||
|
||||
rsv method insert {} {
|
||||
rsv method insert {{table pending}} {
|
||||
global rsvdb
|
||||
|
||||
# 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]]
|
||||
@@ -117,7 +132,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 +141,16 @@ 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
|
||||
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 {
|
||||
@@ -146,31 +161,32 @@ 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]]
|
||||
@@ -182,3 +198,13 @@ proc {rsv cleanup} {} {
|
||||
catch {$::rsvdb close}
|
||||
}
|
||||
|
||||
proc {rsv commit} {} {
|
||||
$::rsvdb query {begin transaction}
|
||||
foreach rec [rsv list pending] {
|
||||
$rec clear_ulslot
|
||||
$rec insert TBL_RESERVATION
|
||||
}
|
||||
$::rsvdb query {delete from pending}
|
||||
$::rsvdb query {commit transaction}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user