Compare commits

..

40 Commits

Author SHA1 Message Date
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
hummypkg
c149d7ae3c 0.9.14
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1151 2a923420-c742-0410-a762-8d5b09965624
2012-10-08 22:40:51 +00:00
hummypkg
38757583bb jquery update
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1150 2a923420-c742-0410-a762-8d5b09965624
2012-10-08 20:16:27 +00:00
hummypkg
dec82728cb remove remote code, now in plugin
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1139 2a923420-c742-0410-a762-8d5b09965624
2012-10-02 20:05:53 +00:00
hummypkg
49170bdd39 initial remote
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1138 2a923420-c742-0410-a762-8d5b09965624
2012-10-01 19:53:02 +00:00
hummypkg
1bf67cf177 tweaks
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1123 2a923420-c742-0410-a762-8d5b09965624
2012-09-21 20:56:53 +00:00
hummypkg
e669a3d08f update channelicons, add size check
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1122 2a923420-c742-0410-a762-8d5b09965624
2012-09-19 20:44:04 +00:00
hummypkg
39ed7752bc add paste to folder
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1113 2a923420-c742-0410-a762-8d5b09965624
2012-08-09 23:06:30 +00:00
hummypkg
e4f61f4047 many escaping fixes. Remove unecessary regsub/string match and replace with better alternatives
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1111 2a923420-c742-0410-a762-8d5b09965624
2012-08-07 22:22:30 +00:00
hummypkg
4e36ecc6f0 catch sort file stats
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1110 2a923420-c742-0410-a762-8d5b09965624
2012-08-07 20:25:13 +00:00
hummypkg
d2712f2a76 add diskspace check and remove escape
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1103 2a923420-c742-0410-a762-8d5b09965624
2012-08-04 21:42:02 +00:00
hummypkg
24d26aee75 update to 0.9.13
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1100 2a923420-c742-0410-a762-8d5b09965624
2012-08-04 00:29:57 +00:00
hummypkg
39b3dee3e1 add get_channel_attr_byorglcn
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1097 2a923420-c742-0410-a762-8d5b09965624
2012-07-21 19:47:23 +00:00
hummypkg
3d3f7d17ed update VLC player
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1092 2a923420-c742-0410-a762-8d5b09965624
2012-07-16 20:29:59 +00:00
hummypkg
89a68cf538 updates
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1081 2a923420-c742-0410-a762-8d5b09965624
2012-06-24 20:45:07 +00:00
hummypkg
51db7b1e36 fix stripped icon
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1070 2a923420-c742-0410-a762-8d5b09965624
2012-06-16 21:57:24 +00:00
hummypkg
9d8d630b07 add auto + better inuse checking
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1066 2a923420-c742-0410-a762-8d5b09965624
2012-06-15 21:34:07 +00:00
hummypkg
101f5a7946 working towards auto-\*
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1060 2a923420-c742-0410-a762-8d5b09965624
2012-06-13 23:21:34 +00:00
hummypkg
50346e5d4b strip->squeeze, depend on fixed tool
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1057 2a923420-c742-0410-a762-8d5b09965624
2012-06-13 21:09:44 +00:00
hummypkg
f0d22b3b01 new strip version
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1052 2a923420-c742-0410-a762-8d5b09965624
2012-06-11 18:49:56 +00:00
hummypkg
7356e6e220 add strip
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1046 2a923420-c742-0410-a762-8d5b09965624
2012-06-10 21:16:22 +00:00
hummypkg
7d1331f1aa add Humax version to main screen, fix shtml footer;
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1029 2a923420-c742-0410-a762-8d5b09965624
2012-06-03 20:12:31 +00:00
hummypkg
895dda6dee favourite order
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1020 2a923420-c742-0410-a762-8d5b09965624
2012-05-30 19:51:20 +00:00
hummypkg
d7284ff3ef 0.9.9
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1016 2a923420-c742-0410-a762-8d5b09965624
2012-05-21 20:23:41 +00:00
hummypkg
d04dcee369 add tbstatus
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1014 2a923420-c742-0410-a762-8d5b09965624
2012-05-20 15:05:48 +00:00
hummypkg
db4f7cf122 toolbar tweaks - redo status
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1011 2a923420-c742-0410-a762-8d5b09965624
2012-05-20 14:10:37 +00:00
hummypkg
015b992fcb fix browse link
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1010 2a923420-c742-0410-a762-8d5b09965624
2012-05-19 21:46:45 +00:00
286 changed files with 4991 additions and 1681 deletions

View File

@@ -1,9 +1,9 @@
Package: webif
Priority: optional
Section: web
Version: 0.9.8
Version: 0.10.1-1
Architecture: mipsel
Maintainer: af123@hummypkg.org.uk
Depends: webif-channelicons(>=1.0.1),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.1)
Suggests: ffmpeg,webif-iphone
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.7),ssmtp,anacron,trm,openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2),stripts(>=1.1.2),smartmontools,tmenu(>=1.02)
Suggests: ffmpeg
Description: An evolving web interface for the Humax.

View File

@@ -2,6 +2,18 @@
export tmpf=/tmp/cronf.$$
# Add cron jobs
crond=$PKG_ROOT/var/spool/cron/crontabs
[ -d $crond ] || exit 1
cronf=$crond/root
grep -v webif/lib/bin/auto $cronf > $tmpf
(
cat $tmpf
echo '*/10 * * * * /mod/webif/lib/bin/auto >> /tmp/webif_auto.log 2>&1'
) > $cronf
# Add anacron jobs
ana=$PKG_ROOT/etc/anacrontab

View File

@@ -2,6 +2,13 @@
export tmpf=/tmp/cronf.$$
cronf=$PKG_ROOT/var/spool/cron/crontabs/root
if [ -f $cronf ]; then
grep -v webif/lib/bin/auto $cronf > $tmpf
cp $tmpf $cronf
[ -s $cronf ] || rm -f $cronf
fi
ana=/mod/etc/anacrontab
grep -v 'backup/backup.jim' $ana > $tmpf
cp $tmpf $ana

1
bin/status Symbolic link
View File

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

View File

@@ -1,7 +1,7 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require rsv.class
@@ -68,16 +68,17 @@ set grp 0
foreach res [$rsvdb query {
select eFavGroup,
TBL_FAV.eSvcType,
substr(szSvcName, 2) as szSvcName
substr(szSvcName, 2) as szSvcName,
favIdx
from TBL_FAV join TBL_SVC using (hSvc)
order by eFavGroup
order by eFavGroup, favIdx
}] {
if {$res(eFavGroup) != $grp} {
set grp $res(eFavGroup)
puts " Group $grp"
}
puts " $res(szSvcName)"
puts $fd "fav\t$res(eFavGroup)\t$res(eSvcType)\t$res(szSvcName)"
puts $fd "fav\t$res(eFavGroup)\t$res(eSvcType)\t$res(szSvcName)\t$res(favIdx)"
}
puts "Done."

View File

@@ -7,6 +7,8 @@ function refresh_files()
.button('option', 'disabled', false);
$('#delete_button').removeAttr('disabled')
.button('option', 'disabled', false);
$('#view_button').removeAttr('disabled')
.button('option', 'disabled', false);
});
});
}
@@ -38,6 +40,15 @@ $(document).ready(function() {
});
}
});
$('#view_button').click(function() {
var backup = $('input.restore:checked').val();
$('#results').load('/cgi-bin/backup/view.jim?' +
$('input.restore').serialize(), function() {
$('#results').slideDown(function() {
refresh_files();
});
});
});
$('#restore_button').click(function() {
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 + '?'))

View File

@@ -1,7 +1,7 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
set dir /mod/var/backup

View File

@@ -1,7 +1,7 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require rsv.class findhsvc system.class
@@ -108,6 +108,8 @@ foreach line $data {
set group [lindex $vals 1]
set type [lindex $vals 2]
set chan [lindex $vals 3]
set idx [lindex $vals 4]
if {$idx eq ""} { set idx 0 }
set hsvc [get_channel_attr $chan]
if {$grp != $group} {
@@ -123,8 +125,8 @@ foreach line $data {
}
set query "
insert into pending.fav(hSvc, eFavGroup, eSvcType)
values($hsvc, $group, $type);
insert into pending.fav(favIdx, hSvc, eFavGroup, eSvcType)
values($idx, $hsvc, $group, $type);
"
$rsvdb query $query

View File

@@ -0,0 +1,60 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
require rsv.class findhsvc
set dir /mod/var/backup
puts "Content-Type: text/html"
puts ""
cgi_input
#cgi_dump
#set _cgi(restore_file) "backup-2011-Jul-09-20:37"
if {![dict exists $_cgi restore_file]} {
puts "No filename supplied."
exit
}
set file [file tail [dict get $_cgi restore_file]]
set ffile "/$dir/$file.rbk"
if {![file exists $ffile]} {
puts "Backup file <i>$file</i> does not exist."
exit
}
if {[catch { set fd [open $ffile r] } msg]} {
puts "Error opening <i>$file</i> - $msg"
exit
}
puts "Listing scheduled events from <i>$file</i>..."
set fields [lsort [[rsv] vars]]
set data [split [read $fd] "\n"]
foreach line $data {
set vals [split $line "\t"]
if {[lindex $vals 0] ne "event"} { continue }
set vars {}
set i 0
foreach f $fields {
if {$f eq "aulEventToRecordInfo"} { continue }
incr i
lappend vars $f [lindex $vals $i]
}
set rsv [rsv new $vars]
puts " [$rsv name] ([$rsv channel_name])"
}
close $fd
rsv cleanup

View File

@@ -1,8 +1,8 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
require ts.class pretty_size system.class settings.class escape
source /mod/webif/lib/setup
require ts.class pretty_size system.class settings.class escape browse.class
puts "Content-Type: text/html"
puts ""
@@ -33,18 +33,15 @@ if {$order eq "-"} {
set model [system model]
set dustbin [system dustbin 1]
proc icon {img {hover ""} {extra ""}} {
puts -nonewline "<img src=$img class=va height=21 $extra"
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} {
global flatten
regsub -all " +" $bfile "" tbfile
proc directory {file bfile tbfile} {
puts "<div class=va>"
set img "/images/711_1_09_Media_Folder.png"
if {$bfile eq $::dustbin} { set img "/img/Dustbin_Folder.png" }
@@ -56,17 +53,14 @@ proc directory {file bfile} {
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
puts [join $icons ""]
puts -nonewline "
<a href=#>
<img class=\"dopt va\" border=0 width=45 "
if $flatten { puts -nonewline "noflat=$noflat " }
puts -nonewline [join $attrs " "]
puts "
src=/images/181_1_00_Help5_OPT_Plus.png>
</a>
@@ -80,15 +74,16 @@ proc directory {file bfile} {
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
continue
directory $file $bfile $tbfile
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)
@@ -100,16 +95,19 @@ proc entry {file} {{i 0}} {
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
@@ -187,6 +185,13 @@ proc entry {file} {{i 0}} {
set dlna 1
}
# Shrunk (shown when necessary via Ajax)
icon "/img/compress.png" "Shrunk" \
"id=\"sp_$tbfile\"" "va hidden"
# Timeshifted (shown when necessary via Ajax)
icon "/img/clock.png" "Time-shifted Recording" \
"id=\"tsr_$tbfile\"" "va hidden"
set bx [$ts get bookmarks]
}
@@ -194,7 +199,7 @@ proc entry {file} {{i 0}} {
puts "
<a href=#>
<img class=\"opt va\" border=0 width=45 type=$type did=$i
<img class=\"$omenu va\" border=0 width=45 type=$type did=$i
locked=$locked encd=$encd def=$def new=$new bx=$bx
rsize=$rsz
odencd=$odencd dlna=$dlna
@@ -222,7 +227,7 @@ puts {
<link type=text/css rel=stylesheet href=/cgi-bin/browse/style.css />
}
source /mod/var/mongoose/cgi-bin/browse/assets.jim
source browse/assets.jim
puts "
<span style=\"display:none\" id=dir>$dir</span>
@@ -269,9 +274,9 @@ proc s_time {a b} {
return 0
}
file stat $a l
if {[catch {file stat $a l}]} { return 0}
set at $l(ctime)
file stat $b l
if {[catch {file stat $b l}]} { return 0}
set bt $l(ctime)
if {$at < $bt} { return -1 }
@@ -354,6 +359,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

@@ -14,7 +14,10 @@ puts {
}
if {$model eq "HDR"} {
puts { <li class="separator"><a href=#decrypt>Decrypt</a></li> }
puts { <li class="separator decrypt"><a href=#decrypt>Decrypt</a></li> }
puts { <li class="compress"><a href=#strip>Shrink</a></li> }
} else {
puts { <li class="compress separator"><a href=#strip>Shrink</a></li> }
}
if {[system pkginst ffmpeg]} {
puts {
@@ -33,14 +36,28 @@ puts {
<li><a href=#new>Toggle New</a></li>
</ul>
<ul id=doptmenu class=contextMenu style="width: 160px">
<ul id=ooptmenu class=contextMenu style="width: 160px">
<li class=delete><a href=#delete>Delete</a></li>
<li class=cut><a href=#cut>Cut to clipboard</a></li>
<li class=pwcopy><a href=#copy>Copy to clipboard</a></li>
<li class=separator><a href=#rename>Rename</a></li>
<li><a href=#download>Download</a></li>
</ul>
<ul id=doptmenu class=contextMenu style="width: 180px">
<li class=delete><a href=#delete>Delete</a></li>
<li class=cut><a href=#cut>Cut to clipboard</a></li>
<li class=pwcopy><a href=#copy>Copy to clipboard</a></li>
<li class=pwpaste><a href=#paste>Paste to folder</a></li>
<li class=separator><a href=#rename>Rename</a></li>
<li class=separator><a href=#resetnew>Reset new flag</a></li>
<li class="separator compress"><a href=#shrink>Auto-Shrink</a></li>
<li class=dedup><a href=#dedup>Auto-Dedup</a></li>
}
if {$model eq "HDR"} {
puts { <li class=decrypt><a href=#decrypt>Auto-Decrypt</a></li> }
}
if $flatten {
puts { <li class="separator"><a href=#flat>No-Flatten</a></li> }
}
@@ -50,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>
@@ -65,21 +81,46 @@ 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>
</table>
</form>
</div>

View File

@@ -2,7 +2,7 @@
package require sqlite3
package require cgi
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require ts.class system.class
puts "Content-Type: text/html\r\n\r\n"

View File

@@ -2,7 +2,7 @@
package require sqlite3
package require cgi
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require ts.class system.class
puts "Content-Type: text/html\r\n\r\n"

View File

@@ -1,7 +1,7 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require ts.class
puts "Content-Type: text/html\r\n\r\n"

View File

@@ -6,6 +6,21 @@ function disableall()
$('button,a,input').disable();
}
function pastedialogue()
{
$('#pwdialogue').dialog({
title: "Pasting from clipboard",
modal: true, autoOpen: true,
height: 'auto', width: 'auto',
show: 'scale', hide: 'fade',
draggable: false, resizable: false,
closeOnEscape: false,
open: function() {
$('.ui-dialog-titlebar-close').hide();
}
});
}
function reloadclipboard()
{
$('#clipboard')
@@ -16,9 +31,15 @@ function reloadclipboard()
// Start Clipboard post-load actions
if ($('#clipclear').length)
{
$('#paste').enable();
$('#doptmenu').enableContextMenuItems('#paste');
}
else
{
$('#paste').disable();
$('#doptmenu').disableContextMenuItems('#paste');
}
$('#clipclear').button().click(function() {
$.get('/cgi-bin/browse/clipboard.jim?act=clear', function() {
@@ -36,17 +57,7 @@ $('a.clipdel').click(function() {
$('#paste').button()
.click(function() {
disableall();
$('#pwdialogue').dialog({
title: "Pasting from clipboard",
modal: true, autoOpen: true,
height: 'auto', width: 'auto',
show: 'scale', hide: 'fade',
draggable: false, resizable: false,
closeOnEscape: false,
open: function() {
$('.ui-dialog-titlebar-close').hide();
}
});
pastedialogue();
$('#pwfeedback').load(
'/cgi-bin/browse/clipboard.jim?act=paste&dir='
+ encodeURIComponent(dir), function() {
@@ -63,19 +74,16 @@ $('#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);
$('#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');
}
@@ -84,10 +92,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)
@@ -112,6 +124,24 @@ function new_folder_callback(data, status, xhr)
$.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);
}
function delete_callback(file, dir, id)
{
var el = 'div.bf#' + id;
@@ -150,7 +180,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); });
}
@@ -218,6 +248,13 @@ function preparemenu(el, menu)
else
$(menu).disableContextMenuItems('#crop');
/*
if (el.attr('def') == 'HD')
$(menu).disableContextMenuItems('#strip');
else
*/
$(menu).enableContextMenuItems('#strip');
if (el.attr('rsize') > 4294967296)
$(menu).enableContextMenuItems('#chunk');
else
@@ -242,7 +279,8 @@ function preparemenu(el, menu)
$(menu).enableContextMenuItems('#delete');
}
if (el.attr('odencd') == 1 && el.attr('dlna') == 1)
if (el.attr('odencd') == 1 && el.attr('dlna') == 1 &&
el.attr('encd') == 0)
$(menu).enableContextMenuItems('#decrypt');
else
$(menu).disableContextMenuItems('#decrypt');
@@ -264,11 +302,6 @@ function preparemenu(el, menu)
$(menu).disableContextMenuItems('#lock');
//$(menu).disableContextMenuItems('#enc');
$(menu).disableContextMenuItems('#new');
$(menu).disableContextMenuItems('#decrypt');
$(menu).disableContextMenuItems('#audio');
$(menu).disableContextMenuItems('#mpg');
$(menu).disableContextMenuItems('#crop');
$(menu).disableContextMenuItems('#chunk');
}
}
@@ -283,6 +316,33 @@ function preparedmenu(el, menu)
$(menu).changeContextMenuItem('#flat',
'Prevent Flatten');
}
if (el.attr('autoshrink') != undefined)
{
if (el.attr('autoshrink') > 0)
$(menu).changeContextMenuItem('#shrink',
'Disable Auto-shrink');
else
$(menu).changeContextMenuItem('#shrink',
'Enable Auto-shrink');
}
if (el.attr('autodedup') != undefined)
{
if (el.attr('autodedup') > 0)
$(menu).changeContextMenuItem('#dedup',
'Disable Auto-dedup');
else
$(menu).changeContextMenuItem('#dedup',
'Enable Auto-dedup');
}
if (el.attr('autodecrypt') != undefined)
{
if (el.attr('autodecrypt') > 0)
$(menu).changeContextMenuItem('#decrypt',
'Disable Auto-decrypt');
else
$(menu).changeContextMenuItem('#decrypt',
'Enable Auto-decrypt');
}
}
$(document).ready(function() {
@@ -331,11 +391,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')
@@ -349,7 +409,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':
@@ -357,6 +418,11 @@ var menuclick = function(action, el, pos)
file;
break;
case 'strip':
window.location.href = '/cgi-bin/browse/strip/strip.jim?file=' +
file;
break;
case 'chunk':
window.location.href = '/cgi-bin/browse/chunk/chunk.jim?file=' +
file;
@@ -393,6 +459,16 @@ var dmenuclick = function(action, el, pos)
switch (action)
{
case 'paste':
pastedialogue();
$('#pwfeedback').load(
'/cgi-bin/browse/clipboard.jim?act=paste&dir=' +
file, function() {
$('#pwdialogue').dialog('close');
reloadclipboard();
});
break;
case 'delete':
if (confirm('Are you sure you wish to delete "' +
@@ -432,7 +508,26 @@ var dmenuclick = function(action, el, pos)
break;
case 'flat':
var url = '/cgi-bin/browse/flat.jim?dir=' + file;
var url = '/cgi-bin/browse/flagdir.jim?dir=' + file +
'&flag=noflatten';
$.get(url, function() { window.location.reload(true); });
break;
case 'dedup':
var url = '/cgi-bin/browse/flagdir.jim?dir=' + file +
'&flag=autodedup';
$.get(url, function() { window.location.reload(true); });
break;
case 'shrink':
var url = '/cgi-bin/browse/flagdir.jim?dir=' + file +
'&flag=autoshrink';
$.get(url, function() { window.location.reload(true); });
break;
case 'decrypt':
var url = '/cgi-bin/browse/flagdir.jim?dir=' + file +
'&flag=autodecrypt';
$.get(url, function() { window.location.reload(true); });
break;
@@ -457,6 +552,16 @@ var dmenuclick = function(action, el, pos)
menuclick
);
// Bind context menu to opt+ image
$('img.oopt').contextMenu(
{
menu: 'ooptmenu',
leftButton: true,
beforeShow: preparemenu
},
menuclick
);
$('img.dopt').contextMenu(
{
menu: 'doptmenu',
@@ -495,7 +600,7 @@ var dmenuclick = function(action, el, pos)
disableall();
window.location = '/cgi-bin/browse/play.jim?' +
window.location = '/play/play.jim?' +
'dir=' + encodeURIComponent(dir) +
'&file=' + file;
}
@@ -574,6 +679,10 @@ var dmenuclick = function(action, el, pos)
$.getJSON('/cgi-bin/browse/sizes.jim?dir=' + encodeURIComponent(dir),
folder_size_callback);
// Flag shrunk recordings
$.getJSON('/cgi-bin/browse/shrunk.jim?dir=' + encodeURIComponent(dir),
shrunk_callback);
// Flag folders with unwatched items
$.getJSON('/cgi-bin/browse/newdir.jim?dir=' + encodeURIComponent(dir),
new_folder_callback);
@@ -710,5 +819,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

@@ -1,7 +1,7 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require ts.class pretty_size
puts "Content-Type: text/html\r\n\r\n"

View File

@@ -1,7 +1,7 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require ts.class pretty_size
puts "Content-Type: text/html\r\n\r\n"

View File

@@ -1,7 +1,7 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require ts.class
puts "Content-Type: text/html\r\n\r\n"

View File

@@ -1,7 +1,7 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require clipboard.class ts.class
puts "Content-Type: text/html; no-cache"
@@ -59,7 +59,7 @@ switch $action {
set mode [cgi_get mode copy]
foreach p $path {
set p [cgi_unquote_input $p]
if {$dir ne "0" && ![string match "$dir/*" $p]} {
if {$dir ne "0" && [string first "$dir/" $p] != 0} {
puts "$p not in directory<br>"
continue
}
@@ -95,21 +95,27 @@ switch $action {
catch {puts [exec /mod/bin/busybox/cp -r \
$path $dir]}
}
} else {
set root [file rootname $path]
# Protect special characters in root.
# In particular [] characters which are used a lot
# for torrent names.
regsub -all {([\\["$])} $root {\\\1} root
foreach f [glob -nocomplain "${root}.*"] {
if {$mode eq "cut"} {
catch {file rename $f \
"$dir/[file tail $f]"}
} else {
catch {file copy $f \
"$dir/[file tail $f]"}
} elseif {[string match {*.ts} $path]} {
set ts [ts fetch $path]
if {![catch {$ts get file}]} {
foreach f [$ts fileset] {
if {$mode eq "cut"} {
catch {file rename $f \
"$dir/[file tail $f]"}
} else {
catch {file copy $f \
"$dir/[file tail $f]"}
}
}
}
} else {
if {$mode eq "cut"} {
catch {file rename $path \
"$dir/[file tail $path]"}
} else {
catch {file copy $path \
"$dir/[file tail $path]"}
}
}
}
$cb clear

View File

@@ -1,7 +1,7 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require ts.class pretty_size
puts "Content-Type: text/html\r\n\r\n"

View File

@@ -1,8 +1,8 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
require ts.class pretty_size
source /mod/webif/lib/setup
require ts.class pretty_size system.class
puts "Content-Type: text/html\r\n\r\n"
@@ -10,6 +10,12 @@ cgi_input
#cgi_dump
set rfile [cgi_get file]
if {[system inuse $rfile]} {
puts "This file is in use. Cannot process at the moment."
exit
}
set ts [ts fetch $rfile]
set dir [file dirname $rfile]

View File

@@ -1,7 +1,7 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require ts.class
puts "Content-Type: text/html\r\n\r\n"

View File

@@ -2,7 +2,7 @@
package require sqlite3
package require cgi
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require ts.class
puts "Content-Type: text/html\r\n\r\n"

View File

@@ -2,8 +2,8 @@
package require sqlite3
package require cgi
source /mod/var/mongoose/lib/setup
require ts.class
source /mod/webif/lib/setup
require ts.class system.class
puts "Content-Type: text/html\r\n\r\n"
@@ -22,6 +22,11 @@ if {$url eq ""} {
exit
}
if {[system inuse $rfile]} {
puts "This file is in use. Cannot decrypt at the moment."
exit
}
set xstart [clock milliseconds]
set base [file rootname $rfile]

View File

@@ -1,7 +1,7 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require ts.class
puts "Content-Type: text/html\r\n\r\n"

View File

@@ -1,7 +1,7 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require ts.class pretty_size system.class tdelete
puts "Content-Type: text/html\r\n"
@@ -10,7 +10,6 @@ cgi_input
#cgi_dump
set dir [cgi_get dir]
regsub -all {([\\["$])} $dir {\\\1} dir
#puts "DIR: ($dir)"
@@ -40,7 +39,7 @@ foreach file [cgi_get files] {
puts -nonewline "<li>\"$file\"..."
if {![string match "$dir/*" $file]} {
if {[string first "$dir/" $file] != 0} {
puts "Error - outside directory."
continue
}
@@ -56,10 +55,8 @@ foreach file [cgi_get files] {
puts -nonewline "Directory..."
if {$ldustbin ne ""} {
set ndir "[bindir $file]/[file tail $file]"
if {$force} {
while {[file isdirectory $ndir]} {
append ndir "_"
}
while {[file isdirectory $ndir]} {
append ndir "_"
}
file rename $file $ndir
touch $ndir

View File

@@ -2,7 +2,7 @@
package require cgi
package require sqlite3
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require ts.class
#puts "Content-Type: text/plain\r\n\r\n"
@@ -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

@@ -1,7 +1,7 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/ts.class
source /mod/webif/lib/ts.class
puts "Content-Type: text/html"
puts ""

View File

@@ -1,7 +1,7 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/ts.class
source /mod/webif/lib/ts.class
puts "Content-Type: application/json"
puts ""
@@ -17,6 +17,7 @@ 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 "}"

View File

@@ -10,7 +10,7 @@ cgi_input
if [file exists /mod/bin/ffmpeg] {
set file [dict get $_cgi file]
puts [exec /mod/var/mongoose/lib/ffmpeg -i $file]
puts [exec /mod/webif/lib/bin/ffmpeg -i $file]
} else {
puts "Install ffmpeg package for more information..."
}

View File

@@ -1,7 +1,8 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/pretty_size
source /mod/webif/lib/setup
require pretty_size
puts "Content-Type: text/html"
puts ""
@@ -20,8 +21,7 @@ file stat $file st
set sz [pretty_size $st(size)]
if {$type eq "ts"} {
source /mod/var/mongoose/lib/epg.class
source /mod/var/mongoose/lib/ts.class
require epg.class ts.class
set ts [ts fetch $file]
@@ -91,6 +91,23 @@ if {$url ne ""} {
<td><a href=\"$url\">$url</a></td>"
}
puts "
</tr><tr>
<th>Files</th>
<td>
"
set fileset [$ts fileset]
puts -nonewline "<img id=xfileset class=va src=/img/tree/plusonly.png>"
puts -nonewline "[llength $fileset] file"
if {[llength $fileset] != 1} { puts -nonewline "s" }
puts -nonewline " in set."
puts "<div id=fileset class=hidden><ul>"
foreach f $fileset {
puts "<li>[file tail $f] ([pretty_size [file size $f]])</li>"
}
puts "</ul></div>"
puts "</td>
</tr><tr>
<th>Flags</th>
<td>[$ts get flags]
@@ -101,6 +118,18 @@ if {[$ts get bookmarks]} {
puts "</tr>"
puts "</table>"
puts {
<script type=text/javascript>
$('#xfileset').click(function() {
$('#fileset').slideToggle('slow', function() {
if ($('#fileset').is(':visible'))
$('#xfileset').attr('src', '/img/tree/minustop.png');
else
$('#xfileset').attr('src', '/img/tree/plusonly.png');
});
});
</script>
}
exit
}

View File

@@ -0,0 +1,22 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
puts "Content-Type: text/html"
puts ""
cgi_input
#cgi_dump
set dir [cgi_get dir]
set flag [cgi_get flag]
if {![file isdirectory $dir]} { exit }
if {[file exists "$dir/.$flag"]} {
file delete "$dir/.$flag"
puts "Unflagged directory as $flag."
} else {
close [open "$dir/.$flag" w]
puts "Flagged directory as $flag."
}

View File

@@ -1,28 +0,0 @@
#!/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]
if {![file isdirectory $dir]} { exit }
set noflat 0
if {[string match {\[*\]} [file tail $dir]]} {
set ndir [string range [file tail $dir] 1 end-1]
file rename $dir "[file dirname $dir]/$ndir"
puts "Unflagged directory as noflatten."
exit
}
if {[file exists "$dir/.noflatten"]} {
file delete "$dir/.noflatten"
puts "Unflagged directory as noflatten."
} else {
close [open "$dir/.noflatten" w]
puts "Flagged directory as noflatten."
}

View File

@@ -1,7 +1,7 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require ts.class pretty_size
puts "Content-Type: text/html\r\n\r\n"

View File

@@ -1,7 +1,7 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require ts.class pretty_size
puts "Content-Type: text/html\r\n\r\n"

View File

@@ -1,7 +1,7 @@
#!/mod/bin/jimsh
package require cgi
#source /mod/var/mongoose/lib/setup
#source /mod/webif/lib/setup
puts "Content-Type: text/html\r\n\r\n"

View File

@@ -1,7 +1,8 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/ts.class
source /mod/webif/lib/setup
require ts.class
puts "Content-Type: text/html"
puts ""

View File

@@ -2,7 +2,7 @@
package require sqlite3
package require cgi
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require ts.class system.class
puts "Content-Type: text/html\r\n\r\n"

View File

@@ -2,7 +2,7 @@
package require sqlite3
package require cgi
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require ts.class system.class
puts "Content-Type: text/html\r\n\r\n"

View File

@@ -1,7 +1,7 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require ts.class
puts "Content-Type: text/html\r\n\r\n"

View File

@@ -1,7 +1,7 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require ts.class
puts "Content-Type: text/html"

View File

@@ -1,7 +1,8 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/ts.class
source /mod/webif/lib/setup
require ts.class
puts "Content-Type: text/html"
puts ""
@@ -9,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} {
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

@@ -2,7 +2,7 @@
package require cgi
package require pack
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require ts.class hexdump
puts "Content-Type: text/html"

View File

@@ -1,7 +1,8 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/ts.class
source /mod/webif/lib/setup
require ts.class
puts "Content-Type: text/html"
puts ""

View File

@@ -0,0 +1,27 @@
#!/mod/bin/jimsh
package require cgi
#puts "Content-Type: text/plain"
puts "Content-Type: application/json"
puts ""
cgi_input
#cgi_dump
set dir [cgi_get dir "/media/My Video/Children"]
puts "{"
foreach file [readdir -nocomplain $dir] {
if {![string match {*.ts} $file]} { continue }
set xfile [file rootname $file]
if {[catch {set eit [exec /mod/bin/stripts -cq "$dir/$xfile"]}]} {
continue
}
puts " \"$file\": $eit,"
}
puts " \"dummy\": 0"
puts "}"

View File

@@ -12,19 +12,20 @@ cgi_input
#set _cgi(dir) "/media/My Video"
set dir [dict get $_cgi dir]
set dlen [string length "$dir/"]
#9.4G /media/My Video/Archive
#1.4G /media/My Video/CSI_ Crime Scene Investigation
puts "{"
regsub -all {([\\["$])} $dir {\\\1} xdir
foreach line [split [exec /mod/bin/busybox/du -h -d 1 "$dir/"] "\n"] {
lassign [split $line "\t"] size node
regsub -- "^$xdir/" $node "" node
set node [string range $node $dlen end]
puts "\"$node\" : \"$size\","
}
# Handle symbolic links.
foreach file [glob -nocomplain "$dir/*"] {
foreach file [readdir $dir] {
set file "$dir/$file"
if {[catch {set lk [file readlink $file]}]} continue
if {![string match "/*" $lk]} { set lk "$dir/$lk" }

View File

@@ -0,0 +1,16 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
require ts.class pretty_size
puts "Content-Type: text/html\r\n\r\n"
cgi_input
#cgi_dump
set rfile [cgi_get file]
set base [file rootname $rfile]
puts [exec /mod/bin/stripts -aq $base]

View File

@@ -0,0 +1,52 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
require ts.class pretty_size
puts "Content-Type: text/html\r\n\r\n"
cgi_input
#cgi_dump
set rfile [cgi_get file]
set ts [ts fetch $rfile]
set dir [file dirname $rfile]
set len [$ts duration 1]
set stripstart [clock milliseconds]
set base [file rootname $rfile]
set origdir "$dir/_original"
if {![file exists $origdir]} { file mkdir $origdir }
set shname [file tail $base]
puts "Processing $shname"
if {[file exists "$origdir/$shname.ts"]} {
puts "This recording already exists within _original"
puts "Cannot continue."
exit
}
puts "Moving recording to $origdir"
foreach f [glob -nocomplain "${base}.*"] {
set tail [file tail $f]
puts " $tail"
file rename $f "$origdir/$tail"
}
puts [exec /mod/bin/stripts \
"$origdir/$shname" \
"$dir/$shname" \
]
set newname "$shname-[clock seconds]"
puts "Renaming file group to $newname"
ts renamegroup "$dir/$shname.ts" $newname
exec /mod/bin/hmt "+setfilename=$newname" "$dir/$newname.hmt"
set striptime [expr [expr [clock milliseconds] - $stripstart] / 1000.0]
puts "Time taken: $striptime"

View File

@@ -0,0 +1,27 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
require ts.class
puts "Content-Type: text/html\r\n\r\n"
cgi_input
#cgi_dump
set tsfile [file normalize [cgi_get file]]
set ntsfile "[file rootname $tsfile].nts"
set origfile "[file dirname $tsfile]/_original/[file tail $ntsfile]"
if {![file exists $ntsfile]} {
puts "0"
} else {
set sz [file size $origfile]
set nsz [file size $ntsfile]
set perc [expr $nsz * 100 / $sz]
if {$perc > 100} { set perc 100 }
puts $perc
}

View File

@@ -0,0 +1,66 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
require ts.class pretty_size
puts "Content-Type: text/html\r\n\r\n"
cgi_input
#cgi_dump
set rfile [cgi_get file]
set ts [ts fetch $rfile]
set dir [file dirname $rfile]
set len [$ts duration 1]
set esttime $([$ts size] / 5700000)
header
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 src=strip.js></script>
<fieldset class=cleft>
<legend>Make recordings smaller by removing unecessary frames</legend>
<p><i>This process will remove freeview EPG data from the recording.<br>
These data are not required and can increase the size of the
recording file by as much as 20%.<br>
Your original recording files will be retained in a folder called _original.
</i>
<table class=keyval cellpadding=5>
<tr><th>File:</th><td>$rfile</td></tr>
<tr><th>Length:</th><td>[clock format $len -format %T]</td></tr>
<tr><th>Size:</th><td>[pretty_size [$ts size]] ([$ts get definition])</td></tr>
<tr><th>Time:</th>
<td>Shrinking will take around [clock format $esttime -format "%T"]</td></tr>
<tr><th>Estimated Saving:</th>
<td class=va><span id=analysis class=va>
<img class=va src=/img/loading.gif> Analysing file, please wait...
</span></td></tr>
</table>
<span class=hidden id=params
file=\"[cgi_quote_url $rfile]\"
dir=\"[cgi_quote_url $dir]\"
></span>
<div id=stripdiv class=hidden style=\"padding: 1em\">
<button id=stripit>Shrink recording</button>
</div>
<div id=progressdiv class=hidden>
Shrinking: <div id=progressbar></div>
</div>
<button id=back class=hidden>Back to media list</button>
<div id=output class=pre style=\"margin-top: 10px\"></div>
</fieldset>
"

View File

@@ -0,0 +1,48 @@
var handle = 0;
function update()
{
var file = $('#params').attr('file');
$.get('progress.jim' + '?file=' + file,
function(data) {
if (handle)
$('#progressbar').reportprogress(data);
});
}
$(document).ready(function() {
$('#analysis').load('analyse.jim?file=' + $('#params').attr('file'),
function(t) {
if ($.trim(t) == '0%')
{
$('#output').text('Recording is already stripped.');
$('#back').slideDown();
}
else
$('#stripdiv').slideDown();
});
$('#progressbar').reportprogress(0);
$('#back').button().click(function() {
window.location = '/cgi-bin/browse.jim?dir=' + $('#params').attr('dir');
});
$('#stripit').button().click(function() {
$('#stripdiv').hide('slow');
$('#progressdiv').show('slow');
handle = setInterval("update()", 1000);
$('#output').text('Please do not interrupt...')
.load('execute.jim?file=' + $('#params').attr('file'),
function() {
clearInterval(handle);
handle = 0;
$('#back').show();
$('#progressbar').reportprogress(100);
});
});
});

View File

@@ -1,7 +1,7 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require system.class chunked pretty_size
cgi_input

View File

@@ -1,7 +1,13 @@
#!/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
touch /var/lib/humaxtv/.rma
else
touch /var/lib/humaxtv/mod/_RESET_CUSTOM_FIRMWARE_ENVIRONMENT
fi

View File

@@ -2,7 +2,7 @@
package require cgi
package require sqlite3
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require altrow progressbar epg.class
puts "Content-Type: text/html"

View File

@@ -2,7 +2,7 @@
package require cgi
package require sqlite3
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require altrow
puts "Content-Type: text/html"

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

@@ -1,7 +1,7 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require epg.class
puts "Content-Type: text/html"

View File

@@ -1,7 +1,7 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require epg.class
puts "Content-Type: text/html"

View File

@@ -1,7 +1,7 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require epg.class system.class
puts "Content-Type: text/html"

View File

@@ -1,7 +1,7 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require epg.class spinner.class altrow
puts "Content-Type: text/html"
@@ -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

@@ -1,7 +1,7 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require epg.class spinner.class altrow
puts "Content-Type: text/html"
@@ -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

@@ -1,7 +1,7 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require pkg.class chunked
cgi_input
@@ -11,7 +11,7 @@ set cmd [cgi_get cmd update]
proc opkg {cmd} {
chunk ">>> opkg $cmd\r\n"
set bcmd "|/mod/var/mongoose/lib/opkg $cmd"
set bcmd "|/mod/webif/lib/bin/opkg $cmd"
set fd [open $bcmd r]
while {[gets $fd line] >= 0} {
chunk "$line\r\n"
@@ -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

@@ -1,7 +1,7 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require rsv.class system.class
puts "Content-Type: text/html"

View File

@@ -3,5 +3,5 @@
puts "Content-Type: text/html"
puts ""
source /mod/var/mongoose/include/restart.jim
source /mod/webif/include/restart.jim

View File

@@ -1,9 +1,8 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
require settings.class
require plugin
source /mod/webif/lib/setup
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]
@@ -29,6 +39,8 @@ set smtp_server [$settings smtp_server]
set channel_group [$settings channel_group]
set epg_style [$settings epg_style]
set pkgdev [$settings pkgdev]
set notoolbar [$settings notoolbar]
set nomobile [$settings nomobile]
# Handle updates
@@ -65,6 +77,8 @@ _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"
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 "-"]
@@ -140,6 +154,43 @@ puts ">
</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 -nonewline "
<tr>
<th class=key>Slide-down toolbar?</th>
<td><input id=toolbar_toggle name=toolbar type=checkbox value=yes"
if {$notoolbar == 0} { puts -nonewline " checked" }
puts ">
<div id=toolbar_output></div>
</td>
</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)>

View File

@@ -24,13 +24,15 @@ $(document).ready(function () {
$(":checkbox").iphoneStyle();
$('form.auto').each(function(i, el) {
var id = $(this).attr('id');
var output = '#' + id + '_output'
var output = '#' + id + '_output';
$(this).ajaxForm({
target: output,
success: function() {
$(output).css('font-style', 'italic');
$(output).show('slow');
$(output).delay(2000).fadeOut('slow');
$(output)
.css('font-style', 'italic')
.show('slow')
.delay(2000)
.fadeOut('slow');
}
});
});
@@ -73,5 +75,63 @@ $(document).ready(function () {
.delay(2000).fadeOut('slow');
});
});
$('#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'))
arg = '0';
$(this).disable();
$('#toolbar_output')
.empty()
.show('slow')
.load('/cgi-bin/settings.jim?notoolbar=' + arg,
function() {
$('#toolbar_toggle').enable();
$('#toolbar_output')
.css('font-style', 'italic')
.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,10 +1,27 @@
#!/mod/bin/jimsh
source /mod/var/mongoose/lib/setup
require system.class findhsvc epg.class
package require cgi
source /mod/webif/lib/setup
require system.class findhsvc epg.class rsv.class
puts "Content-Type: text/html"
puts ""
set runmode cli
if {[string match {*jim} $argv0]} { set runmode cgi }
set schedtime 900
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."
@@ -38,9 +55,14 @@ 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 2
sleep 3
set ndata [get_data]
foreach name [array names ndata] {
if {![dict exists $seen $name]} { set seen($name) 0 }
@@ -62,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"
}
}
}
@@ -92,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

@@ -1,7 +1,7 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
puts "Content-Type: text/html"
puts ""
@@ -11,25 +11,29 @@ 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
}
set favlist [epg favlist]
set favgroup [[settings] channel_group]
set hours 4.0
set seconds $($hours * 3600)
@@ -40,7 +44,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)
@@ -51,28 +55,54 @@ set secpx $($minpx / 60.0)
set start [clock milliseconds]
if {$::qepg} {
set records [epg dbfetch dump -trange "$stt:$ett"]
if {$favgroup} {
set records [epg dbfetch dump \
-trange "$stt:$ett" -fav $favgroup]
} else {
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>"
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 "<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>"
@@ -87,9 +117,6 @@ 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 }
@@ -170,6 +197,9 @@ puts "
Switch to standard now/next display.
</button></small>
</div>
"
puts "
<script type=text/javascript>
\$(document).ready(function() {
@@ -177,12 +207,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} {
@@ -218,12 +273,12 @@ puts "
</a><br>
"
epg cleanup
set end [clock milliseconds]
puts "<font class=footnote>
Retrieved in: [expr [expr $got - $start] / 1000.0] seconds.
</font>"
epg cleanup
footer

View File

@@ -1,4 +1,4 @@
<!--#include virtual="/lib/header.shtml" -->
<!--#exec cmd="/mod/var/mongoose/include/backup.jim" -->
<!--#exec cmd="/mod/webif/include/backup.jim" -->
<!--#include virtual="/lib/footer.shtml" -->

View File

@@ -0,0 +1,57 @@
#popup_container {
font-family: Arial, sans-serif;
font-size: 12px;
min-width: 300px; /* Dialog will be no smaller than this */
max-width: 600px; /* Dialog will wrap after this width */
background: #FFF;
border: solid 5px #999;
color: #000;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
}
#popup_title {
font-size: 14px;
font-weight: bold;
text-align: center;
line-height: 1.75em;
color: #666;
background: #CCC url(/img/jalert/title.gif) top repeat-x;
border: solid 1px #FFF;
border-bottom: solid 1px #999;
cursor: default;
padding: 0em;
margin: 0em;
}
#popup_content {
background: 16px 16px no-repeat url(/img/jalert/info.gif);
padding: 1em 1.75em;
margin: 0em;
}
#popup_content.alert {
background-image: url(/img/jalert/info.gif);
}
#popup_content.confirm {
background-image: url(/img/jalert/important.gif);
}
#popup_content.prompt {
background-image: url(/img/jalert/help.gif);
}
#popup_message {
padding-left: 48px;
}
#popup_panel {
text-align: center;
margin: 1em 0em 0em 1em;
}
#popup_prompt {
margin: .5em 0em;
}

View File

@@ -64,5 +64,8 @@
.contextMenu LI.delete A { background-image: url(/img/context/delete.png); }
.contextMenu LI.cut A { background-image: url(/img/context/cut.png); }
.contextMenu LI.quit A { background-image: url(/img/context/door.png); }
.contextMenu LI.compress A { background-image: url(/img/context/compress.png); }
.contextMenu LI.dedup A { background-image: url(/img/context/dedup.png); }
.contextMenu LI.decrypt A { background-image: url(/img/context/decrypt.png); }

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;
@@ -326,12 +332,12 @@ div.cut
background: transparent;
}
#toolbarouter
div.toolbarouter
{
position: relative;
}
#toolbar
div.toolbar
{
position: absolute;
top: -20px;
@@ -358,3 +364,44 @@ span.toolbarcell
padding: 0 1em;
}
.tbhover
{
background: #dfe8ef;
border-top: solid 1px #ccc;
border-left: solid 1px #ccc;
}
#tbstatus
{
width: 100%;
border-top: 1px solid #ccc;
margin: 1em 0;
padding-top: 1em;
}
button.blue
{
background: url(/img/gloss_wave_blue.png) repeat-x center;
border: 1px solid blue;
color: #ffffff;
}
button.green
{
background: url(/img/gloss_wave_green.png) repeat-x center;
border: 1px solid green;
color: #ffffff;
}
button.red
{
background: url(/img/gloss_wave_red.png) repeat-x center;
border: 1px solid green;
color: #ffffff;
}
div#restart_block
{
z-index: 31;
}

View File

@@ -1,60 +0,0 @@
.x-vlc-slider {
background:#C7F2FF;
text-align:center;
}
.x-vlc-slider-thumb {
background:#4EAECC;
width:3px;
}
.x-vlc-main {
}
.x-vlc-toolbar {
color:black;
}
.x-vlc-toolbar * {
vertical-align:top;
}
.x-vlc-btn {
padding-right:10px;
}
.x-vlc-btn-fullscreen {
background:url(/img/vlc/fullscreen2.gif) no-repeat;
}
.x-vlc-btn-plus {
background:url(/img/vlc/plus2.gif) no-repeat;
}
.x-vlc-btn-moins {
background:url(/img/vlc/moins2.gif) no-repeat;
}
.x-vlc-btn:hover {
color:red;
}
.x-vlc-btn-play {
background:url(/img/vlc/play2.gif) no-repeat;
}
.x-vlc-btn-stop {
background:url(/img/vlc/stop2.gif) no-repeat;
}
.x-vlc-btn-pause {
background:url(/img/vlc/pause2.gif) no-repeat;
}
.x-vlc-timer {
width:100px;
font-size:12px;
vertical-align:top;
text-align:center
}
.x-vlc-about {
font-size:10px;
}

View File

@@ -1,10 +1,10 @@
#!/mod/bin/jimsh
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require ts.class
source /mod/var/mongoose/html/dedup/normalise.jim
source /mod/var/mongoose/html/dedup/process.jim
source /mod/webif/html/dedup/normalise.jim
source /mod/webif/html/dedup/process.jim
set dirs {}
@@ -23,6 +23,7 @@ foreach dir $dirs {
set dir [string range $dir 0 end-1]
}
puts "\[$dir\]"
loadseries $dir
foreach file [readdir $dir] {
if {[file extension $file] ne ".hmt"} { continue }
@@ -67,7 +68,7 @@ foreach dir $dirs {
# Dooooo, it.
$ts settitle $syn
ts renamegroup $file $fn
puts -nonewline "Done"
puts -nonewline " ... Done"
}
}
}

View File

@@ -1,7 +1,7 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require ts.class pretty_size altrow
source normalise.jim
@@ -31,8 +31,7 @@ puts "<fieldset style=\"display: inline\">
</tr>
"
set seen {}
loadseries $dir
foreach file [readdir $dir] {
set file "$dir/$file"
if {[file extension $file] ne ".hmt"} { continue }

View File

@@ -8,8 +8,32 @@ set dedup_prefixes {
{^\.+}
}
proc loadseries {dir} {
global seriesmap
set seriesmap [dict create]
if {![file exists "$dir/series.info"]} { return }
if {[catch {set fd [open "$dir/series.info" "r"]} msg]} {
puts "Error opening series.info: $msg"
return
}
foreach line [split [read $fd] "\n\r"] {
set i [string first " ==> " $line]
if {$i == -1} { continue }
set name [string range $line 0 $($i - 1)]
set prefix [string range $line $($i + 5) end]
if {$prefix eq ""} { continue }
dict set seriesmap $name $prefix
regsub -all -- {[[:space:]]+} [string tolower $name] "" name
dict set seriesmap $name $prefix
}
$fd close
}
proc dedupnormalise {title {reserve ""}} {
global dedup_prefixes
global dedup_prefixes seriesmap
# Strip common prefixes
foreach prefix $dedup_prefixes {
@@ -38,6 +62,17 @@ proc dedupnormalise {title {reserve ""}} {
}
}
if {[dict exists $seriesmap $title]} {
set ntitle "$seriesmap($title): $title"
set title $ntitle
} else {
# Try lower case without spaces
regsub -all -- {[[:space:]]+} [string tolower $title] "" ntitle
if {[dict exists $seriesmap $ntitle]} {
set title "$seriesmap($ntitle): $title"
}
}
# Shorten if too long.
if {[string length $title] > 40} {
set title [string range $title 0 39]

View File

@@ -1,12 +1,16 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
require pretty_size
source /mod/webif/lib/setup
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 Disc</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,6 +172,7 @@ 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>

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

@@ -1,7 +1,7 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require system.class chunked
cgi_input

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>');
});
});
@@ -49,6 +52,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 +86,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,7 +2,7 @@
package require cgi
package require sqlite3
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require ts.class pretty_size
puts "Content-Type: text/html\r\n\r\n"

View File

@@ -1,6 +1,6 @@
#!/mod/bin/jimsh
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require system.class
puts "Content-Type: text/html"

View File

@@ -0,0 +1,18 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
cgi_input
#cgi_dump
set file [cgi_get file "/tmp/hosts"]
if {$file eq "-"} { exit }
puts "Content-Type: text/plain\n"
if {[file exists $file]} {
puts ">>> File already exists."
exit
}

View File

@@ -1,7 +1,8 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require plugin
puts "Content-Type: text/html"
puts ""
@@ -33,6 +34,7 @@ Use the <i>Open</i> button below to begin.
<button class=xeditactive id=open>Open</button>
<button class=editactive id=save>Save</button>
<button class=editactive id=revert>Revert</button>
<button class=xeditactive id=create>Create File</button>
<div id=result class="blood hidden" />
@@ -42,11 +44,50 @@ 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>
</div>
<div id=createf title="Create new file" style="display: none">
<form id=createf_form>
<table border=0>
<tr>
<th>
<label for="createf_name">
<b>Filename</b>
</label>
</th>
<td>
<input type=text name="createf_name"
id="createf_name"
value="/mod/" size=70 maxlength=255
class="text ui-widget-content ui-corner-all">
</td>
</tr>
</table>
</form>
</div>
}
footer

View File

@@ -1,7 +1,7 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
cgi_input
#cgi_dump

View File

@@ -1,7 +1,7 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
require chunked pretty_size
cgi_input

View File

@@ -1,7 +1,7 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
source /mod/webif/lib/setup
puts "Content-Type: text/html"
puts ""

View File

@@ -103,5 +103,49 @@ $('#back').click(function() {
window.location = '/diag/diag.jim';
});
function createf_submit()
{
var f = $('#createf_name').val();
console.log('Creating: ' + f);
$('#createf').dialog('close');
$.get('create.jim?file=' + encodeURIComponent(f), function(data) {
if (data.match('^>>>'))
{
$('#msg').text(data);
file = null;
changed = false;
}
else
{
$('#editor').val('').enable();
$('button.editactive').enable();
$('#msg').html('Editing new file <i>' + f + '</i>');
file = f;
changed = false;
}
});
}
$('#createf').dialog({
autoOpen: false,
height: 'auto', width: 'auto',
modal: true,
buttons: {
"Create File": createf_submit,
"Cancel": function() {
$(this).dialog('close');
}
}
});
$('#create').click(function() {
console.log('opening dialog');
$('#createf').dialog('open');
});
$('a.qfile').on('click', function() {
loadfile($(this).text());
});
});

View File

@@ -1,4 +1,4 @@
<!--#include virtual="/lib/header.shtml" -->
<!--#exec cmd="/mod/var/mongoose/include/epg.jim" -->
<!--#exec cmd="/mod/webif/include/epg.jim" -->
<!--#include virtual="/lib/footer.shtml" -->

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 B

View File

@@ -0,0 +1 @@
context/clock.png

View File

@@ -0,0 +1 @@
context/compress.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 483 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 704 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 612 B

View File

@@ -0,0 +1 @@
context/decrypt.png

View File

@@ -0,0 +1 @@
context/dedup.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Some files were not shown because too many files have changed in this diff Show More