Compare commits

...

44 Commits

Author SHA1 Message Date
hummypkg
c3a41bed59 update to 0.7.4
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@441 2a923420-c742-0410-a762-8d5b09965624
2011-10-04 20:06:56 +00:00
hummypkg
903a4453bb more work on dedup
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@440 2a923420-c742-0410-a762-8d5b09965624
2011-10-04 20:02:59 +00:00
hummypkg
761def1a24 checkpoint
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@439 2a923420-c742-0410-a762-8d5b09965624
2011-10-03 22:47:44 +00:00
hummypkg
e832d05b17 update 0.7.3
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@437 2a923420-c742-0410-a762-8d5b09965624
2011-10-03 09:39:17 +00:00
hummypkg
3b8720c6d4 EPG update
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@436 2a923420-c742-0410-a762-8d5b09965624
2011-10-03 09:37:24 +00:00
hummypkg
2fb26975e2 new db based EPG
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@433 2a923420-c742-0410-a762-8d5b09965624
2011-09-29 23:22:02 +00:00
hummypkg
93f1b67ba1 add epg parser
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@432 2a923420-c742-0410-a762-8d5b09965624
2011-09-29 22:58:13 +00:00
hummypkg
6daa4e28f5 add alternate epg implementations
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@427 2a923420-c742-0410-a762-8d5b09965624
2011-09-27 20:26:36 +00:00
hummypkg
9a72e40c03 improve system busy detection
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@424 2a923420-c742-0410-a762-8d5b09965624
2011-09-26 20:31:17 +00:00
hummypkg
9b2f138fd9 update
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@420 2a923420-c742-0410-a762-8d5b09965624
2011-09-25 18:25:09 +00:00
hummypkg
22db1fbbd6 add icons, fix Mux name
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@418 2a923420-c742-0410-a762-8d5b09965624
2011-09-22 22:29:43 +00:00
hummypkg
a9f4bd4f0b remove iajax code for now
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@417 2a923420-c742-0410-a762-8d5b09965624
2011-09-22 20:27:41 +00:00
hummypkg
31688eaa1c add doctype to headers, fix iajax problem
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@416 2a923420-c742-0410-a762-8d5b09965624
2011-09-22 20:15:26 +00:00
hummypkg
926a49737a add new channel icons, detect MUX
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@413 2a923420-c742-0410-a762-8d5b09965624
2011-09-21 20:21:13 +00:00
hummypkg
fbb64a2e9f fix padding
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@409 2a923420-c742-0410-a762-8d5b09965624
2011-09-19 17:11:18 +00:00
hummypkg
ff322fdc39 update channel icons, support padding
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@407 2a923420-c742-0410-a762-8d5b09965624
2011-09-18 22:19:54 +00:00
hummypkg
d29ed50f7f allow scheduling reminders; flag for reboot after event cancel
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@402 2a923420-c742-0410-a762-8d5b09965624
2011-09-15 23:08:15 +00:00
hummypkg
7113208940 add totop
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@400 2a923420-c742-0410-a762-8d5b09965624
2011-09-14 22:38:22 +00:00
hummypkg
0b566bca72 add mod version to front page
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@397 2a923420-c742-0410-a762-8d5b09965624
2011-09-14 19:59:56 +00:00
hummypkg
f235b05026 fix insert bugs
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@396 2a923420-c742-0410-a762-8d5b09965624
2011-09-14 16:58:11 +00:00
hummypkg
af87e1a66e update
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@390 2a923420-c742-0410-a762-8d5b09965624
2011-09-13 19:16:02 +00:00
hummypkg
ed225ca751 fix split events, check for duplicates
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@385 2a923420-c742-0410-a762-8d5b09965624
2011-09-11 21:59:08 +00:00
hummypkg
cfb12b7da6 move scheduling code to class, support split events
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@384 2a923420-c742-0410-a762-8d5b09965624
2011-09-11 21:23:42 +00:00
hummypkg
1d44efdcdc add channel info page
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@381 2a923420-c742-0410-a762-8d5b09965624
2011-09-09 19:38:37 +00:00
hummypkg
0eb305c32c fix bug in restore
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@372 2a923420-c742-0410-a762-8d5b09965624
2011-09-07 18:07:06 +00:00
hummypkg
6797ee4416 minor tweaks and fix system diskspace
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@364 2a923420-c742-0410-a762-8d5b09965624
2011-09-05 22:23:29 +00:00
hummypkg
510c6c7407 fix reboot busy check
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@354 2a923420-c742-0410-a762-8d5b09965624
2011-09-04 00:18:07 +00:00
hummypkg
f6bf03691d use findhsvc class
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@352 2a923420-c742-0410-a762-8d5b09965624
2011-09-03 23:26:54 +00:00
hummypkg
b378ec1b9c create system class and use it. Expand rsv fetch to include ersvtype
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@344 2a923420-c742-0410-a762-8d5b09965624
2011-09-02 19:50:10 +00:00
hummypkg
df85584352 fix sql queries to use escaped parameters
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@339 2a923420-c742-0410-a762-8d5b09965624
2011-09-01 22:20:53 +00:00
hummypkg
b7310e9765 fix rsvp table and allow scheduling
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@331 2a923420-c742-0410-a762-8d5b09965624
2011-08-31 21:55:39 +00:00
hummypkg
3f02bf8365 increment version to 0.6.6
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@329 2a923420-c742-0410-a762-8d5b09965624
2011-08-31 21:48:15 +00:00
hummypkg
1d6917a782 changes for rs
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@328 2a923420-c742-0410-a762-8d5b09965624
2011-08-31 21:47:43 +00:00
hummypkg
0852c70891 improve scheduling screen
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@311 2a923420-c742-0410-a762-8d5b09965624
2011-08-29 22:34:26 +00:00
hummypkg
981c8312cd version
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@306 2a923420-c742-0410-a762-8d5b09965624
2011-08-25 20:30:48 +00:00
hummypkg
3559a430ab add epg -day and rsv commit when necessary
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@305 2a923420-c742-0410-a762-8d5b09965624
2011-08-25 20:30:13 +00:00
hummypkg
945c6d1b4b use pending table for scheduling
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@296 2a923420-c742-0410-a762-8d5b09965624
2011-08-22 20:55:06 +00:00
hummypkg
81c3ef4f73 support same directory symlinks
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@294 2a923420-c742-0410-a762-8d5b09965624
2011-08-20 21:30:43 +00:00
hummypkg
2c61281b09 skip non-directory links
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@292 2a923420-c742-0410-a762-8d5b09965624
2011-08-20 20:50:40 +00:00
hummypkg
d5b27acd46 fix minor file browser bugs
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@291 2a923420-c742-0410-a762-8d5b09965624
2011-08-20 20:45:23 +00:00
hummypkg
767021557f download decrypted fiels
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@285 2a923420-c742-0410-a762-8d5b09965624
2011-08-13 00:18:42 +00:00
hummypkg
4f900f47b4 download decrypted versions of files
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@284 2a923420-c742-0410-a762-8d5b09965624
2011-08-13 00:18:12 +00:00
hummypkg
8383651367 minor bugfixes, support ffmpeg 0.8
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@282 2a923420-c742-0410-a762-8d5b09965624
2011-07-19 23:10:32 +00:00
hummypkg
d764969b8f update to 0.6.3, show alternate showings
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@280 2a923420-c742-0410-a762-8d5b09965624
2011-07-18 19:26:58 +00:00
77 changed files with 2334 additions and 415 deletions

View File

@@ -1,11 +1,11 @@
Package: webif
Priority: optional
Section: web
Version: 0.6.2
Version: 0.7.4
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.5),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.

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

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,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]"

View File

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

View File

@@ -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 "}"

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

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

View File

@@ -8,6 +8,14 @@ require altrow
puts "Content-Type: text/html"
puts ""
set databases {
/var/lib/humaxtv/rsvp.db
/var/lib/humaxtv/rsv.db
/var/lib/humaxtv/setup.db
/var/lib/humaxtv/channel.db
/mnt/hd2/dms_cds.db
}
header
cgi_input
@@ -62,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

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

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

View File

@@ -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>&nbsp;&nbsp;&nbsp;&nbsp;"
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>
"
}

View File

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

View File

@@ -9,6 +9,8 @@ puts ""
header
require totop
puts "<script type=text/javascript src=/js/jquery.highlight.js></script>"
cgi_input
@@ -95,9 +97,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>

View File

@@ -9,6 +9,8 @@ puts ""
header
require totop
[spinner new {
text "Loading EPG Data..."
size "1.2em"
@@ -20,10 +22,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 +54,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>"

View File

@@ -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

View File

@@ -0,0 +1,28 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
require rsv.class system.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
system restartpending

View 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>"

View File

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

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

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

View File

@@ -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;
}

View File

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

View File

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

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

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

View File

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

View File

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

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

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

View File

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

View File

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

View 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'>&nbsp;</div>");
$("<span class='text'>&nbsp;</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);

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

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

View File

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

View File

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

View File

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

View File

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

View File

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

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

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

View File

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

View File

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

View File

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

View File

@@ -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>&nbsp;</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>&nbsp;</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>&nbsp;<br><br></td><td>&nbsp;</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>&nbsp;</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

View File

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

View File

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

View File

@@ -1,63 +1,72 @@
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');
$(":button:contains('Reminder')").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) }},
{"Set Reminder": function() { doschedule(3) }},
$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>
}

View File

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

View File

@@ -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
View 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
}
}

View File

@@ -2,11 +2,24 @@ source /mod/var/mongoose/lib/setup
if {![exists -proc class ]} { package require oo }
if {![exists -proc sqlite3.open ]} { package require sqlite3 }
if {![exists -proc settings ]} { require settings.class }
require settings.class system.class
set rsvdb [sqlite3.open /var/lib/humaxtv/rsv.db]
$rsvdb query {attach database '/var/lib/humaxtv/channel.db' as channel}
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 ---" }
}
}
@@ -58,20 +76,66 @@ rsv method name {} {
return $name
}
rsv method padded {} {
if {$ulPreOffset > 0 || $ulPostOffset > 0} {
return 1
} else {
return 0
}
}
rsv method channel_name {} {
return [string range $szSvcName 1 end]
}
rsv method icon {} {
set rsvicon ""
switch $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 +145,41 @@ rsv method fix_hsvc {} {
return $hsvc
}
rsv method insert {} {
rsv method insert {{table pending} {force 0}} {
global rsvdb
# Duplicate check - all tables
if {!$force && $szCRID ne "" && $action == 0} {
foreach tab {pending TBL_RESERVATION} {
set rec [$rsvdb query "
select ulslot from $tab
where szCRID = '%s'
" $szCRID]
if {[llength $rec] > 0} {
throw 20 "Duplicate reservation."
return
}
}
}
# Find a spare slot.
if {$ulslot < 0} {
set 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 +189,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 +202,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 +211,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 +233,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 +305,73 @@ 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 1
}
}
$::rsvdb query {delete from pending}
$::rsvdb query {commit transaction}
}
proc {rsv construct} {event type} {
global ccrid
$event get_channel_info
set args {}
set args(ersvtype) 3
set args(hsvc) [$event get channel_hsvc]
set args(nsttime) [$event get start]
set args(nduration) [$event get duration]
set args(usevtid) [$event get event_id]
set args(szevtname) "\025[$event get name]"
set args(eReady) 30
lassign [system padding] args(ulPreOffset) args(ulPostOffset)
set ccrid [$event get channel_crid]
if {$type == 1} {
# Event
set args(ucCRIDType) 49
set args(ucRecKind) 1
set ecrid [$event get event_crid]
if {$ecrid ne ""} {
set args(szCRID) "$ccrid$ecrid"
set args(szEventToRecord) "1$args(szCRID)|"
# Handle split events
if {[string match {*#?} $args(szCRID)]} {
set args(ucRecKind) 2
set args(szCRID) [
string range $args(szCRID) 0 end-2]
# TODO - check to see how many parts there
# are...
append args(szEventToRecord) \
$args(szEventToRecord)
}
}
} elseif {$type == 3} {
# Reminder
set args(ersvtype) 2
set args(szsttime) [clock format $args(nsttime) \
-format {%Y%m%d%H%M%S}]
} else {
# Series
set args(ucCRIDType) 50
set args(ucRecKind) 4
set args(szCRID) "$ccrid[$event get series_crid]"
set args(szFPBRecPath) "$args(szevtname)"
set progs [lmap i [epg fetch dump -scrid [$event get series_crid]] {
if {[set ecrid [$i get event_crid]] eq ""} { continue }
list "1$::ccrid$ecrid"
}]
set args(szEventToRecord) "[join $progs "|"]|"
}
return [rsv new $args]
}

View File

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

View File

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

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

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