Compare commits

..

25 Commits

Author SHA1 Message Date
hummypkg
3dbc3cbf82 add genre rename
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1316 2a923420-c742-0410-a762-8d5b09965624
2013-01-06 23:50:39 +00:00
hummypkg
41047e8668 add grid EPG hours option
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1314 2a923420-c742-0410-a762-8d5b09965624
2013-01-05 22:27:00 +00:00
hummypkg
d6df19dd32 add build number to main screen
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1299 2a923420-c742-0410-a762-8d5b09965624
2013-01-03 22:20:57 +00:00
hummypkg
79bff00465 require latest tmenu, busybox, new dedup prefix, lower dedup reserve threshold
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1292 2a923420-c742-0410-a762-8d5b09965624
2013-01-02 22:22:11 +00:00
hummypkg
4ce9701792 show 20 minutes upcoming, tweak dedup reserve
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1270 2a923420-c742-0410-a762-8d5b09965624
2013-01-01 20:58:42 +00:00
hummypkg
6ff5b7a8e3 rejig dedup, prepare for RMA in 2.15
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1261 2a923420-c742-0410-a762-8d5b09965624
2012-12-31 22:41:09 +00:00
hummypkg
25523058f0 rejig dedup, prepare for RMA in 2.15
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1260 2a923420-c742-0410-a762-8d5b09965624
2012-12-31 22:39:54 +00:00
hummypkg
d661c8016e clear log function
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1256 2a923420-c742-0410-a762-8d5b09965624
2012-12-01 22:00:03 +00:00
hummypkg
ebcd6cdbf7 tweak settings ON/OFF to YES/NO
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1255 2a923420-c742-0410-a762-8d5b09965624
2012-11-30 21:17:16 +00:00
hummypkg
4fe5bd1bff update
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1253 2a923420-c742-0410-a762-8d5b09965624
2012-11-29 22:28:08 +00:00
hummypkg
d5679ead84 disc -> disk
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1252 2a923420-c742-0410-a762-8d5b09965624
2012-11-29 21:33:58 +00:00
hummypkg
e666711eeb various changes
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1250 2a923420-c742-0410-a762-8d5b09965624
2012-11-25 00:22:18 +00:00
hummypkg
775add8c04 improve media rename, require HMT 1.1.7
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1231 2a923420-c742-0410-a762-8d5b09965624
2012-11-18 12:07:53 +00:00
hummypkg
d4dc56b816 minor updates for new menu system
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1221 2a923420-c742-0410-a762-8d5b09965624
2012-11-16 21:16:03 +00:00
hummypkg
e720740507 0.10.0-3
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1214 2a923420-c742-0410-a762-8d5b09965624
2012-11-12 22:42:33 +00:00
hummypkg
3c327ff80d minor updates
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1212 2a923420-c742-0410-a762-8d5b09965624
2012-11-09 21:56:36 +00:00
hummypkg
d05632e8d3 various updates
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1210 2a923420-c742-0410-a762-8d5b09965624
2012-11-06 22:58:17 +00:00
hummypkg
c208e186c3 rma mode and stream size monitor
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1202 2a923420-c742-0410-a762-8d5b09965624
2012-11-05 22:36:04 +00:00
hummypkg
328ca16b5c checkpoint - mobile version working, fixed auto bug
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1201 2a923420-c742-0410-a762-8d5b09965624
2012-11-05 21:57:29 +00:00
hummypkg
e15b82fe2d checkpoint pkg
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1195 2a923420-c742-0410-a762-8d5b09965624
2012-10-31 23:50:27 +00:00
hummypkg
0a2c7966b5 checkpoint
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1182 2a923420-c742-0410-a762-8d5b09965624
2012-10-30 18:58:54 +00:00
hummypkg
57b78c4c0d new disk diagnostics. Progress on mobile
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1173 2a923420-c742-0410-a762-8d5b09965624
2012-10-25 23:31:09 +00:00
hummypkg
eb0adb8f29 checkpoint
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1172 2a923420-c742-0410-a762-8d5b09965624
2012-10-23 22:51:54 +00:00
hummypkg
6e06f3875a fix db.jim
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1170 2a923420-c742-0410-a762-8d5b09965624
2012-10-18 19:37:39 +00:00
hummypkg
b691be415a quick edit, cli status, db.jim
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1164 2a923420-c742-0410-a762-8d5b09965624
2012-10-15 21:32:25 +00:00
75 changed files with 2656 additions and 254 deletions

View File

@@ -1,9 +1,9 @@
Package: webif
Priority: optional
Section: web
Version: 0.9.14
Version: 0.10.2
Architecture: mipsel
Maintainer: af123@hummypkg.org.uk
Depends: webif-channelicons(>=1.0.3),mongoose(>=3.0-7),jim(>=0.73-1),jim-oo,jim-sqlite3(>=0.73),jim-cgi(>=0.5),service-control(>=1.2),busybox(>=1.19.3-1),lsof,epg(>=1.0.9),hmt(>=1.1.6),ssmtp,anacron,trm,openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2),stripts(>=1.1.2)
Depends: webif-channelicons(>=1.0.3),mongoose(>=3.0-7),jim(>=0.73-1),jim-oo,jim-sqlite3(>=0.73-1),jim-cgi(>=0.5),jim-binary,service-control(>=1.2),busybox(>=1.20.2-1),lsof,epg(>=1.0.9-1),hmt(>=1.1.8),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2),stripts(>=1.1.2),smartmontools,tmenu(>=1.04)
Suggests: ffmpeg
Description: An evolving web interface for the Humax.

1
bin/status Symbolic link
View File

@@ -0,0 +1 @@
../webif/cgi-bin/status.jim

View File

@@ -2,7 +2,7 @@
package require cgi
source /mod/webif/lib/setup
require ts.class pretty_size system.class settings.class escape
require ts.class pretty_size system.class settings.class escape browse.class
puts "Content-Type: text/html"
puts ""
@@ -42,8 +42,6 @@ proc icon {img {hover ""} {extra ""} {class "va"}} {
}
proc directory {file bfile tbfile} {
global flatten
puts "<div class=va>"
set img "/images/711_1_09_Media_Folder.png"
if {$bfile eq $::dustbin} { set img "/img/Dustbin_Folder.png" }
@@ -55,38 +53,14 @@ proc directory {file bfile tbfile} {
puts "$bfile</a><span class=filesize id=\"$tbfile\">
</span>"
set noflat 0
if $flatten {
if {[string match {\[*\]} [file tail $file]]} { set noflat 1 }
if {[file exists "$file/.noflatten"]} { set noflat 1 }
if $noflat { icon "/img/flat-tyre.png" "No-flatten" }
}
lassign [{dir iconset} $file] icons attrs
set autoshrink 0
if {[file exists "$file/.autoshrink"]} {
set autoshrink 1
icon "/img/compress.png" "Auto-shrink"
}
set autodedup 0
if {[file exists "$file/.autodedup"]} {
set autodedup 1
icon "/img/dedup.png" "Auto-dedup"
}
set autodecrypt 0
if {[file exists "$file/.autodecrypt"]} {
set autodecrypt 1
icon "/img/decrypt.png" "Auto-decrypt"
}
puts [join $icons ""]
puts -nonewline "
<a href=#>
<img class=\"dopt va\" border=0 width=45 "
puts -nonewline "autoshrink=$autoshrink "
puts -nonewline "autodedup=$autodedup "
puts -nonewline "autodecrypt=$autodecrypt "
if $flatten { puts -nonewline "noflat=$noflat " }
puts -nonewline [join $attrs " "]
puts "
src=/images/181_1_00_Help5_OPT_Plus.png>
</a>
@@ -106,10 +80,10 @@ proc entry {file} {{i 0}} {
}
if [file isdirectory "$file"] {
directory $file $bfile $tbfile
continue
return
}
set ext [file extension $file]
if {$ext in $::ignore || $ext ni $::include} { continue }
if {$ext in $::ignore || $ext ni $::include} { return }
file stat $file st
set rsz $st(size)
@@ -174,6 +148,21 @@ proc entry {file} {{i 0}} {
set bx 0
set dlna 0
if {$type eq "ts"} {
# Genre
switch [$ts get genre] {
16 { set img "Movie" }
32 { set img "News" }
48 { set img "Special" }
64 { set img "Sports" }
80 { set img "Children" }
96 { set img "Education" }
160 { set img "Leisure" }
240 { set img "Show" }
default { set img "Unclassified" }
}
#icon "/images/173_1_00_G1_$img.png"
icon "/images/173_3_00_G3_$img.png" $img
# HD / SD
if {[$ts get definition] eq "HD"} {
set def HD
@@ -385,6 +374,7 @@ if {[file exists /mnt/hd3/Streamer_down_file]} {
puts {
<button id=save_stream file=/mnt/hd3/Streamer_down_file>
Save last streamed content (e.g. iPlayer/YouTube)
<div id=streamstatus></div>
</button>
}
}

View File

@@ -67,8 +67,7 @@ puts {
<div id=renameform title="Rename media file" style="display: none">
<form id=renameform_form>
<input type=hidden name="renameorig" id="renameorig" value="">
<input type=hidden name="titleorig" id="titleorig" value="">
<input type=hidden name="renamefile" id="renamefile" value="">
<table border=0>
<tr>
<th>
@@ -82,21 +81,68 @@ puts {
class="text ui-widget-content ui-corner-all">
</td>
</tr>
<tr style="display: none" class=tstype>
<th>
<label for="renametitle" style="padding-top: 0.5em">
<label for="rename_title" style="padding-top: 0.5em">
<b>New Medialist Title</b>
</label>
</th>
<td>
<input type=text name="renametitle" id="renametitle"
<input type=text name="rename_title" id="rename_title"
value="" size=70 maxlength=48
class="text ui-widget-content ui-corner-all">
</td>
</tr>
<tr style="display: none" class=tstype>
<td colspan=2 id=synopsis style="font-style: italic"></td>
<th>
<label for="rename_synopsis" style="padding-top: 0.5em">
<b>New Synopsis</b>
</label>
</th>
<td>
<textarea name="rename_synopsis" id="rename_synopsis"
value="" cols=70 rows=4
class="text ui-widget-content ui-corner-all"></textarea>
</td>
</tr>
<tr style="display: none" class=tstype>
<th>
<label for="rename_guidance" style="padding-top: 0.5em">
<b>New Guidance Text</b>
</label>
</th>
<td>
<input type=text name="rename_guidance" id="rename_guidance"
value="" size=70 maxlength=74
class="text ui-widget-content ui-corner-all">
</td>
</tr>
<tr style="display: none" class=tstype>
<th>
<label for="rename_genre" style="padding-top: 0.5em">
<b>New Genre</b>
</label>
</th>
<td>
<select name="rename_genre" id="rename_genre"
class="text ui-widget-content ui-corner-all">
<option value=0>Unclassified
<option value=16>Film
<option value=32>News &amp; Factual
<option value=48>Entertainment
<option value=64>Sport
<option value=80>Children
<option value=96>Education
<option value=160>Lifestyle
<option value=240>Drama
</select>
</td>
</tr>
</table>
</form>
</div>

View File

@@ -74,19 +74,17 @@ $('#paste').button()
function epginfo_callback(data, status, xhr)
{
var width = 85;
//console.log(status);
//console.dir(data);
if (status != 'success')
return;
//console.log(status);
//console.dir(data);
$('#rename_title').val(data.title);
$('#rename_synopsis').val(data.synopsis);
$('#rename_guidance').val(data.guidance);
$('#rename_genre').val(data.genre);
$('#titleorig').val(data.title);
$('#renametitle').val(data.title);
if (data.synopsis.length > width)
data.synopsis = data.synopsis.substring(0, width) + '...';
$('#synopsis').html(data.synopsis);
$('tr.tstype').show('slow');
}
@@ -95,10 +93,14 @@ function insert_folder_size(folder, size)
folder = folder.replace(/ /g, '');
folder = folder.replace(/([ #;&,.+*~\':"!^$[\]()=>|\/@])/g, '\\$1');
//console.log("Folder: (%s) = (%s)", folder, size);
if (folder == "")
$('#dirsize').text(' (' + size + 'iB)');
if (size.search(/\d$/) == -1)
size += 'iB';
else
$('#' + folder).text(' (' + size + 'iB)');
size += ' bytes';
if (folder == "")
$('#dirsize').text(' (' + size + ')');
else
$('#' + folder).text(' (' + size + ')');
}
function folder_size_callback(data, status, xhr)
@@ -179,7 +181,7 @@ function new_callback(file, type, id)
function rename_submit()
{
var s = $('#renameform_form').serialize();
$.get('/cgi-bin/browse/rename.jim?' + s,
$.post('/cgi-bin/browse/rename.jim', s,
function() { window.location.reload(true); });
}
@@ -390,11 +392,11 @@ var menuclick = function(action, el, pos)
case 'rename':
$('#rename').val(decodeURIComponent(bfile));
$('#renameorig').val(decodeURIComponent(file));
$('#renamefile').val(decodeURIComponent(file));
$('#titleorig').val('');
$('#renametitle').val('');
$('#synopsis').val('');
$('#rename_title').val('');
$('#rename_synopsis').val('');
$('#rename_guidance').val('');
$('tr.tstype').css('display', 'none');
if (type == 'ts')
@@ -408,7 +410,8 @@ var menuclick = function(action, el, pos)
case 'download':
window.location.href = '/cgi-bin/browse/download.jim?file=' +
file;
file + '&base=' +
encodeURIComponent(document.URL.match(/:\/\/(.[^/]+)/)[1]);
break;
case 'crop':
@@ -817,5 +820,24 @@ var dmenuclick = function(action, el, pos)
});
var streamsize = 0;
function checkstream()
{
$.get('/cgi-bin/streamsize.jim', function(size) {
//console.log('Stream size: %o', size);
var mb = size / (1024 * 1024);
mb = mb|0;
if (streamsize && size > streamsize)
$('#streamstatus').text(mb + ' MiB (growing)');
else
$('#streamstatus').text(mb + ' MiB');
streamsize = size;
});
}
if ($('#streamstatus').length)
setInterval(checkstream, 3000);
});

View File

@@ -110,9 +110,11 @@ switch $action {
}
} else {
if {$mode eq "cut"} {
catch {file rename $path "$dir/[file tail $f]"}
catch {file rename $path \
"$dir/[file tail $path]"}
} else {
catch {file copy $path "$dir/[file tail $f]"}
catch {file copy $path \
"$dir/[file tail $path]"}
}
}
}

View File

@@ -11,6 +11,7 @@ cgi_input
#cgi_dump
set file [cgi_get file]
set urlbase [cgi_get base ""]
# Default to just downloading the raw file.
set url $file
@@ -22,7 +23,7 @@ if {[string match {*.ts} $file]} {
# If it's encrypted on disk and the DLNA option is available,
# then use the server to perform decryption on the fly.
if {[$ts flag "ODEncrypted"] > 0} {
set dlna [$ts dlnaloc]
set dlna [$ts dlnaloc $urlbase]
if {[llength $dlna]} { lassign $dlna url mime }
#puts "DLNA: $dlna"

View File

@@ -17,6 +17,8 @@ set ts [ts fetch $file]
puts "{"
puts "\"title\" : \"[$ts get title]\","
puts "\"synopsis\" : \"[$ts get synopsis]\""
puts "\"synopsis\" : \"[$ts get synopsis]\","
puts "\"guidance\" : \"[$ts get guidance]\","
puts "\"genre\" : [$ts get genre]"
puts "}"

View File

@@ -10,43 +10,34 @@ puts ""
cgi_input
#cgi_dump
#renameorig
#titleorig
#rename
#renametitle
set file [cgi_get renamefile "-"]
if {$file eq "-"} exit
#set _cgi(renameorig) "/media/My Video/The Walking Dead/The Walking Dead_20110521_2201.ts"
#set _cgi(rename) "Last Episode"
if {![dict exists $_cgi renameorig]} { exit }
set file [dict get $_cgi renameorig]
set newfile [dict get $_cgi rename]
if {[string length [string trim $newfile]] == 0 || $file eq $newfile} {
set newfile ""
}
set newfile [string trim [cgi_get rename]]
set dir [file dirname $file]
if {[file isdirectory $file]} {
#puts "Directory."
if {$newfile ne ""} {
set dir [file dirname $file]
set newfile "${dir}/${newfile}"
file rename $file $newfile
}
} elseif {[set ts [ts fetch $file]] != 0} {
#puts "TS file."
catch {
set title [dict get $_cgi renametitle]
set titleorig [dict get $_cgi titleorig]
if {[string length [string trim $title]] > 0 &&
$title ne $titleorig} {
$ts settitle $title
foreach attr {title synopsis guidance genre} {
if {[catch {
set new [string trim [cgi_get "rename_$attr"]]
set old [$ts get $attr]
if {[string length $new] > 0 && $new ne $old} {
$ts set$attr $new
}
} msg]} {
puts "$attr: $msg"
}
}
if {$newfile ne ""} { ts renamegroup $file $newfile }
if {"$dir/$newfile.ts" ne "$file"} { ts renamegroup $file $newfile }
} else {
#puts "Normal file."
if {$newfile ne ""} { ts renamegroup $file $newfile }

View File

@@ -1,7 +1,18 @@
#!/bin/sh
[ -n "$QUERY_STRING" ] && rma="${QUERY_STRING##*=}" || rma=0
echo "Content-Type: text/plain"
echo
touch /var/lib/humaxtv/mod/_RESET_CUSTOM_FIRMWARE_ENVIRONMENT
if [ "$rma" = 1 ]; then
modver="`cat /etc/modversion`"
if [ "$modver" -ge 215 ]; then
touch /var/lib/humaxtv_backup/.rma
else
touch /var/lib/humaxtv/.rma
fi
else
touch /var/lib/humaxtv/mod/_RESET_CUSTOM_FIRMWARE_ENVIRONMENT
fi

23
var/mongoose/cgi-bin/epg/db.jim Executable file
View File

@@ -0,0 +1,23 @@
#!/bin/sh
PATH=$PATH:/mod/bin export PATH
echo "Content-Type: text/plain"
echo ""
[ -n "$QUERY_STRING" ] && data="${QUERY_STRING##*=}" || data=epg
case $data in
channels)
sqlite3 -header -batch -separator ' ' \
/var/lib/humaxtv/channel.db '
select * from TBL_SVC;
'
;;
*) /mod/bin/epg -p dump ;;
esac
exit 0

View File

@@ -60,7 +60,7 @@ if {$ct > 0 } {
} elseif {$scrid ne ""} {
set records [epg fetch dump -scrid $scrid]
} elseif {$searchterm ne ""} {
set records [epg fetch $cmd -extra $searchterm]
set records [epg dbfetch $cmd -term $searchterm]
} else {
set records {}
}

View File

@@ -53,7 +53,7 @@ puts {
set i 0
foreach record $records {
altrow
$record get_channel_info
#$record get_channel_info
set ended [$record ended]
if {[$record showing]} {
puts "<td><img src=/images/111_1_00_Cursor_2R_Arrow.png></td>"

View File

@@ -30,6 +30,9 @@ if {$cmd eq "update" || $cmd eq "upgrade"} {
chunk "Updating package meta information\r\n"
pkg fetchmeta
chunk "Done.\r\n"
chunk "Updating diagnostic meta information\r\n"
pkg fetchdiagmeta
chunk "Done.\r\n"
}
end_chunked

View File

@@ -2,8 +2,7 @@
package require cgi
source /mod/webif/lib/setup
require settings.class
require plugin
require settings.class plugin system.class
puts "Content-Type: text/html"
puts ""
@@ -22,6 +21,17 @@ if {[cgi_get act] eq "https"} {
exit
}
if {[cgi_get act] eq "xtelnet"} {
if {[cgi_get val off] eq "off"} {
file delete /mod/boot/xtelnet
puts "Telnet server expert mode will be disabled after next reboot."
} else {
exec /mod/bin/busybox/touch /mod/boot/xtelnet
puts "Telnet server expert mode will be enabled after next reboot."
}
exit
}
set settings [settings new]
set hostname [$settings hostname]
@@ -30,6 +40,9 @@ set channel_group [$settings channel_group]
set epg_style [$settings epg_style]
set pkgdev [$settings pkgdev]
set notoolbar [$settings notoolbar]
set nomobile [$settings nomobile]
set xepghours [$settings xepghours]
if {$xepghours == 0} { set xepghours 4 }
# Handle updates
@@ -64,9 +77,11 @@ 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_int_update xepghours $xepghours "Grid EPG Hours"
handle_str_update epg_style $epg_style "EPG Type"
handle_int_update pkgdev $pkgdev "Development Package Display"
handle_int_update notoolbar $notoolbar "Disable toolbar"
handle_int_update nomobile $nomobile "Disable mobile link"
set acluser [cgi_get acluser "-"]
set aclpass [cgi_get aclpass "-"]
@@ -153,6 +168,17 @@ puts ">
</tr>
"
puts -nonewline "
<tr>
<th class=key>Mobile link on main page?</th>
<td><input id=mobile_toggle name=mobile type=checkbox value=yes"
if {$nomobile == 0} { puts -nonewline " checked" }
puts ">
<div id=mobile_output></div>
</td>
</tr>
"
puts "
<tr>
<form class=auto id=epg_style method=get action=$env(REQUEST_URI)>
@@ -207,6 +233,33 @@ puts "
</tr>
"
puts "
<tr>
<form class=auto id=xepghours method=get action=$env(REQUEST_URI)>
<th class=key>Grid-style EPG Hours</th>
<td><select id=xepghours name=xepghours
class=\"text ui-widget-content ui-corner-all\">
"
foreach xehopt {2 3 4 5 6} {
puts -nonewline "<option value=$xehopt"
if {$xehopt == $xepghours} {
puts -nonewline " selected"
}
puts ">$xehopt hours"
}
puts "
</select>
<small>
<input name=xepghours value=\"set\" type=submit>
</small>
<div id=xepghours_output></div>
</td>
</form>
</tr>
"
puts "
</table>
</fieldset>
@@ -341,6 +394,24 @@ if {$pkgdev} { puts -nonewline " checked" }
puts ">
</td>
</tr>
"
if {[system modversion 1] >= 214} {
puts -nonewline "
<tr>
<th class=key>Expert mode telnet server?</th>
<td><input id=xtelnet_toggle name=xtelnet type=checkbox value=yes"
if {[file exists /mod/boot/xtelnet]} { puts -nonewline " checked" }
puts ">
<div id=xtelnet_output></div>
</td>
</tr>
"
}
puts "
</table>
<div id=pkgdev_output></div>
</fieldset>

View File

@@ -21,7 +21,11 @@
$(document).ready(function () {
$(":submit").button();
$(":checkbox").iphoneStyle();
//$('[type="checkbox"] :not(.yesno)').iphoneStyle();
$('[type="checkbox"]').iphoneStyle({
checkedLabel: 'YES',
uncheckedLabel: 'NO'
});
$('form.auto').each(function(i, el) {
var id = $(this).attr('id');
var output = '#' + id + '_output';
@@ -76,6 +80,26 @@ $(document).ready(function () {
});
});
$('#xtelnet_toggle').change(function() {
var arg = 'off';
if ($(this).attr('checked'))
arg = 'on';
$(this).disable();
$('#xtelnet_output')
.empty()
.html('<img src=/img/loading.gif>Please Wait...')
.show('slow')
.load('/cgi-bin/settings.jim?act=xtelnet&val=' + arg,
function() {
$('#xtelnet_toggle').enable();
$('#xtelnet_output')
.css('font-style', 'italic')
.delay(2000).fadeOut('slow');
});
});
$('#toolbar_toggle').change(function() {
var arg = '1';
if ($(this).attr('checked'))
@@ -94,5 +118,24 @@ $(document).ready(function () {
.delay(2000).fadeOut('slow');
});
});
$('#mobile_toggle').change(function() {
var arg = '1';
if ($(this).attr('checked'))
arg = '0';
$(this).disable();
$('#mobile_output')
.empty()
.show('slow')
.load('/cgi-bin/settings.jim?nomobile=' + arg,
function() {
$('#mobile_toggle').enable();
$('#mobile_output')
.css('font-style', 'italic')
.delay(2000).fadeOut('slow');
});
});
});

View File

@@ -1,12 +1,27 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
require system.class findhsvc epg.class
require system.class findhsvc epg.class rsv.class
puts "Content-Type: text/html"
puts "Pragma: no-cache"
puts "Expires: Thu, 01 Jan 1970 00:00:00 GMT"
puts ""
set runmode cli
if {[string match {*jim} $argv0]} { set runmode cgi }
set schedtime 1200
case $runmode {
cgi {
cgi_input
set type [cgi_get type "full"]
puts "Content-Type: text/html"
puts "Pragma: no-cache"
puts "Expires: Thu, 01 Jan 1970 00:00:00 GMT"
puts ""
}
cli {
set type "full"
if {"-X" in $argv} { set schedtime 7200 }
}
}
if {[catch {set pid [exec pgrep humaxtv]}]} {
puts "Cannot find humaxtv process."
@@ -40,7 +55,12 @@ set rec 0
set seen {}
set output {}
set data [get_data]
if {$type eq "full"} {
set data [get_data]
} else {
set data {}
}
if {[llength $data]} {
sleep 3
set ndata [get_data]
@@ -64,8 +84,16 @@ if {[llength $data]} {
incr seen($name)
lappend output "<img class=va src=/images/$icon><span class=va>
$mode&nbsp;<i>$name</i></span>"
if {$runmode eq "cgi"} {
lappend output [concat \
"<span class=\"va stitem\">\n" \
" <img class=va src=/images/$icon>\n" \
" <span>$mode&nbsp;<i>$name</i></span>\n" \
"</span>\n" \
]
} else {
lappend output "$mode $name"
}
}
}
@@ -94,20 +122,63 @@ if {![system instandby] && $play < 1} {
append prog "[clock format $([$epg get start] + [$epg get duration]) -format %H:%M]"
append prog ") \[[$epg percent]%\]"
}
lappend output "[epg channelicon $name 30 \
{vertical-align: middle; padding: 0 4px 0 2px}]
<span class=va> Watching <i>$lcn: $name $prog</i></span>"
if {$runmode eq "cgi"} {
lappend output [concat \
"<span class=\"va stitem\">\n" \
" [epg channelicon $name 30 \
{vertical-align: middle; padding: 0 4px 0 2px}]\n" \
" <span>Watching <i>$lcn: $name $prog</i></span>\n" \
"</span>\n" \
]
} else {
lappend output "Watching $lcn: $name $prog"
}
}
}
if {[system instandby]} {
lappend output "<img class=va width=28 style=\"padding: 0 4px\"
src=/img/standby.png>
<span class=va>System is in standby.</span>"
if {$runmode eq "cgi"} {
lappend output [concat \
"<span class=\"va stitem\">\n" \
" <img class=va width=28 style=\"padding: 0 4px\"" \
"src=/img/standby.png>\n" \
" <span>System is in standby.</span>\n" \
"</span>" \
]
} else {
lappend output "System is in standby."
}
}
set events [rsv list tbl_reservation \
" where ersvtype = 3 and nsttime - [clock seconds] < $schedtime
and nsttime > [clock seconds] "]
foreach event $events {
if {$runmode eq "cgi"} {
set icon "175_1_11_Reservation_Record.png"
lappend output [concat \
"<span class=\"va stitem\">\n" \
" <img class=va src=/images/$icon width=20>\n" \
" <span>Will record <i>[$event name]</i>" \
" on [$event channel_name] at"\
" [clock format [$event get nsttime] -format {%H:%M}]" \
" </span>\n" \
"</span>\n" \
} else {
lappend output [concat \
"Will record '[$event name]' " \
"on [$event channel_name] at " \
"[clock format [$event get nsttime] -format {%H:%M}]" \
]
}
}
if {[llength $output]} {
puts [join $output "<br>"]
if {$runmode eq "cgi"} {
puts [join $output "\n<br>\n"]
} else {
puts [join $output "\n"]
}
}

View File

@@ -0,0 +1,12 @@
#!/mod/bin/jimsh
set stream "/mnt/hd3/Streamer_down_file"
puts "Content-type: text/plain\n"
if {[file exists $stream]} {
puts -nonewline [file size $stream]
} else {
puts -nonewline 0
}

View File

@@ -11,19 +11,23 @@ require epg.class spinner.class altrow epg_search totop
cgi_input
puts {<link type="text/css" href="/css/xepg.css" rel="Stylesheet" />}
puts {
<link type="text/css" href="/css/xepg.css" rel="Stylesheet" />
<script type=text/javascript src=/js/enadis.js></script>
}
[spinner new {
text "Loading Now/Next Information..."
text "Loading EPG 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 now [clock seconds]
set stt [cgi_get stt $now]
if {$stt <= $now} {
set stt $now
set current 1
} else {
set current 0
@@ -31,7 +35,8 @@ if {$stt <= [clock seconds]} {
set favgroup [[settings] channel_group]
set hours 4.0
set hours [expr 1.0 * [[settings] xepghours]]
if {$hours == 0} { set hours 4.0 }
set seconds $($hours * 3600)
set ostt $stt
@@ -40,7 +45,7 @@ set stt [expr int($stt / 1800.0) * 1800]
set ett $(int($stt + $seconds))
set offset $(($ostt - $stt) / 1800.0)
set chanpx 120
set chanpx 160
set eventpx 1000
set totalpx $($chanpx + $eventpx)
set contwidth $($totalpx + 50)
@@ -64,21 +69,42 @@ if {$::qepg} {
}
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>"
proc but {label time {active 1}} {
puts -nonewline "<button style=\"margin-right: 2em\" tt=$time"
if {$active} {
puts -nonewline " class=nav"
} else {
puts -nonewline " disabled class=\"nav ui-state-disabled\""
}
puts " active=$active>$label</button>"
}
puts "<button id=later>Later &gt;&gt;&gt;</button>"
puts "<!-- Hours $hours ($seconds) -->"
puts "<div id=buttons style=\"width: $eventpx; margin-left: ${chanpx}px;\">"
but "&lt&lt; -1 Week" $($stt - 3600 * 24 * 7) \
$($stt - $now + 3600 >= 3600 * 24 * 7)
but "&lt&lt; -1 Day" $($stt - 3600 * 24) $($stt - $now >= 3600 * 23)
but "&lt;&lt; Earlier", $($stt - 3600 * 4) $($stt > $now)
but "&lt; Now &gt;" $now $($current == 0)
but "&gt;&gt; Later" $ett;
but "&gt;&gt; +1 Day" $($stt + 3600 * 24) $($stt < $now + 8 * 3600 * 24)
but "&gt;&gt; +1 Week" $($stt + 3600 * 24 * 7) $($stt < $now + 8 * 3600 * 24)
puts "</div>"
puts "
<script type=text/javascript>
\$('button.nav').button();
</script>
<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 [clock format $stt -format {%a %d/%m/%Y}]
puts "<input type=hidden id=xepg_dp stt=$stt>"
puts "</div>"
puts "<div class=xechan style=\"width: ${chanpx}px;\">&nbsp;</div>"
@@ -173,6 +199,9 @@ puts "
Switch to standard now/next display.
</button></small>
</div>
"
puts "
<script type=text/javascript>
\$(document).ready(function() {
@@ -180,12 +209,37 @@ puts "
\$('#epgswitch').button().click(function() {
window.location = '/epg.shtml';
});
\$('#earlier').button().click(function() {
window.location = '/cgi-bin/xepg.jim?stt=$earlier';
\$('button.nav').click(function() {
window.location = '/cgi-bin/xepg.jim?stt=' + \$(this).attr('tt') +
'&pos=' + \$('#xegrid').scrollTop();
});
\$('#later').button().click(function() {
window.location = '/cgi-bin/xepg.jim?stt=$ett';
\$('#xepg_dp').datepicker({
buttonImage: '/img/cal.gif',
buttonImageOnly: true,
showOn: 'button',
dateFormat: '@',
minDate: '[expr $now * 1000]',
maxDate: '[expr ($now + 7 * 86400) * 1000]',
onSelect: function(val, sel) {
var stt = \$(this).attr('stt');
// Extract date part
dval = ~~(val / 86400000);
// Extract current time part
var tm = ~~(stt % 86400);
var ret = dval * 86400 + tm;
window.location = '/cgi-bin/xepg.jim?stt=' + ret;
}
});
\$('img.ui-datepicker-trigger').hover(
function() { \$(this).css('cursor', 'pointer'); },
function() { \$(this).css('cursor', 'auto'); }
);
"
if {$current} {

View File

@@ -247,6 +247,12 @@ pre, .pre
color: black;
}
.redshade
{
background: #ff4000;
color: white;
}
img.progress
{
background: transparent url(/img/percentback.png) top left no-repeat;
@@ -394,3 +400,8 @@ button.red
color: #ffffff;
}
div#restart_block
{
z-index: 31;
}

View File

@@ -4,6 +4,7 @@ set dedup_prefixes {
{^new series\.* *}
{^cbeebies\.* *}
{^cbbc\.* *}
{^t4: *}
{^brand new series *-* *}
{^\.+}
}
@@ -53,15 +54,6 @@ proc dedupnormalise {title {reserve ""}} {
}
}
# if still short, add the reserve string.
if {[string length $title] < 10} {
if {[string match "${title}*" $reserve]} {
set title $reserve
} else {
append title " $reserve"
}
}
if {[dict exists $seriesmap $title]} {
set ntitle "$seriesmap($title): $title"
set title $ntitle
@@ -73,6 +65,15 @@ proc dedupnormalise {title {reserve ""}} {
}
}
# if still short, add the reserve string.
if {[string length $title] < 6} {
if {[string match "${title}*" $reserve]} {
set title $reserve
} else {
append title " $reserve"
}
}
# Shorten if too long.
if {[string length $title] > 40} {
set title [string range $title 0 39]

View File

@@ -0,0 +1,24 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
puts "Content-Type: text/html"
puts ""
set logdirs {/var/log /mod/tmp /mnt/hd3}
set logext {.log}
cgi_input
#cgi_dump
set log [cgi_get file 0]
set ldir [file dirname $log]
if {[file dirname $log] in $logdirs && [file extension $log] in $logext} {
file copy -force "/dev/null" $log
puts "Cleared $log"
exit
}
puts "Cannot clear $log"

View File

@@ -2,11 +2,15 @@
package require cgi
source /mod/webif/lib/setup
require pretty_size
require pretty_size system.class pkg.class
puts "Content-Type: text/html"
puts ""
pkg loaddiagmeta
set smv [system modversion 1]
header
puts {
@@ -19,10 +23,24 @@ puts {
<tr>
<td>Run Diagnostic:</td>
<td><input name=seq id=seq autocorrect=off autocapitalize=off
value=general size=30 maxlength=50
<td class=va><span class=cleft>
<select name=diagsel id=diagsel class="text ui-widget-content ui-corner-all">
<option value=0>-- Select diag or type name in box below --
}
foreach diag [array names ::diagmeta] {
puts "<option value=\"$diag\">$diag\n"
}
puts {
</select><br>
<input name=seq id=seq autocorrect=off autocapitalize=off
value="general" size=30 maxlength=50
class="text ui-widget-content ui-corner-all">
</span>
<span class="left va">
<button id=rundiag>Run Diagnostic</button>
</span>
</td>
</tr>
@@ -46,6 +64,11 @@ puts {
<tr>
<td colspan=2 align=center>
}
if {[system model] eq "HDR"} {
puts { <button id=diskdiag style="width: 48%">Hard Disk</button> }
}
puts {
<button id=channelinfo style="width: 48%">Channel Information</button>
</td>
</tr>
@@ -77,7 +100,7 @@ puts {
<button id=runreset style="width: 100%"
}
if {[system modversion 1] < 200} {
if {$smv < 200} {
puts -nonewline " disabled class=ui-state-disabled"
}
@@ -87,7 +110,7 @@ Remove all custom firmware packages and settings
</button>
}
if {[system modversion 1] < 200} {
if {$smv < 200} {
puts {
<div class=footnote style="text-align: center">
(Install custom firmware v2.00 to enable this option)
@@ -105,6 +128,34 @@ Allow it to turn off completely before restarting.<br>
</td>
</tr>
<tr>
<td colspan=2>
<button id=runrma style="width: 100%"
}
if {$smv < 213} {
puts -nonewline " disabled class=ui-state-disabled"
}
puts {
>
Set Return-to-manufacturer (RMA) Mode
</button>
}
if {$smv < 213} {
puts {
<div class=footnote style="text-align: center">
(Install custom firmware v2.13 to enable this option)
</div>
}
}
puts {
</td>
</tr>
</table>
<span class=also style="padding-left: 5px">
View:
@@ -121,10 +172,15 @@ View:
foreach file [lsort [concat \
[glob -nocomplain /var/log/*.log] \
[glob -nocomplain /mod/tmp/*.log] \
[glob -nocomplain /mnt/hd3/*.log] \
]] {
puts "<a href=# class=log file=\"$file\">
<img border=0 height=14 src=/images/421_1_00_CH_Title_2R_Arrow.png>
[file tail $file]</a> ([pretty_size [file size $file]]) <br>"
[file tail $file]</a>
(<span class=lsize>[pretty_size [file size $file]]</span>)
<a class=\"va footnote logclear\" href=# file=\"$file\">
<img class=va border=0 src=/img/close.png width=20>Clear</a>
<br>"
}
puts {

166
var/mongoose/html/diag/disk.jim Executable file
View File

@@ -0,0 +1,166 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
require system.class
puts "Content-Type: text/html"
puts ""
header
set space [system diskspace]
set device [string range [lindex $space 5] 0 end-1]
set smart Unknown
set line ""
# smartctl uses non-zero exit status to indicate health hence catch.
catch { set line [exec /mod/bin/smartctl -H $device | sed -n 5p] } msg
if {$msg ne "" && $line eq ""} { set line $msg }
if {$line ne ""} {
set smart [string range [lindex [split $line :] 1] 1 end]
}
puts "
<h3 class=va>
<img class=va width=100 src=/img/disc.png>
SMART data read from device $device
</h3>
<fieldset class=cleft>
<legend>Disk Information</legend>
<table>
<tr><th class=key>SMART Status</th><td>$smart<td></tr>
"
foreach line [split [exec /mod/bin/smartctl -i $device] "\n"] {
if {[string match "*Not in smartctl database*" $line]} continue
if {[string match "*: *" $line]} {
regsub -all -- {[[:space:]]+} $line " " line
set fields [split $line ":"]
puts "<tr><th class=key>[lindex $fields 0]</th>"
puts "<td>[join [lrange $fields 1 end] :]</td></tr>"
}
}
puts {
</table>
</fieldset>
<fieldset class=cleft>
<legend>Attributes</legend>
<table class=borders cellpadding=3>
<tr>
<th class=odd>ID</th>
<th class=odd>Name</th>
<th class=odd>Flags</th>
<th class=odd>Raw Value</th>
<th class=odd>Value</th>
<th class=odd>Worst</th>
<th class=odd>Thresh</th>
<th class=odd>Type</th>
<th class=odd>Updated</th>
<th class=odd>When Failed</th>
</tr>
}
#set flag_autokeep 0x20
#set flag_count 0x10
#set flag_rate 0x08
#set flag_speed 0x04
#set flag_online 0x02
#set flag_prefailure 0x01
set flaglist [split "POSRCK" ""]
set flagdescr [list \
"P prefailure warning" \
"O updated online" \
"S speed/performance" \
"R error rate" \
"C event count" \
"K auto-keep" \
]
proc flags {val} {
global flaglist flagdescr
set f ""
set fx ""
loop i 0 [llength $flaglist] {
if {[expr $val & (1 << $i)]} {
append f [lindex $flaglist $i]
append fx "[lindex $flagdescr $i]\n"
} else {
append f "-"
}
}
return "<span title=\"$fx\">$f</span>"
}
set i 0
foreach line [split [exec /mod/bin/smartctl -A $device] "\n"] {
regsub -all -- {[[:space:]]+} $line " " line
regsub -all -- {^[[:space:]]+} $line "" line
if {[incr i] < 8} continue
lassign [split $line] \
id name flags val worst thresh type updated when rval
set class normal
switch $id {
5 { if {$rval > 0} { set class orangeshade } }
197 { if {$rval > 0} { set class redshade } }
198 { if {$rval > 0} { set class redshade } }
}
puts "<tr class=$class>"
puts "
<td>$id</td>
<td>$name</td>
<td>[flags $flags]</td>
<td>$rval</td>
<td>$val</td>
<td>$worst</td>
<td>$thresh</td>
<td>$type</td>
<td>$updated</td>
<td>$when</td>
</tr>"
}
puts {
</table>
</fieldset>
<fieldset class=cleft>
<legend>Self-test logs</legend>
<table class=borders cellpadding=3>
<tr>
<th class=odd>No.</th>
<th class=odd>Description</th>
<th class=odd>Status</th>
<th class=odd>Remaining</th>
<th class=odd>When</th>
<th class=odd>First Error LBA</th>
</tr>
}
if {[catch {set msg [exec /mod/bin/smartctl -l selftest $device]} xmsg]} {
set msg $xmsg
}
set i 0
foreach line [split $msg "\n"] {
regsub -all -- {[[:space:]][[:space:]]+} $line "|" line
if {[incr i] < 7} continue
lassign [split $line "|"] id name status remaining when lba
puts "<tr>
<td>$id</td>
<td>$name</td>
<td>$status</th>
<td>$remaining</th>
<td>$when</th>
<td>$lba</th>
</tr>"
}
puts {
</table>
</fieldset>
}
footer

View File

@@ -4,11 +4,14 @@ $(function() {
$('button').button();
$('#rundiag').click(function() {
var val = $('#diagsel').val();
if (val == '0')
val = $('#seq').val();
$('#results')
.slideDown()
.text('\n\nRunning diagnostic, please wait...\n\n')
.load('rundiag.jim?diag=' +
encodeURIComponent($('#seq').val()), function() {
.html('<br><br><img src=/img/loading.gif> ' +
'Running diagnostic, please wait...')
.load('rundiag.jim?diag=' + encodeURIComponent(val), function() {
$('#results').wrapInner('<pre>');
});
});
@@ -24,7 +27,8 @@ $('#runfopkg').click(function() {
});
});
$('a.log').click(function() {
$('a.log').click(function(e) {
e.preventDefault();
$('#results')
.slideDown()
.text('\n\nLoading log, please wait...\n\n')
@@ -34,6 +38,21 @@ $('a.log').click(function() {
});
});
$('a.logclear').click(function(e) {
var t = $(this);
e.preventDefault();
if (!confirm('Delete ' + $(this).attr('file') + '?'))
return;
$('#results')
.slideDown()
.text('\n\nClearing log, please wait...\n\n')
.load('clearlog.jim?file=' +
encodeURIComponent($(this).attr('file')), function() {
$('#results').wrapInner('<pre>');
$(t).prev('span.lsize').html('0 bytes');
});
});
$('#runedit').click(function(e) {
e.preventDefault();
window.location = '/edit/edit.jim';
@@ -49,6 +68,11 @@ $('#channelinfo').click(function(e) {
window.location = '/cgi-bin/channel.jim';
});
$('#diskdiag').click(function(e) {
e.preventDefault();
window.location = 'disk.jim';
});
$('#dlna').click(function(e) {
e.preventDefault();
window.location = '/dlna/dlna.jim';
@@ -78,6 +102,20 @@ $('#runreset').click(function(e) {
});
});
$('#runrma').click(function(e) {
e.preventDefault();
if (!confirm('Are you sure? This will completely remove all packages and settings and return the unit to state where you can re-install official firmware ready to return a faulty box to Humax for repair.'))
return;
if (!confirm('Are you really sure?'))
return;
if (!confirm('One last time, are you sure?'))
return;
$.get('/cgi-bin/cfwreset.cgi?rma=1', function() {
$('button').disable();
$('#resetdone').slideDown();
});
});
});

View File

@@ -2,6 +2,7 @@
package require cgi
source /mod/webif/lib/setup
require plugin
puts "Content-Type: text/html"
puts ""
@@ -43,6 +44,25 @@ Use the <i>Open</i> button below to begin.
<button id=back>Back to diagnostics</button>
</div>
<div class=cleft style="margin-top: 1em">
<fieldset>
<legend> Commonly edited files </legend>
<ul>
<li><a href=# class=qfile>/mod/etc/anacrontab</a></li>
<li><a href=# class=qfile>/mod/var/spool/cron/crontabs/root</a></li>
}
proc quickedit {file} {
puts "<li><a href=# class=qfile>$file</a></li>"
}
eval_plugins quickedit
puts {
</ul>
</fieldset>
</div>
<div id=chooserd>
<i>Humax Filesystem</i>
<div id=chooser></div>

View File

@@ -144,4 +144,8 @@ $('#create').click(function() {
$('#createf').dialog('open');
});
$('a.qfile').on('click', function() {
loadfile($(this).text());
});
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -1,6 +1,6 @@
<!--#include virtual="/lib/header.shtml" -->
<div class=toolbarouter>
<div class=toolbarouter style="top: -40px">
<div id=status class=toolbar>
<span id=status_txt>
Status...
@@ -19,8 +19,6 @@ $(document).ready(function() {
</script>
<!--#exec cmd="/mod/webif/include/menuicons.jim" -->
<div style="clear: both; padding-top: 1em">
<!--#exec cmd="/mod/webif/include/menuplugins.jim" -->
</div>

215
var/mongoose/html/m/browse.jim Executable file
View File

@@ -0,0 +1,215 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
require ts.class pretty_size system.class settings.class escape browse.class
cgi_input
set ignore {.nts .thm .hmi}
set include {.ts .avi .mpg .mpeg .wmv .mkv .mp3 .mp4 .mov .hmt}
set dir [cgi_get dir [system mediaroot]]
set model [system model]
set dustbin [system dustbin 1]
set order [[settings new] sortorder]
proc icon {img {hover ""} {extra ""} {class "va"}} {
puts -nonewline "<img src=$img class=\"$class\" height=21 $extra"
if {$hover ne ""} {
puts -nonewline " alt=\"$hover\" title=\"$hover\""
}
puts ">"
}
proc directory {file bfile tbfile {img /images/711_1_09_Media_Folder.png}} {
if {$bfile eq $::dustbin} { set img "/img/Dustbin_Folder.png" }
lassign [{dir iconset} $file] icons attrs
puts "<li><a href=\"browse.jim?dir=[cgi_quote_url $file]\"
data-transition=flip>
<img src=$img border=0 class=va width=80 id=\"img$tbfile\">
<h3>$bfile</h3>
"
if {[llength $icons]} {
puts "<p>[join $icons ""]</p>"
}
puts "<p class=ui-li-count>
<span class=filesize id=\"$tbfile\"></span>
</p>
</a></li>
"
}
proc entry {file {i 0}} {
set bfile [file tail $file]
regsub -all " +" $bfile "" tbfile
if {[string index $bfile 0] == "\025"} {
set bfile [string range $bfile 1 end]
}
if [file isdirectory "$file"] {
directory $file $bfile $tbfile
return
}
set ext [file extension $file]
if {$ext in $::ignore || $ext ni $::include} { return }
file stat $file st
set rsz $st(size)
set sz [pretty_size $rsz]
set base [file rootname $file]
if {$ext eq ".ts" && [file exists "${base}.nts"]} {
set type ts
set ts [ts fetch $file 1]
set img Video_TS
set omenu opt
} elseif {$ext eq ".hmt"} {
if {[file exists "${base}.ts"]} { continue }
# Sole hmt file indicates failure to track.
set type bad
set ts 0
set img Video_Failed
set omenu oopt
} else {
set type gen
set ts 0
set img Video_Other
set omenu oopt
}
set new 0
if {$type eq "ts"} {
if {[$ts flag "New"] > 0} { set new 1 }
} elseif {$type eq "gen"} {
if {![file exists "${base}.hmi"]} { set new 1 }
}
if {$new} { append img _New }
set fscl "fs"
set synopsis ""
if {$type eq "ts"} {
set fscl "fs fsts"
set synopsis [cgi_quote_html [$ts get synopsis]]
}
puts "<li>
<img class=va border=0 width=80 src=/img/$img.png>
<h3>$bfile</h3>
<p class=ui-li-count>
<span class=filesize> $sz </span>
</p>
<p class=icons>
"
# Icons
set locked 0
set encd 0
set odencd 1
set def unknown
set bx 0
set dlna 0
if {$type eq "ts"} {
# HD / SD
if {[$ts get definition] eq "HD"} {
set def HD
set img "172_1_00_HD"
} else {
set def SD
set img "172_1_26_SD"
}
icon "/images/$img.png"
# Locked
if {[$ts flag "Locked"] > 0} {
set locked 1
icon "/images/178_1_00_Icon_Lock.png" "Locked"
}
# Encrypted
if {[$ts flag "Encrypted"] > 0} {
set encd 1
icon "/images/749_1_26_Video_Encryption.png" ""
}
if {![$ts flag "ODEncrypted"]} {
set odencd 0
icon "/img/Decrypted.png" "Decrypted"
}
# Guidance
if {[$ts flag "Guidance"] > 0} {
icon "/images/174_1_26_GuidancePolicy.png"
}
# Indexed
if {$::model eq "HDR" && [llength [$ts dlnaloc]]} {
icon "/img/dlna.png" "Indexed by DLNA Server"
set dlna 1
}
# Shrunk (shown when necessary via Ajax)
icon "/img/compress.png" "Shrunk" \
"id=\"sp_$tbfile\"" "va hidden"
}
puts "</p></li>"
}
mheader
puts "
<span class=\"dir hidden\">$dir</span>
<ul data-role=listview data-filter=true data-count-theme=e>
<li data-role=list-divider>$dir
<p class=ui-li-count>
<span class=\"filesize dirsize\"></span>
</p>
</li>
"
# Parent directory
directory [join [lrange [split $dir /] 0 end-1] /] "\[parent directory\]" \
_parent "/images/711_3_09_Media_Folder_UP.png"
proc s_time {a b} {
global dir
set a "$dir/$a"
set b "$dir/$b"
set ad [file isdirectory $a]
set bd [file isdirectory $b]
if {$ad && !$bd} { return -1 }
if {$bd && !$ad} { return 1 }
if {$ad && $bd} {
if {$a < $b} { return -1 }
if {$a > $b} { return 1 }
return 0
}
if {[catch {file stat $a l}]} { return 0}
set at $l(ctime)
if {[catch {file stat $b l}]} { return 0}
set bt $l(ctime)
if {$at < $bt} { return -1 }
if {$at > $bt} { return 1 }
return 0
}
set files [readdir -nocomplain $dir]
switch $order {
1 { set files [lsort -command s_time $files] }
default { set files [lsort $files] }
}
foreach file $files { entry "$dir/$file" }
puts "</ul>"
mfooter

47
var/mongoose/html/m/channel.jim Executable file
View File

@@ -0,0 +1,47 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
require epg.class
source include/epgcell.jim
cgi_input
set sid [cgi_get sid 0]
mheader
set records [epg dbfetch dump -service $sid -after [clock seconds]]
set tr [lindex $records 0]
$tr get_channel_info
set day 0
puts "
<div class=va style=\"font-size: 1.2em; padding: 0 0 1em 0\">
[$tr channel_icon 40]
<span class=va>
[$tr get channel_num] - [$tr get channel_name]
</span>
</div>
<ul data-role=listview data-filter=true>
"
foreach e $records {
$e copy_channel_info $tr
set st [$e get start]
set nday [clock format $st -format "%F"]
if {$day ne $nday} {
set day $nday
puts "<li class=stick data-role=list-divider>
[clock format $st -format "%a %d %b %Y"]
</li>"
}
epgcell $e 1
}
puts "</ul>"
mfooter

155
var/mongoose/html/m/event_d.jim Executable file
View File

@@ -0,0 +1,155 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
require epg.class
cgi_input
set sid [cgi_get sid 0]
set eid [cgi_get eid 0]
mheader
set record [lindex [epg fetch dump -service $sid -event $eid] 0]
$record get_channel_info
set others [$record othertimes]
puts "
<div data-role=header data-theme=b>
<h1>EPG Event</h1>
</div>
<div data-role=content>
<table class=keyval>
<tr>
<th>Programme</th>
<td>[$record get name]</td>
</tr><tr>
<th>Synopsis</th>
<td>[$record get text]</td>
</tr><tr>
<th>Start</th>
<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 href=event_d.jim?sid=[$o get service_id]&"
puts -nonewline "eid=[$o get event_id] data-rel=dialog>"
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]
"
if {[$record showing]} {
puts [progressbar [$record percent]]
}
puts "
</td>
</tr><tr>
<th>Type</th>
<td>[$record get content_type] ([$record get content_code])</td>
</tr>
"
if {[$record get warning] != ""} {
puts "
<tr>
<th>Warning</th>
<td>[$record get warning]</td>
</tr>
"
}
if {[$record get event_crid] != ""} {
puts "
<tr>
<th>CRID</th><td>
[$record get channel_crid][$record get event_crid]
</td>
</tr>
"
}
if {[$record get series_crid] != ""} {
puts "
<tr>
<th nowrap>Series CRID</th><td>
[$record get channel_crid][$record get series_crid]
</td>
</tr>
"
}
if {[$record get rec_crid] != ""} {
set rec [$record recommended]
if {$rec != ""} {
puts "<tr><th>Recommends</th><td>
[$rec get name]
([$rec get channel_crid][$rec get event_crid])
</td></tr>"
}
}
puts "
<tr>
<td colspan=2 valign=top>
[$record channel_icon 50]
[join [$record icon_set] "&nbsp;"]
</td>
</tr>
</table>
"
# Buttons
if {[$record get start] < [clock seconds]} {
set rec 0
} elseif {[$record get series_crid] ne ""} {
set rec 2
} else {
set rec 1
}
$record process_sched
set sch [$record get sched_type]
if {!$sch} {
if {$rec == 2} {
puts "<a href=# data-theme=b class=schedule stype=2
sid=$sid eid=$eid data-role=button>
Record Series</a>"
}
if {$rec > 0} {
puts "<a href=# data-theme=b class=schedule stype=1
sid=$sid eid=$eid data-role=button>
Record Programme</a>"
puts "<a href=# data-theme=b class=schedule stype=3
sid=$sid eid=$eid data-role=button>
Set Reminder</a>"
}
}
puts "<a href=# data-role=button data-theme=a id=close data-rel=back>Close</a>"
puts "<div id=epginfo_extra class=footnote></div>"
epg cleanup
mfooter

View File

@@ -0,0 +1,37 @@
proc epgcell {e {aside 0}} {
$e get_channel_info
set st [$e get start]
set et $($st + [$e get duration])
puts "
<li><a data-rel=dialog data-transition=slidedown
href=event_d.jim?sid=[$e get service_id]&eid=[$e get event_id]>
[$e channel_icon 80]
<h4>[$e get name]</h4>
<p class=datetime>
[clock format $st -format {%a %d %b %Y %H:%M}]
-
[clock format $et -format {%H:%M}]
</p>
<p style=\"white-space: normal\">
[join [$e icon_set 14] ""]
[$e get text]</p>
"
set guidance [$e get warning]
if {$guidance ne ""} {
puts "<p class=blood style=\"white-space: normal\">
$guidance</p>"
}
if {[$e showing]} {
puts "<p>[progressbar [$e percent]]</p>"
}
if {$aside} {
puts "
<p class=ui-li-aside>
[clock format $st -format "%H:%M"] -
[clock format $et -format "%H:%M"]
</p>
"
}
}

View File

@@ -0,0 +1,32 @@
puts -nonewline "
<form action=search.jim method=get data-transition=fade>
<label class=ui-hidden-accessible for=epgsearchterm>
Search
</label>
<input size=20 maxlength=50
type=search placeholder=\"Enter search term\"
data-mini=true
name=epgsearchterm id=epgsearchterm value=\"$term\" />
<div data-role=fieldcontain class=va>
<label for=epgsearchfull
style=\"line-height: 1; width: auto; margin: 10px 0.5em 0 0;\">
Descriptions
</label>
<select data-mini=true
name=epgsearchfull id=epgsearchfull data-role=slider>
<option value=0"
if {!$full} { puts -nonewline " selected" }
puts -nonewline ">Off</option>
<option value=1"
if {$full} { puts -nonewline " selected" }
puts ">On</option>
</select>
<button type=submit data-mini=true name=search value=search
data-theme=b>Search</button>
</div>
</form>
"

View File

@@ -0,0 +1,8 @@
puts -nonewline "
<style>
.ui-field-contain .ui-btn.ui-submit { width: auto; }
.ui-field-contain { margin: 0 }
</style>
"

View File

@@ -0,0 +1,3 @@
<html><head>
<meta http-equiv=refresh content="0; URL=index.jim">
</head></html>

54
var/mongoose/html/m/index.jim Executable file
View File

@@ -0,0 +1,54 @@
#!/mod/bin/jimsh
source /mod/webif/lib/setup
require settings.class plugin
mheader
source include/searchstyle.jim
puts "<ul data-role=listview data-inset=true>"
proc tb {icon txt link {height 80} {width 0}} {
if {$width > 0} {
set width " width=$width"
} else {
set width ""
}
puts -nonewline "<li><a href=\"$link\">
<img src=\"$icon\" height=${height}${width} border=0>
<h3>$txt</h3>
</a></li>"
}
if {[file exists "/mod/bin/ir"]} {
tb "/img/remote.png" "Remote" "/plugin/ir/m/index.jim\" rel=\"external"
}
tb "/images/328_1_26_Menu_TV_Guide.png" "Now/Next" "nownext.jim"
puts "<li><a id=epgsearch href=#>
<img src=/images/328_1_26_Menu_TV_Guide.png height=80 border=0>
<h3>Search EPG</h3>
</a>
</li>
<li id=xepgsearch class=ui-screen-hidden>
"
set term ""
set full 0
source include/searchform.jim
puts "</li>"
tb "/images/323_1_10_Menu_Video.png" "Browse" "browse.jim"
tb "/images/321_1_00_Menu_CHList.png" "Schedule" "schedule.jim"
tb "/img/spanner.png" "Services" "services.jim"
tb "/img/packages.png" "Packages" "pkgi_b.jim"
tb "/images/326_1_00_Menu_Settings.png" "Settings" \
"/cgi-bin/settings.jim\" rel=\"external"
#tb "/img/diagnostics.png" "Diag" "#"
tb "/img/desktop.png" "Desktop Version" "/\" rel=\"external"
#eval_plugins toolbar
puts "</ul>"
mfooter

View File

@@ -0,0 +1,22 @@
#!/mod/bin/jimsh
puts {</div>}
if {!$_dialog} {
puts "<div data-role=footer data-theme=c>"
if {![catch {
set rendertime $(([clock milliseconds] - $renderstart) / 1000.0)
}]} {
puts "<font class=footnote>
Rendered in: $rendertime seconds</font>"
}
puts "</div>"
}
puts {
</div>
</body>
</html>
}

View File

@@ -0,0 +1,95 @@
#!/mod/bin/jimsh
source /mod/webif/lib/setup
require system.class
puts "Humax [system model] Fox T2 ([system hostname])"
puts "
<!DOCTYPE html>
<html>
<head>
<title>
Humax [system model] Fox T2 ([system hostname])
</title>
"
puts {
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width,user-scalable=no,initial-scale=1">
<meta name=apple-mobile-web-app-capable content=yes>
<meta name=apple-mobile-web-app-status-bar-style content=black>
<link rel="stylesheet" href="/lib/jquery.mobile/jquery.mobile.css" />
<link rel="stylesheet" href="/m/style.css" type="text/css"/>
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="/lib/jquery.mobile/jquery.mobile.js">
</script>
<script type="text/javascript" src="/js/enadis.js">
</script>
<script type="text/javascript" src="/m/script.js"></script>
<link rel="apple-touch-icon" href="/img/mobile_57.png" />
<link rel="apple-touch-icon" sizes="57x57" href="/img/mobile_57.png" />
<link rel="apple-touch-icon" sizes="72x72" href="/img/mobile_72.png" />
<link rel="apple-touch-icon" sizes="114x114" href="/img/mobile_114.png" />
<link rel="apple-touch-icon" sizes="144x144" href="/img/mobile_144.png" />
</head>
}
if [dict exists $env SCRIPT_NAME] {
set pageid [string range $env(SCRIPT_NAME) 3 end-4]
} else {
set pageid test
}
set _dialog 0
if {[string range $pageid end-1 end] eq "_d"} {
set _dialog 1
}
set _bare 0
if {[string range $pageid end-1 end] eq "_b"} {
set _bare 1
}
puts "<body>"
proc _header {{title ""}} {
if {$title eq ""} {
set title "[system model] ([system hostname])"
}
return "
<div class=ui-btn-right style=\"top: -5px\">
<div style=\"display: inline-block; margin-right: 10px;\">
<a data-theme=b data-icon=home data-iconpos=notext data-role=button
data-direction=reverse href=index.jim></a>
</div>
<div style=\"display: inline-block;\">
<a data-theme=b data-icon=refresh data-iconpos=notext data-role=button
class=refresh data-direction=reverse href=#></a>
</div>
</div>
<h1>$title</h1>
"
}
if {$_bare} {
puts ""
} elseif {$_dialog} {
puts "<div data-role=page id=${pageid}page>\n"
} else {
puts "
<div data-role=page data-add-back-btn=true id=${pageid}page>
<div class=\"hidden status\"></div>
<div data-role=header data-theme=b>
[_header]
</div>
<div data-role=content>
}
set renderstart [clock milliseconds]

62
var/mongoose/html/m/nownext.jim Executable file
View File

@@ -0,0 +1,62 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
require epg.class
mheader
set stt [clock seconds]
set ett $($stt + 14400)
set records [epg dbfetch dump -trange "$stt:$ett"]
puts "<ul data-role=listview data-filter=true>"
set lcn 0
set skiplcn 0
set entries 0
foreach e $records {
set chnum [$e get channel_num]
if {$chnum == 0} continue
if {$chnum == $skiplcn} continue
if {$chnum != $lcn} {
if {$lcn} {
puts "</a></li>";
}
set lcn $chnum
puts "<li><a href=channel.jim?sid=[$e get service_id]>
[$e channel_icon 80]"
set entries 0
}
set es [$e get start]
set ee [expr $es + [$e get duration]]
$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 "
[clock format $es -format "%H:%M"] -
[clock format $ee -format "%H:%M"]:
[cgi_quote_html [$e get name]]
"
if {$showing} { append txt " ($perc%)" }
puts "<p>$txt</p>"
incr entries
if {$entries > 3} { set skiplcn $lcn }
}
puts "</a></li>"
puts "</ul>"
mfooter

View File

@@ -0,0 +1 @@
pkgi_b.jim

163
var/mongoose/html/m/pkgi_b.jim Executable file
View File

@@ -0,0 +1,163 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
require settings.class pkg.class
if {[[settings] pkgdev]} { set filter 0 } else { set filter 1 }
pkg loadmeta
proc nav {active} {
set q "<div data-role=navbar data-id=pkg_navbar>\n <ul>\n"
foreach f {installed available upgrades} {
append q " <li><a"
if {$f eq $active} {
append q { class="ui-btn-active ui-state-persist"}
}
append q " href=pkg[string range $f 0 0]_b.jim>"
append q "[string totitle $f]</a></li>\n"
}
append q " </ul>\n</div>\n"
return $q
}
proc pkgtop {type} {
puts "
<div data-role=page id=pkga>
<div data-role=header data-theme=b>
[_header]
[nav $type]
</div>
<div data-role=content>
"
}
proc pkgrow {type pkg} {
set name [$pkg get name]
puts "<li class=\"pkg_$name\"><h3>$name</h3>"
if {$type eq "avail"} {
puts "<p class=ui-li-aside>[$pkg get latest]</p>"
} else {
puts "<p class=ui-li-aside>[$pkg get installed]</p>"
}
if {$type eq "upgr"} {
puts "<p>Latest: [$pkg get latest]</p>"
}
if {[dict exists $::pkgmeta $name]} {
puts "<p class=wsn>$::pkgmeta($name)</p>"
} else {
puts "<p class=wsn>[$pkg get descr]</p>"
}
if {![$pkg is installed]} {
set btype Install
} elseif {$type eq "upgr" && [$pkg is upgradable]} {
set btype Upgrade
} else {
set btype Remove
}
puts "
<p>
<a data-inline=true data-role=button data-mini=true data-theme=e
href=#
action=[string tolower $btype] pkg=\"$name\"
class=[string tolower $btype]>$btype</a>
</p>
"
puts "</li>"
}
proc pkglist {type} {
set pkgs [pkg $type]
puts "<ul data-role=listview>"
if {[llength $pkgs] <= 0} {
puts "<li><i>No packages "
switch $type {
inst { puts "are installed." }
upgr { puts "are available for upgrade; try updating the package list from the Internet using the button above." }
avail { puts "are available for installation." }
}
puts "</i></li></ul>"
return
}
foreach pkg $pkgs {
if {$type ne "upgr" && $::filter && \
![dict exists $::pkgmeta $pkg]} { continue }
pkgrow $type [pkg load $pkg]
}
if {$::filter} {
puts "<li data-role=list-divider>This is a filtered package list. To show all packages, enable the <i>Show development and advanced packages</i> in the settings screen.</li>"
}
puts "</ul>"
}
mheader
switch $pageid {
pkgi_b {
set type installed
set qtype inst
}
pkga_b {
set type available
set qtype avail
}
default {
set type upgrades
set qtype upgr
}
}
pkgtop $type
puts {
<ul data-role=listview>
<li>
<button data-theme=e class=opkg_update>
Update package list from Internet
</button>
}
if {$pageid eq "pkgu_b"} {
puts {
<button data-theme=e class=opkg_upgrade>
Upgrade all packages
</button>
}
}
puts {
</li>
</ul>
}
pkglist $qtype
puts {
<div data-role=popup class="opkg_popup ui-corner-all" data-theme=e>
<div data-role=header data-theme=a class=ui-corner-top>
<h1>Results</h1>
</div>
<div data-role=content data-theme=d class="ui-corner-bottom ui-content">
<p class="pre opkg_popup_text" data-theme=d></p>
</div>
<center><div class="hidden opkg_op_complete">
<img border=0 src=/images/167_2_00_Check_W2_SUB.png>
Operation complete.
<a href=# data-role=button data-inline=true data-rel=back
data-mini=true data-theme=b>Close</a>
</div></center>
</div>
}
mfooter

View File

@@ -0,0 +1 @@
pkgi_b.jim

View File

@@ -0,0 +1,85 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
require epg.class
proc eventtab {type title} {
set events [rsv list $type]
if {[set num [llength $events]] <= 0} return
puts "<li data-role=list-divider>$title ($num)</li>\n";
foreach event $events {
set name [$event name]
set rsvicon [$event icon]
set RKIcon [$event RKIcon]
set icons ""
if {$type eq "pending"} {
switch [$event get action] {
0 { set icon "add" }
1 { set icon "close" }
2 { set icon "ar" }
3 { set icon "pad" }
4 { set icon "folder" }
}
append icons "<img src=/img/$icon.png height=30>"
}
if {$rsvicon ne ""} {
append icons "<img src='/images/$rsvicon' height=20>"
}
if {$RKIcon ne ""} {
append icons "<img src='/images/$RKIcon' height=20>"
}
set s [$event get nsttime]
set d [$event get nduration]
set e $($s + $d)
set n [clock seconds]
set recording 0
if {$d > 0 && $n > $s && $n < $e} {
set recording 1
}
set last "[clock format $s -format {%a %d %b %Y %H:%M %Z}]"
if {$n > $e && [$event get ersvtype] <= 3} {
set ds "--- -- --- ---- --:--"
set dur "--:--:--<br>
<span class=blood>(Last: $last)</span>"
} else {
set ds $last
set dur "[clock format [$event get nduration] \
-format %T]"
}
puts "
<li><a data-rel=dialog data-transition=slidedown
href=schedule_d.jim?table=$type&slot=[$event get ulslot]>
[epg channelicon [$event channel_name] 80]
<h3>$icons $name</h3>
<p>
$ds $dur
</p>
";
if {$recording} {
set perc $(($n - $s) * 100 / $d)
puts "<p class=va>
<img class=va src=/images/745_1_11_Video_1REC.png>
[progressbar $perc]
</p>
"
}
puts "</a></li>";
}
}
mheader
puts "<ul data-role=listview data-filter=true>"
eventtab "pending" "Pending Events"
eventtab "TBL_RESERVATION" "Active Events"
puts "</ul>"
mfooter

View File

@@ -0,0 +1,118 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
require epg.class
cgi_input
set table [cgi_get table TBL_RESERVATION]
set slot [cgi_get slot 0]
set event [rsv slot $table $slot]
mheader
puts "
<div data-role=header data-theme=b>
<h1>Scheduled Event</h1>
</div>
<div data-role=content>
"
puts "
<table class=keyval>
<tr>
<th>Event [$event get ulslot]</th>
<td class=va>[join [$event iconset] ""]</td>
</tr><tr>
<th>Channel</th>
<td class=va>
"
if {[$event get usLcn] ne ""} {
puts "[epg channelicon [$event channel_name] 50]
- [$event get usLcn] - [$event channel_name]
"
}
puts "
</td>
</tr><tr>
<th>Event Name</th>
<td>[$event name]"
if {[$event get ucRecKind] == 4 && [$event name] ne [$event folder]} {
puts "<span class=also>(Folder: [$event folder])</span>"
}
puts "</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 {[$event isseries]} { puts "Series" } else { puts "Event" }
puts " CRID</th><td>
<img border=0 src=/images/421_1_00_CH_Title_2R_Arrow.png
height=14>
[$event get szCRID]
</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 "<img border=0 src=/images/421_1_00_CH_Title_2R_Arrow.png
height=14>$ev"
}
puts "</td></tr>"
puts "<tr><th>Accepted</th><td>"
if {[$event get aulEventToRecordInfo] ne ""} {
puts "Yes"
}
puts "</td></tr>"
puts "</table>"
# Buttons
puts "<a href=# data-theme=b id=delevent data-role=button
tab=$table slot=$slot>Cancel Event</a>"
puts "<a href=# data-role=button data-theme=a id=close data-rel=back>Close</a>"
epg cleanup
mfooter

View File

@@ -0,0 +1,189 @@
function s(query) {return $("div.ui-page-active " + query);}
$(document).bind('pageinit', function() {
$('div.status').last().load('/cgi-bin/status.jim', function() {
$(this).slideDown('slow');
});
$('a.refresh').on('click', function(e) {
e.preventDefault();
$.mobile.showPageLoadingMsg();
window.location.reload(true);
});
});
$(document).delegate('#indexpage', 'pageinit', function() {
$('#epgsearch').on('click', function(e) {
e.preventDefault();
$('#xepgsearch').toggle('slow');
});
});
$(document).delegate('#event_dpage', 'pageinit', function() {
$('a.schedule').click(function(e) {
e.preventDefault();
$.mobile.showPageLoadingMsg();
$('#epginfo_extra').load('/cgi-bin/epg/schedule.jim?' +
'service=' +
encodeURIComponent($(this).attr('sid')) +
'&event=' +
encodeURIComponent($(this).attr('eid')) +
'&type=' +
$(this).attr('stype'), function() {
$('a.schedule').fadeOut('slow');
});
});
});
$(document).delegate('#schedule_dpage', 'pageinit', function() {
$('#delevent').click(function(e) {
e.preventDefault();
if (!confirm('Confirm event cancellation?'))
return;
$.mobile.showPageLoadingMsg();
$.get('/sched/cancel.jim' +
'?slot=' + $(this).attr('slot') +
'&table=' + $(this).attr('tab'), function() {
$('.ui-dialog').dialog('close');
$.mobile.showPageLoadingMsg();
window.location.reload(true);
});
});
});
function insert_folder_size(folder, size)
{
folder = folder.replace(/ /g, '');
folder = folder.replace(/([ #;&,.+*~\':"!^$[\]()=>|\/@])/g, '\\$1');
//console.log("Folder: (%s) = (%s)", folder, size);
if (size.search(/\d$/) == -1)
size += 'iB';
else
size += ' bytes';
if (folder == "")
$('span.dirsize').text(size);
else
$('#' + folder).text(size);
}
function folder_size_callback(data, status, xhr)
{
//console.log("Status: %s", status);
//console.dir(data);
$.each(data, insert_folder_size);
}
function set_folder_new(folder, cnt)
{
folder = folder.replace(/ /g, '');
folder = folder.replace(/([ #;&,.+*~\':"!^$[\]()=>|\/@])/g, '\\$1');
//console.log("Folder: (%s) = (%s)", folder, cnt);
$('#img' + folder).attr('src', '/img/Folder_New.png');
}
function new_folder_callback(data, status, xhr)
{
//console.log("Status: %s", status);
//console.dir(data);
$.each(data, set_folder_new);
}
function insert_shrunk(file, perc)
{
if (perc == 0)
{
file = file.replace(/[ ]/g, '');
file = file.replace(/([ #;&,.+*~\':"!^$[\]()=>|\/@])/g, '\\$1');
//console.log("File: (%s) = (%s)", file, perc);
$('#sp_' + file).show();
}
}
function shrunk_callback(data, status, xhr)
{
//console.log("Status: %s", status);
//console.dir(data);
$.each(data, insert_shrunk);
}
$(document).delegate('#browsepage', 'pageinit', function() {
var dir = $('span.dir').last().text();
//console.log('DIR: %O', dir);
// Load folder sizes
$.getJSON('/cgi-bin/browse/sizes.jim?dir=' + encodeURIComponent(dir),
folder_size_callback);
// Flag folders with unwatched items
$.getJSON('/cgi-bin/browse/newdir.jim?dir=' + encodeURIComponent(dir),
new_folder_callback);
// Flag shrunk recordings
$.getJSON('/cgi-bin/browse/shrunk.jim?dir=' + encodeURIComponent(dir),
shrunk_callback);
});
var opkgreload = false;
function execopkg(arg, pkg)
{
$.mobile.showPageLoadingMsg();
s('a').disable();
s('.opkg_op_complete').hide('fast');
s('.opkg_popup_text')
.empty()
.html('<img src=/img/loading.gif> Processing...');
s('.opkg_popup').popup('open', {transition: 'pop'})
s('.opkg_popup_text').load('/cgi-bin/opkg.jim?cmd=' + arg, function() {
s('.opkg_op_complete').slideDown('slow');
if (opkgreload)
window.location.reload(true);
else
{
if (pkg)
s('.pkg_' + pkg).slideUp();
$.mobile.hidePageLoadingMsg();
s('a').enable();
}
});
}
$(document).delegate('#pkga,#pkgi,#pkgu', 'pageinit', function() {
$('a.remove, a.install, a.upgrade')
.click(function() {
if ($(this).attr('action') == 'remove' &&
!confirm('Please confirm removal of the ' +
$(this).attr('pkg') + ' package.'))
return;
execopkg(encodeURIComponent($(this).attr('action') +
' ' + $(this).attr('pkg')), $(this).attr('pkg'));
});
$('button.opkg_update').on('click', function() {
opkgreload = true;
execopkg('update');
});
$('button.opkg_upgrade').on('click', function() {
opkgreload = true;
execopkg('upgrade');
});
});
$(document).delegate('#servicespage', 'pageinit', function() {
// Don't allow turning off the web server from within the web server..
$('select[service=mongoose]').disable();
$('select.auto,select.toggle').on('change', function() {
var url = '/cgi-bin/service.jim?action=' +
escape($(this).attr('act')) +
'&service=' +
escape($(this).attr('service'));
$.get(url);
});
});

36
var/mongoose/html/m/search.jim Executable file
View File

@@ -0,0 +1,36 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
require epg.class
source include/epgcell.jim
cgi_input
set term [cgi_get epgsearchterm ""]
set full [cgi_get epgsearchfull 0]
mheader
source include/searchstyle.jim
puts "<ul data-role=listview data-filter=false><li>"
source include/searchform.jim
puts "</li>"
set cmd search
if {$full} { set cmd searchall }
if {$term ne ""} {
#set records [epg fetch $cmd -extra $term]
set records [epg dbfetch $cmd -term $term]
} else {
set records {}
}
foreach e $records {
epgcell $e
}
puts "</ul>"
mfooter

View File

@@ -0,0 +1,59 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
mheader
set services [split [exec /mod/bin/service mlist]]
puts "<ul data-role=listview>"
set i 0
foreach service $services {
lassign [split $service ":"] name installed auto running
if (!$installed) {
puts "<li><h3>[string totitle $name]</h3>"
puts "<p><i>Not installed.</i></p>"
puts "</li>"
continue
}
incr i
puts "
<li>
<div data-role=fieldcontain data-mini=true>
<h3>[string totitle $name]</h3>
<label class=va for=toggle$i>State:</label>
<select class=toggle act=toggle data-role=slider service=$name>
"
if {$running} {
puts "<option value=off>Off</option>"
puts "<option value=on selected>On</option>"
} else {
puts "<option value=off selected>Off</option>"
puts "<option value=on>On</option>"
}
puts "
</select>
<label class=va for=auto$i>Auto-start:</label>
<select class=auto act=auto data-role=slider service=$name>
"
if ($auto) {
puts "<option value=off>Off</option>"
puts "<option value=on selected>On</option>"
} else {
puts "<option value=off selected>Off</option>"
puts "<option value=on>On</option>"
}
puts "
</select>
</div>
"
puts "</li>"
}
puts "</ul>"
mfooter

View File

@@ -0,0 +1,130 @@
html body
{
line-height: 1.55em;
font-family: "Lucida Grande", verdana, lucida, helvetica, sans-serif;
background-color: #f8f8f8;
margin: 1em;
padding: 0;
font-size: small;
}
html>body
{
font-size: small;
}
p.datetime
{
font-style: italic;
}
img.progress
{
background: transparent url(/img/percentback.png) top left no-repeat;
padding: 0;
margin: 0;
background-position: 1px 0;
}
.va
{
vertical-align: middle;
}
.hidden
{
display: none;
}
div.status
{
font-size: 0.7em;
text-align: center;
vertical-align: middle;
display: none;
width: 100%;
background: blue;
color: white;
}
.blood
{
color: #ff4000;
background: transparent;
}
li.stick
{
display: block;
}
li.sticky
{
position: absolute;
top: 0;
}
table.keyval
{
position: relative;
left: -10px;
}
table.keyval th, th.key
{
background: #ccff99;
font-weight: bold;
text-align: right;
color: black;
}
table.keyval td
{
background: #ffffcc;
color: black;
}
.also
{
font-size: 0.8em;
font-style: italic;
color: #333;
background: transparent;
text-decoration: none;
}
p.wsn
{
white-space: normal;
}
pre, .pre, .prelike
{
font-family: Consolas, 'Courier New', Courier, monospace;
color: black;
background: #f9d9b0 url('/img/prebg.png') repeat-x top;
line-height: 1.24;
padding: 3px 8px;
margin: 0 5em 1em 5em;
border-color: #f9d9b0;
border-bottom: 1px solid #f9bc6d;
border-top-left-radius: 4px;
-webkit-border-top-left-radius: 4px;
-moz-border-radius-topleft: 4px;
-khtml-border-top-left-radius: 4px;
border-top-right-radius: 4px;
-webkit-border-top-right-radius: 4px;
-moz-border-radius-topright: 4px;
-khtml-border-top-right-radius: 4px;
}
pre, .pre
{
white-space: pre-wrap;
white-space: -moz-pre-wrap !important;
white-space: -pre-wrap;
white-space: -o-pre-wrap;
white-space: break-word;
}

View File

@@ -23,7 +23,8 @@ if {![$ts flag "ODEncrypted"]} {
} else {
lassign [$ts dlnaloc] url
if {$url eq ""} {
alert("Media is encrypted and not indexed by the DLNA Server.");
puts "Media is encrypted and not indexed by the DLNA Server."
exit
}
}

View File

@@ -2,7 +2,7 @@
package require cgi
source /mod/webif/lib/setup
require rsv.class progressbar
require rsv.class progressbar epg.class
puts "Content-Type: text/html"
puts ""
@@ -15,46 +15,17 @@ 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>"
if {[$event get ersvtype] == 3} {
if {[$event padded]} {
set padding "<- [expr [$event get ulPreOffset] / 60], [expr [$event get ulPostOffset] / 60] ->"
append rsvicon \
"<img src=/img/pad.png height=20
title=\"$padding\" alt=\"$padding\">"
} else {
append rsvicon \
"<img src=/img/ar.png 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>
<td class=va>[join [$event iconset] ""]</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\">
puts "[epg channelicon [$event channel_name] 50]
- [$event get usLcn] - [$event channel_name]
"
}
@@ -104,10 +75,10 @@ puts "
set crid [join [lrange [split [$event get szCRID] /] 1 end]]
if {$crid != ""} {
puts "<tr><th>"
if $series { puts "Series" } else { puts "Event" }
if {[$event isseries]} { puts "Series" } else { puts "Event" }
puts " CRID</th><td>"
puts -nonewline "<a href=/cgi-bin/epg/search.jim?"
if $series { puts -nonewline "s" }
if {[$event isseries]} { puts -nonewline "s" }
puts "crid=/$crid>
<img border=0 src=/images/421_1_00_CH_Title_2R_Arrow.png
height=14>

View File

@@ -7,8 +7,17 @@ require altrow rsv.class progressbar epg.class system.class
puts "Content-Type: text/html"
puts ""
set svcmap {}
lmap i \
[$::channeldb query {select hSvc, usSvcid from TBL_SVC}] \
{
set svcmap([lindex $i 1]) [lindex $i 3]
}
header
require epg_popup
puts {
<script type=text/javascript src=/js/jquery.tablesorter.js></script>
<link type=text/css href=/css/tsort.css rel=Stylesheet />
@@ -17,7 +26,7 @@ puts {
<script type=text/javascript src=/js/jquery.form.js></script>
<script type=text/javascript src=script.js></script>
<div id=dialogue></div>
<div id=sdialogue></div>
}
proc eventheader {{table TBL_RESERVATION} note} {
@@ -49,6 +58,8 @@ proc eventheader {{table TBL_RESERVATION} note} {
}
proc eventrow {event {table TBL_RESERVATION}} {
global svcmap
set name [$event name]
set attrs "table=$table sid=[$event get ulslot] \
@@ -56,42 +67,8 @@ proc eventrow {event {table TBL_RESERVATION}} {
ar=[expr ! [$event padded]]"
altrow $attrs
set rsvicon [$event icon]
set RKIcon [$event RKIcon]
if {[$event get ucRecKind] == 4} {
set series 1
} else {
set series 0
}
if {$rsvicon ne ""} {
set rsvicon "<img src='/images/$rsvicon' height=20>"
if {[$event get ersvtype] == 3} {
if {[$event padded]} {
set padding "<- [expr [$event get ulPreOffset] / 60], [expr [$event get ulPostOffset] / 60] ->"
append rsvicon \
"<img src=/img/pad.png height=20
title=\"$padding\" alt=\"$padding\">"
} else {
append rsvicon \
"<img src=/img/ar.png height=20>"
}
}
}
if {$RKIcon ne ""} {
set RKIcon "<img src='/images/$RKIcon' height=20>"
}
if {$table eq "pending"} {
switch [$event get action] {
0 { set icon "add" }
1 { set icon "close" }
2 { set icon "ar" }
3 { set icon "pad" }
4 { set icon "folder" }
}
puts "<td align=center>
<img class=va width=30 src=/img/$icon.png></td>"
puts "<td align=center>[$event pendingicon]</td>"
}
puts "<td>[$event get ulslot]</td>"
@@ -117,6 +94,7 @@ proc eventrow {event {table TBL_RESERVATION}} {
} {
puts "<br><span class=also>&nbsp;(Folder: [$event folder])</span>"
}
puts "</td>"
set s [$event get nsttime]
@@ -124,18 +102,33 @@ proc eventrow {event {table TBL_RESERVATION}} {
set e $($s + $d)
set n [clock seconds]
set ds "[clock format $s -format "%a %d %b %Y"]<br>
[clock format $s -format "%H:%M %Z"]"
if { $n > $e && [$event get ersvtype] <= 3} {
puts "<td nowrap class=va
alt=\"$ds\" title=\"$ds\">
--- -- --- ----<br>--:--"
if {$n > $e && [$event get ersvtype] <= 3} {
set ds "[clock format $s -format {%a %d %b %Y %H:%M}]"
puts "<td nowrap class=va>
--- -- --- ---- --:--<br>
<span class=footnote>(Last: $ds)</span>"
puts "</td><td>--:--:--</td>"
} else {
set elist [$event aul]
set ds "[clock format $s -format {%a %d %b %Y %H:%M}]"
puts "<td nowrap class=\"va"
if {$n > $e} { puts " blood" }
puts "\">$ds"
puts "\">"
if {[llength $elist] > 0} {
lassign [lindex $elist 0] service_id start end event_id
if {$start == $s} {
puts "<a class=event href=#
xs=$svcmap($service_id) xe=$event_id>
$ds</a>"
} else {
puts $ds
}
} else {
puts $ds
}
if {$d > 0 && $n > $s && $n < $e} {
puts "<br>"
set perc [expr [expr $n - $s] * 100 / $d]
@@ -143,11 +136,37 @@ proc eventrow {event {table TBL_RESERVATION}} {
src=/images/745_1_11_Video_1REC.png>"
puts [progressbar $perc]
}
puts "</td><td>"
puts "[clock format [$event get nduration] -format %T]</td>"
if {[llength $elist] > 1} {
puts "<div class=also style=\"margin-top: 0.5em\">"
foreach e $elist {
lassign $e service_id start end event_id
if {$start == $s} continue
puts "<a class=event href=#
xs=$svcmap($service_id) xe=$event_id>
[clock format $start \
-format {%a %d %b %Y %H:%M}]</a><br>"
}
puts "</div>";
}
puts "</td><td align=center>"
puts "[clock format [$event get nduration] -format %H:%M]"
if {[llength $elist] > 1} {
puts "<div class=also style=\"margin-top: 0.5em\">"
foreach e $elist {
lassign $e service_id start end event_id
if {$start == $s} continue
puts "[clock format $($end - $start) \
-format {%H:%M}]<br>"
}
puts "</div>";
}
puts "</td>"
}
puts "<td nowrap>$rsvicon $RKIcon</td>"
puts "<td nowrap>[join [$event iconset] ""]</td>"
puts "<td><a href=# class=smenu sid=[$event get ulslot]>
<img border=0 src=/img/more_btn.gif></a></td>"

View File

@@ -37,8 +37,8 @@ $('table.tablesorter thead th').filter('[class!=header]')
function docancel()
{
var table = $('#dialogue').attr('table');
var slot = $('#dialogue').attr('slot');
var table = $('#sdialogue').attr('table');
var slot = $('#sdialogue').attr('slot');
if (confirm('Really remove scheduled event?'))
{
@@ -46,7 +46,7 @@ function docancel()
'&table=' + table, function() {
window.location.reload(true);
});
$('#dialogue').dialog('close');
$('#sdialogue').dialog('close');
}
}
@@ -57,14 +57,14 @@ var $buttons2 = $.extend(
{"Cancel Event": function() { docancel() }},
$buttons1);
var $dialog = $('#dialogue').dialog({
var $dialog = $('#sdialogue').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(
close: function(e,u) { $('#sdialogue').empty().html(
'<img src="/img/loading.gif" alt="loading">'); }
});
@@ -73,11 +73,11 @@ function schedpopup(e, o)
e.preventDefault();
var slot = o.attr('slot');
var table = o.attr('table');
$('#dialogue').attr('slot', slot).attr('table', table);
$('#sdialogue').attr('slot', slot).attr('table', table);
var url = 'info.jim?slot=' + slot +
'&table=' + table;
$('#dialogue').load(url);
$('#sdialogue').load(url);
$dialog.dialog('open');
}
$('a.schedule').click(function(e) { schedpopup(e, $(this)) });

View File

@@ -1,14 +1,22 @@
<!--#include virtual="/lib/header.shtml" -->
<link href=/css/iphone-style-checkboxes.css rel=stylesheet type=text/css />
<script type="text/javascript" src="/js/iphone-style-checkboxes.js"></script>
<script type="text/javascript" src="/js/enadis.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('input:checkbox').iphoneStyle();
// Don't allow turning off the web server from within the web server..
$('input:checkbox[name=mongoose][class=toggle]').attr('disabled', true);
$('input:checkbox[name=mongoose][class=toggle]').disable();
$(':checkbox').change(function() {
if ($(this).attr('name') == 'mongoose' &&
!$(this).is(':checked'))
alert(
'Note that mongoose is the web server service that ' +
'provides this web interface. If you disable auto-start ' +
'then the web interface will not be available when the ' +
'Humax is restarted.');
var url = '/cgi-bin/service.jim?action=' +
escape($(this).attr('class')) +
'&service=' +

View File

@@ -3,10 +3,16 @@
source /mod/webif/lib/setup
require settings.class
proc menuitem {title icon link {width 217} {height 0} {extra ""}} {
proc menuitem {title icon link {width 217} {height 0} {extra ""}} {{num 0}} {
incr num
if {$title eq ""} return
if {$num > 4} {
puts {</div><div style="clear: both; padding-top: 1em">}
set num 1
}
if {$extra ne ""} { append extra " " }
puts -nonewline "
<div class=left>
<div class=left num=$num>
<center>
<a href=$link>
<img src=$icon ${extra}border=0 width=$width"
@@ -42,7 +48,9 @@ if {[file exists "/mod/bin/ir"]} {
menuitem "Remote" "/img/remote.png" /plugin/ir/remote.jim 217 228
}
puts {</div><div style="clear: both; padding-top: 1em">}
if {[[settings] nomobile] eq "0"} {
menuitem "Mobile Version" "/img/mobile.png" /m/ 217 228
}
menuitem "Service Management" "/img/spanner.png" \
/services.shtml 217 228
@@ -50,8 +58,7 @@ menuitem "Package Management" "/img/packages.png" \
/pkg/index.shtml 217 228
menuitem "Settings" "/images/326_1_00_Menu_Settings.png" \
/cgi-bin/settings.jim 217 228
menuitem "Diagnostics" "/img/diagnostics.png" \
/diag/diag.jim 217 228
puts {</div>}

View File

@@ -3,10 +3,15 @@
source /mod/webif/lib/setup
require system.class
set modver [system modversion]
set modbuild [system modbuild]
if {$modbuild > 0} {
append modver " (build $modbuild)"
}
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]
Custom firmware version: $modver
"
if {![catch {set fhtcpversion [system fhtcpversion]}]} {
puts "<br>Humax Version: $fhtcpversion"

View File

@@ -35,7 +35,12 @@ puts {
$('#restart_humaxtv').button()
.click(function() {
if (confirm('Are you sure you wish to perform a restart now?'))
window.location = '/cgi-bin/restart.jim';
if (confirm('Really sure?\n\nThere is a small chance the ' +
' Humax may not restart\n' +
'without physical intervention.\n\n' +
'i.e. pressing the standby button or using the ' +
'remote control'))
window.location = '/cgi-bin/restart.jim';
});
$('#restart_cancel').button()
.click(function() {

View File

@@ -151,8 +151,8 @@ proc do_decrypt {ts} {
puts " Removing/binning old copy."
# Move the old recording to the bin if undelete is installed.
set bin [bindir $file "$dustbin/webif_autodecrypt"]
if {$dustbin ne ""} {
set bin [bindir $file "$dustbin/webif_autodecrypt"]
set tail [file tail $rfile]
file rename "$rfile.encrypted" "$bin/$tail.ts"
foreach ext {nts hmt thm} {

View File

@@ -0,0 +1,54 @@
require system.class
#if {![exists -proc class]} { package require oo }
#class browse {}
set _flatten [system pkginst flatten]
proc _addicon {img {hover ""} {class va}} {
set icon "<img src=$img class=\"$class\" height=21"
if {$hover ne ""} {
append icon " alt=\"$hover\" title=\"$hover\""
}
append icon ">"
return $icon
}
proc {dir iconset} {dir} {
set icons {}
set attrs {}
set noflat 0
if $::_flatten {
if {[string match {\[*\]} [file tail $dir]]} { set noflat 1 }
if {[file exists "$dir/.noflatten"]} { set noflat 1 }
if $noflat { lappend icons \
[_addicon "/img/flat-tyre.png" "No-flatten" }
lappend attrs "noflat=$noflat"
}
set autoshrink 0
if {[file exists "$dir/.autoshrink"]} {
set autoshrink 1
lappend icons [_addicon "/img/compress.png" "Auto-shrink"]
lappend attrs "autoshrink=$autoshrink"
}
set autodedup 0
if {[file exists "$dir/.autodedup"]} {
set autodedup 1
lappend icons [_addicon "/img/dedup.png" "Auto-dedup"]
lappend attrs "autodedup=$autodedup"
}
set autodecrypt 0
if {[file exists "$dir/.autodecrypt"]} {
set autodecrypt 1
lappend icons [_addicon "/img/decrypt.png" "Auto-decrypt"]
lappend attrs "autodecrypt=$autodecrypt"
}
return [list $icons $attrs]
}

View File

@@ -3,7 +3,7 @@ source /mod/webif/lib/setup
if {![exists -proc class]} { package require oo }
if {![exists -proc sqlite3.open]} { package require sqlite3 }
require settings.class progressbar rsv.class
require settings.class progressbar rsv.class mwildcard
set ::epgpath /mnt/hd1/dvbepg/epg.dat
@@ -155,6 +155,13 @@ epg method get_channel_info {} {
}
}
epg method copy_channel_info {s} {
set channel_num [$s get channel_num]
set channel_name [$s get channel_name]
set channel_crid [$s get channel_crid]
set channel_hsvc [$s get channel_hsvc]
}
epg method get_rsv {} {
if {$hsvc == 0} { $self get_channel_info }
if {$hsvc == 0} { return }
@@ -334,6 +341,7 @@ proc {epg exec} {mode args} {
proc {epg dbfetch} {mode args} {
set records {}
set extra ""
set params {}
set select "
select distinct *,
@@ -368,6 +376,8 @@ proc {epg dbfetch} {mode args} {
"and e.event_id = $v " }
-time { append q \
"and e.start < $v and e.end > $v " }
-after { append q \
"and e.end >= $v " }
-trange {
lassign [split $v :] stt ett
append q "and (
@@ -382,6 +392,18 @@ proc {epg dbfetch} {mode args} {
append q "and f.eFavGroup = $v "
set sort "order by f.favIdx, start"
}
-term {
set v [mwildcard $v]
append q "and ("
append q "e.name like '%s' "
lappend params "%$v%"
if {$mode eq "searchall"} {
append q \
"or e.text like '%s' "
lappend params "%$v%"
}
append q ") "
}
default { error "Invalid option, $arg" }
}
}
@@ -392,10 +414,12 @@ proc {epg dbfetch} {mode args} {
#puts "QUERY -$query-"
set records {}
catch {
foreach rec [$::channeldb query $query] {
if {[catch {
foreach rec [$::channeldb query $query {*}$params] {
lappend records [epg new $rec]
}
} msg]} {
puts "No cached EPG data, try again later ($msg)."
}
return $records
}

View File

@@ -65,7 +65,10 @@ $(document).ready(function() {
.attr('xe', o.attr('xe'));
$dialog.dialog('open');
}
$('a.event').click(function(e) { epgpopup(e, $(this)) });
$('a.event').click(function(e) {
e.preventDefault();
epgpopup(e, $(this))
});
});
</script>
}

View File

@@ -0,0 +1,5 @@
proc mwildcard {v} {
return [string map {"%" "\\%" "*" "%" "_" "\\_" "?" "_"} $v]
}

View File

@@ -9,6 +9,7 @@ class pkg {
}
set ::pkgmeta {}
set ::diagmeta {}
pkg method _load {nm} {
set name $nm
@@ -85,6 +86,17 @@ proc {pkg loadmeta} {} {
}
}
proc {pkg loaddiagmeta} {} {
if {[llength $::diagmeta]} { return }
if {![file exists "/mod/var/diag.meta"]} {
catch {pkg fetchdiagmeta}
} else {
set meta [open "/mod/var/diag.meta" r]
set ::diagmeta [read $meta]
$meta close
}
}
proc {pkg fetchmeta} {} {
set f [socket stream hummypkg.org.uk:80]
$f puts -nonewline "GET /hdrfoxt2/pkg.meta HTTP/1.1\r\n"
@@ -103,3 +115,21 @@ proc {pkg fetchmeta} {} {
$ff close
}
proc {pkg fetchdiagmeta} {} {
set f [socket stream hummypkg.org.uk:80]
$f puts -nonewline "GET /diag/diag.meta HTTP/1.1\r\n"
$f puts -nonewline "Host: hummypkg.org.uk\r\n"
$f puts -nonewline "\r\n"
set line [string trim [$f gets]]
while {[string length $line]} {
set line [string trim [$f gets]]
}
set ::diagmeta [$f read]
$f close
set ff [open "/mod/var/diag.meta" w]
puts $ff $::diagmeta
$ff close
}

View File

@@ -60,7 +60,7 @@ rsv method aul {} {
for {set i 0} {$i < [string length $aulEventToRecordInfo]} {incr i 16} {
binary scan [string range $aulEventToRecordInfo $i $($i + 15)] \
iiii service start end event_id
lappend aul [list $service $start $end $event_id]
catch {lappend aul [list $service $start $end $event_id]}
}
return $aul
}
@@ -69,6 +69,10 @@ rsv method clear_ulslot {} {
set ulslot -1
}
rsv method isseries {} {
if {$ucRecKind == 4} { return 1 } else { return 0 }
}
rsv method _strip {str} {
if {[string range $str 1 2] eq "i7"} {
set str [string range $str 3 end]
@@ -143,6 +147,41 @@ rsv method RKIcon {} {
return $RKIcon
}
rsv method pendingicon {{width 30}} {
switch $action {
0 { set icon "add" }
1 { set icon "close" }
2 { set icon "ar" }
3 { set icon "pad" }
4 { set icon "folder" }
}
return "<img class=va width=$width src=/img/$icon.png>"
}
rsv method iconset {{height 20}} {
set iconlist {}
set icon [$self icon]
if {$icon ne ""} {
lappend iconlist "<img src='/images/$icon' height=$height>"
if {$ersvtype == 3} {
if {[$self padded]} {
set padding "<- [expr $ulPreOffset / 60], [expr $ulPostOffset / 60] ->"
lappend iconlist \
"<img src=/img/pad.png height=$height
title=\"$padding\" alt=\"$padding\">"
} else {
lappend iconlist \
"<img src=/img/ar.png height=$height>"
}
}
}
set icon [$self RKIcon]
if {$icon ne ""} {
lappend iconlist "<img src='/images/$icon' height=$height>"
}
return $iconlist
}
rsv method set_delete {} {
set action 1
}
@@ -251,8 +290,8 @@ rsv method insert {{table pending} {force 0}} {
$rsvdb query $query
}
proc {rsv list} {{table tbl_reservation}} {
set res [$::rsvdb query "
proc {rsv list} {{table tbl_reservation} {extra ""}} {
set qstring "
select $table.*,
channel.TBL_SVC.szSvcName, channel.TBL_SVC.usLcn,
case when ersvtype > 3 then 1 else 0 end as sort1,
@@ -261,9 +300,15 @@ proc {rsv list} {{table tbl_reservation}} {
from $table
left join channel.TBL_SVC
on $table.hSvc = channel.TBL_SVC.hSvc
"
if {$extra ne ""} { append qstring $extra }
append qstring "
order by sort1, sort2 desc, nsttime
"]
"
#puts "QSTRING: ($qstring)"
set res [$::rsvdb query $qstring]
set records {}
foreach rec $res {
lappend records [rsv new $rec]

View File

@@ -23,6 +23,8 @@ class settings {
smtp_server ""
pkgdev 0
notoolbar 0
nomobile 0
xepghours 4
}
settings method hostname {{name ""}} {
@@ -101,6 +103,10 @@ settings method channel_group {{group -1}} {
return [$self _nval_setting channel_group $group]
}
settings method xepghours {{hours -1}} {
return [$self _nval_setting xepghours $hours]
}
settings method epg_style {{style -1}} {
if {$style != -1} {
if {$style eq "grid"} { set style 1 } else { set style 0}
@@ -121,6 +127,10 @@ settings method notoolbar {{val -1}} {
return [$self _nval_setting notoolbar $val]
}
settings method nomobile {{val -1}} {
return [$self _nval_setting nomobile $val]
}
settings method sortorder {{val -1}} {
return [$self _nval_setting sortorder $val]
}

View File

@@ -17,6 +17,14 @@ if {![exists -proc require]} {
uplevel source /mod/webif/html/lib/footer.jim
}
proc mheader {} {
uplevel source /mod/webif/html/m/lib/header.jim
}
proc mfooter {} {
uplevel source /mod/webif/html/m/lib/footer.jim
}
# Replace the built-in jim {file copy} command with one that is
# largefile safe.

View File

@@ -43,6 +43,16 @@ proc {system modversion} {{short 0}} {
return [format "%d.%d%d" $a $b $c]
}
proc {system modbuild} {} {
if {[catch {set fp [open /etc/modbuild r]}]} {
return 0
} else {
set modbuild [string trim [read $fp]]
close $fp
}
return $modbuild
}
proc {system fhtcpversion} {} {
set file "/etc/fhtcpversion"
if {![file exists $file]} { set file "/root/fhtcpversion" }
@@ -92,10 +102,12 @@ proc {system diskspace} {} {
set used 0
set free 0
set perc 0
set dev 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 dev [lindex $fields 0]
set size [lindex $fields 1]
set used [lindex $fields 2]
set free [lindex $fields 3]
@@ -105,7 +117,7 @@ proc {system diskspace} {} {
}
}
return [list $size $used $perc $free $fperc]
return [list $size $used $perc $free $fperc $dev]
}
proc {system busy} {} {

View File

@@ -23,6 +23,7 @@ class ts {
bookmarks 0
schedstart 0
scheddur 0
genre 0
}
ts method duration {{raw 0}} {
@@ -41,7 +42,8 @@ ts method _parse {line} {
lassign [split $line "\t"] \
title synopsis definition channel_num channel_name \
start end flags_list guidance bookmarks schedstart scheddur
start end flags_list guidance bookmarks schedstart scheddur \
genre
set flags [split [string range $flags_list 0 end-1] ,]
}
@@ -169,7 +171,23 @@ ts method settitle {newtitle} {
exec /mod/bin/hmt "+settitle=${newtitle}" $file
}
ts method dlnaloc {} {
ts method setsynopsis {newsynopsis} {
if {[string length newsynopsis] > 48} { return }
exec /mod/bin/hmt "+setsynopsis=${newsynopsis}" $file
}
ts method setguidance {newguidance} {
if {[string length newguidance] > 48} { return }
exec /mod/bin/hmt "+setguidance=${newguidance}" $file
}
ts method setgenre {newgenre} {
exec /mod/bin/hmt "+setgenre=-${newgenre}" $file
}
ts method dlnaloc {{urlbase 0}} {
set mime "video/ts"
if {![file exists $::dmsfile]} { return {} }
if {[catch {set db [sqlite3.open $::dmsfile]}]} { return {} }
@@ -185,7 +203,11 @@ ts method dlnaloc {} {
set rec [lindex $muri 0]
set xuri [lindex $rec 3]
set mime [lindex $rec 1]
set url "http://[system ip]:9000/web/$xuri"
if {$urlbase ne "0"} {
set url "http://$urlbase:9000/web/$xuri"
} else {
set url "http://[system ip]:9000/web/$xuri"
}
}
$db close