Compare commits
48 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1db6ce6c19 | ||
|
|
24d26aee75 | ||
|
|
39b3dee3e1 | ||
|
|
3d3f7d17ed | ||
|
|
89a68cf538 | ||
|
|
51db7b1e36 | ||
|
|
9d8d630b07 | ||
|
|
101f5a7946 | ||
|
|
50346e5d4b | ||
|
|
f0d22b3b01 | ||
|
|
7356e6e220 | ||
|
|
7d1331f1aa | ||
|
|
895dda6dee | ||
|
|
d7284ff3ef | ||
|
|
d04dcee369 | ||
|
|
db4f7cf122 | ||
|
|
015b992fcb | ||
|
|
a41c2ae6f9 | ||
|
|
f56d226cf8 | ||
|
|
5b5485dd4c | ||
|
|
1b11c7959b | ||
|
|
df72a42abf | ||
|
|
6d95ee89a4 | ||
|
|
57c769a4e8 | ||
|
|
020e1b707c | ||
|
|
3b8863a4b4 | ||
|
|
b45fe08fe2 | ||
|
|
a5c65505e4 | ||
|
|
6ab9318fa9 | ||
|
|
52728ba471 | ||
|
|
68ae915f57 | ||
|
|
3d0152e475 | ||
|
|
87060ef8e2 | ||
|
|
46dad281f5 | ||
|
|
f14b2a8b2e | ||
|
|
79a09e1df6 | ||
|
|
2de66b4f3c | ||
|
|
2bbf69f820 | ||
|
|
8fb6570882 | ||
|
|
df8d655cc8 | ||
|
|
d8914e2311 | ||
|
|
3afef45f86 | ||
|
|
4ae2604f0a | ||
|
|
973a7cdacf | ||
|
|
aadac18796 | ||
|
|
955217bdd2 | ||
|
|
1dbd659ddb | ||
|
|
57515b2941 |
@@ -1,9 +1,9 @@
|
||||
Package: webif
|
||||
Priority: optional
|
||||
Section: web
|
||||
Version: 0.9.2
|
||||
Version: 0.9.13
|
||||
Architecture: mipsel
|
||||
Maintainer: af123@hummypkg.org.uk
|
||||
Depends: mongoose(>=3.0-7),jim(>=0.73-1),jim-oo,jim-sqlite3(>=0.73),jim-cgi(>=0.5),service-control,busybox(>=1.19.3-1),lsof,epg(>=1.0.8),hmt(>=1.1.4),ssmtp,anacron,trm,openssl-command,nicesplice,id3v2
|
||||
Depends: webif-channelicons(>=1.0.2),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)
|
||||
Suggests: ffmpeg,webif-iphone
|
||||
Description: An evolving web interface for the Humax.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,7 +1,7 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/setup
|
||||
source /mod/webif/lib/setup
|
||||
|
||||
require rsv.class
|
||||
|
||||
@@ -19,7 +19,7 @@ set file [file tail [cgi_get file \
|
||||
|
||||
if {[string match {auto-*} $file]} {
|
||||
# Delete any automatic backups over 7 days old.
|
||||
set mt $(7 * 86400)
|
||||
set mt $(15 * 86400)
|
||||
foreach af [glob -nocomplain "$dir/auto-*"] {
|
||||
set aft [file mtime $af]
|
||||
set diff $($now - $aft)
|
||||
@@ -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."
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -53,6 +53,9 @@ foreach line $data {
|
||||
lappend vars $f [lindex $vals $i]
|
||||
}
|
||||
|
||||
# Don't restore DSO events.
|
||||
if {$vars(ersvtype) == 11} { continue }
|
||||
|
||||
set rsv [rsv new $vars]
|
||||
|
||||
# Need to fix up channel and CRID mappings in case something has
|
||||
@@ -89,6 +92,14 @@ puts "Restoring favourite channels..."
|
||||
$rsvdb query {begin transaction;}
|
||||
$rsvdb query {delete from channel.TBL_FAV}
|
||||
|
||||
$rsvdb query {drop table if exists pending.fav}
|
||||
$rsvdb query {create table pending.fav (
|
||||
favIdx integer primary key autoincrement unique,
|
||||
hSvc integer(4),
|
||||
eFavGroup integer(4),
|
||||
[eSvcType] integer(4)
|
||||
)}
|
||||
|
||||
set grp 0
|
||||
foreach line $data {
|
||||
set vals [split $line "\t"]
|
||||
@@ -97,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} {
|
||||
@@ -112,8 +125,8 @@ foreach line $data {
|
||||
}
|
||||
|
||||
set query "
|
||||
insert into channel.TBL_FAV(hSvc, eFavGroup, eSvcType)
|
||||
values($hsvc, $group, $type);
|
||||
insert into pending.fav(favIdx, hSvc, eFavGroup, eSvcType)
|
||||
values($idx, $hsvc, $group, $type);
|
||||
"
|
||||
|
||||
$rsvdb query $query
|
||||
|
||||
@@ -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 settings.class escape
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
@@ -33,18 +33,17 @@ 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} {
|
||||
proc directory {file bfile tbfile} {
|
||||
global flatten
|
||||
|
||||
regsub -all " +" $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" }
|
||||
@@ -63,9 +62,30 @@ proc directory {file bfile} {
|
||||
if $noflat { icon "/img/flat-tyre.png" "No-flatten" }
|
||||
}
|
||||
|
||||
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 -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 "
|
||||
src=/images/181_1_00_Help5_OPT_Plus.png>
|
||||
@@ -80,11 +100,12 @@ 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
|
||||
directory $file $bfile $tbfile
|
||||
continue
|
||||
}
|
||||
set ext [file extension $file]
|
||||
@@ -100,16 +121,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 +211,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 +225,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
|
||||
@@ -214,14 +245,15 @@ header
|
||||
|
||||
puts {
|
||||
<link href=/css/jquery.contextMenu.css rel=stylesheet type=text/css />
|
||||
<script type="text/javascript" src="/js/jquery.contextMenu.js"></script>
|
||||
<script type=text/javascript src=/js/jquery.contextMenu.js></script>
|
||||
<link href=/css/jquery.bar.css rel=stylesheet type=text/css />
|
||||
<script type="text/javascript" src="/js/jquery.bar.js"></script>
|
||||
<script type=text/javascript src=/js/jquery.bar.js></script>
|
||||
<script type=text/javascript src=/js/enadis.js></script>
|
||||
<script type=text/javascript src=/cgi-bin/browse/browse.js></script>
|
||||
<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>
|
||||
|
||||
@@ -14,10 +14,16 @@ 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 { <li><a href=#audio>Extract Audio</a></li> }
|
||||
puts {
|
||||
<li><a href=#audio>Extract Audio</a></li>
|
||||
<li><a href=#mpg>Extract to MPG</a></li>
|
||||
}
|
||||
}
|
||||
if $nicesplice {
|
||||
puts {
|
||||
@@ -27,17 +33,30 @@ if $nicesplice {
|
||||
}
|
||||
puts {
|
||||
<li class=separator><a href=#lock>Toggle Lock</a></li>
|
||||
<li><a href=#enc>Toggle Enc</a></li>
|
||||
<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=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> }
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -1,23 +1,3 @@
|
||||
(function($)
|
||||
{
|
||||
$.fn.enable = function()
|
||||
{
|
||||
return this.each(function() {
|
||||
$(this)
|
||||
.removeClass('ui-state-disabled')
|
||||
.removeProp('disabled');
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.disable = function()
|
||||
{
|
||||
return this.each(function() {
|
||||
$(this)
|
||||
.addClass('ui-state-disabled')
|
||||
.prop('disabled', true);
|
||||
});
|
||||
};
|
||||
})(jQuery);
|
||||
|
||||
var dir;
|
||||
|
||||
@@ -132,6 +112,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;
|
||||
@@ -222,22 +220,29 @@ function preparemenu(el, menu)
|
||||
{
|
||||
if (el.attr('type') == 'ts')
|
||||
{
|
||||
if (el.attr('def') == 'HD')
|
||||
{
|
||||
$(menu).enableContextMenuItems('#enc');
|
||||
if (el.attr('encd') == 1)
|
||||
$(menu).changeContextMenuItem('#enc',
|
||||
'Remove Enc');
|
||||
else
|
||||
$(menu).changeContextMenuItem('#enc',
|
||||
'Set Enc');
|
||||
}
|
||||
// if (el.attr('def') == 'HD')
|
||||
// {
|
||||
// $(menu).enableContextMenuItems('#enc');
|
||||
// if (el.attr('encd') == 1)
|
||||
// $(menu).changeContextMenuItem('#enc',
|
||||
// 'Remove Enc');
|
||||
// else
|
||||
// $(menu).changeContextMenuItem('#enc',
|
||||
// 'Set Enc');
|
||||
// }
|
||||
|
||||
if (el.attr('bx') > 0)
|
||||
$(menu).enableContextMenuItems('#crop');
|
||||
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
|
||||
@@ -262,26 +267,29 @@ 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');
|
||||
|
||||
if (el.attr('odencd') == 1)
|
||||
{
|
||||
$(menu).disableContextMenuItems('#audio');
|
||||
$(menu).disableContextMenuItems('#mpg');
|
||||
}
|
||||
else
|
||||
{
|
||||
$(menu).enableContextMenuItems('#audio');
|
||||
$(menu).enableContextMenuItems('#mpg');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$(menu).enableContextMenuItems('#delete');
|
||||
$(menu).disableContextMenuItems('#lock');
|
||||
$(menu).disableContextMenuItems('#enc');
|
||||
//$(menu).disableContextMenuItems('#enc');
|
||||
$(menu).disableContextMenuItems('#new');
|
||||
$(menu).disableContextMenuItems('#decrypt');
|
||||
$(menu).disableContextMenuItems('#audio');
|
||||
$(menu).disableContextMenuItems('#crop');
|
||||
$(menu).disableContextMenuItems('#chunk');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -296,6 +304,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() {
|
||||
@@ -332,10 +367,10 @@ var menuclick = function(action, el, pos)
|
||||
file, type, id);
|
||||
break;
|
||||
|
||||
case 'enc':
|
||||
confirm_action('change the ENC flag on', enc_callback,
|
||||
file, type, id);
|
||||
break;
|
||||
// case 'enc':
|
||||
// confirm_action('change the ENC flag on', enc_callback,
|
||||
// file, type, id);
|
||||
// break;
|
||||
|
||||
case 'new':
|
||||
confirm_action('change the New flag on', new_callback,
|
||||
@@ -370,6 +405,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;
|
||||
@@ -385,6 +425,11 @@ var menuclick = function(action, el, pos)
|
||||
file;
|
||||
break;
|
||||
|
||||
case 'mpg':
|
||||
window.location.href = '/cgi-bin/browse/mpg/mpg.jim?file=' +
|
||||
file;
|
||||
break;
|
||||
|
||||
default:
|
||||
alert('Unhandled action: ' + action);
|
||||
break;
|
||||
@@ -440,7 +485,31 @@ var dmenuclick = function(action, el, pos)
|
||||
break;
|
||||
|
||||
case 'flat':
|
||||
var url = '/cgi-bin/browse/flat.jim?file=' + 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;
|
||||
|
||||
case 'resetnew':
|
||||
var url = '/cgi-bin/browse/resetnew.jim?dir=' + file;
|
||||
$.get(url, function() { window.location.reload(true); });
|
||||
break;
|
||||
|
||||
@@ -460,6 +529,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',
|
||||
@@ -498,7 +577,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;
|
||||
}
|
||||
@@ -577,6 +656,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);
|
||||
@@ -590,7 +673,7 @@ var dmenuclick = function(action, el, pos)
|
||||
// Buttons
|
||||
|
||||
$('#dedup').button().click(function() {
|
||||
window.location = '/cgi-bin/dedup.jim?dir='
|
||||
window.location = '/dedup/dedup.jim?dir='
|
||||
+ encodeURIComponent(dir);
|
||||
});
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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]
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
@@ -40,6 +40,14 @@ if {$url eq ""} {
|
||||
exit
|
||||
}
|
||||
|
||||
if {![system is_listening 9000]} {
|
||||
puts "The Humax media server is not running, cannot decrypt."
|
||||
puts "Have you enabled <i>Content Sharing</i> in the Humax menus?"
|
||||
puts "It can sometimes turn itself off so it's worth double checking."
|
||||
puts "If it is on then try turning sharing off and on again."
|
||||
exit
|
||||
}
|
||||
|
||||
puts "
|
||||
|
||||
<span class=hidden id=params
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -16,6 +16,17 @@ set dir [file dirname $rfile]
|
||||
set len [$ts duration 1]
|
||||
lassign [$ts dlnaloc] url
|
||||
|
||||
if {$url eq ""} {
|
||||
puts "This file has not been indexed by the media server.
|
||||
Cannot decrypt."
|
||||
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]
|
||||
@@ -25,6 +36,11 @@ if {![file exists $origdir]} { file mkdir $origdir }
|
||||
set shname [file tail $base]
|
||||
puts "Processing $shname"
|
||||
|
||||
if {[file exists "$origdir/$shname.ts"]} {
|
||||
puts "The file already exists in _original, cannot decrypt."
|
||||
exit
|
||||
}
|
||||
|
||||
exec wget -O "$rfile.decrypting" $url
|
||||
|
||||
puts "Moving recording to $origdir"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
@@ -56,7 +56,9 @@ foreach file [cgi_get files] {
|
||||
puts -nonewline "Directory..."
|
||||
if {$ldustbin ne ""} {
|
||||
set ndir "[bindir $file]/[file tail $file]"
|
||||
while {[file isdirectory $ndir]} { append ndir "_" }
|
||||
while {[file isdirectory $ndir]} {
|
||||
append ndir "_"
|
||||
}
|
||||
file rename $file $ndir
|
||||
touch $ndir
|
||||
} else {
|
||||
@@ -70,7 +72,7 @@ foreach file [cgi_get files] {
|
||||
# Check TS validity
|
||||
if {![catch {$ts get file}]} {
|
||||
if {$ldustbin ne ""} {
|
||||
$ts move [bindir $file] 1
|
||||
$ts move [bindir $file] 1 1
|
||||
} else {
|
||||
if {[$ts delete]} {
|
||||
puts "Successfully deleted $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"
|
||||
|
||||
@@ -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 ""
|
||||
|
||||
@@ -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 ""
|
||||
|
||||
@@ -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..."
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
22
var/mongoose/cgi-bin/browse/flagdir.jim
Executable file
22
var/mongoose/cgi-bin/browse/flagdir.jim
Executable 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."
|
||||
}
|
||||
|
||||
@@ -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 file]
|
||||
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."
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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 ""
|
||||
|
||||
31
var/mongoose/cgi-bin/browse/mpg/execute.jim
Executable file
31
var/mongoose/cgi-bin/browse/mpg/execute.jim
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require sqlite3
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require ts.class system.class
|
||||
|
||||
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 xstart [clock milliseconds]
|
||||
|
||||
set base [file rootname $rfile]
|
||||
set shname [file tail $base]
|
||||
puts "Processing $shname"
|
||||
|
||||
puts [exec /mod/bin/ffmpeg -y -benchmark -v 0 \
|
||||
-i $rfile \
|
||||
-map 0:0 -map 0:1 \
|
||||
-vcodec copy -acodec copy "${base}.mpg"]
|
||||
|
||||
set xtime [expr [expr [clock milliseconds] - $xstart] / 1000.0]
|
||||
puts "Time taken: $xtime"
|
||||
|
||||
52
var/mongoose/cgi-bin/browse/mpg/mpg.jim
Executable file
52
var/mongoose/cgi-bin/browse/mpg/mpg.jim
Executable file
@@ -0,0 +1,52 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require sqlite3
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require ts.class system.class
|
||||
|
||||
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]
|
||||
|
||||
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=mpg.js></script>
|
||||
|
||||
<fieldset class=cleft>
|
||||
<legend>Extract to MPG</legend>
|
||||
|
||||
<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>
|
||||
</table>
|
||||
|
||||
<span class=hidden id=params
|
||||
dir=\"[cgi_quote_url $dir]\"
|
||||
rfile=\"[cgi_quote_url $rfile]\"
|
||||
></span>
|
||||
|
||||
<div id=mpgdiv style=\"padding: 1em\">
|
||||
<button id=mpgit>Perform mpg extraction</button>
|
||||
</div>
|
||||
|
||||
<div id=progressdiv class=hidden>
|
||||
Extracting mpg: <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>
|
||||
|
||||
"
|
||||
|
||||
35
var/mongoose/cgi-bin/browse/mpg/mpg.js
Executable file
35
var/mongoose/cgi-bin/browse/mpg/mpg.js
Executable file
@@ -0,0 +1,35 @@
|
||||
|
||||
var handle = 0;
|
||||
|
||||
function update()
|
||||
{
|
||||
$.get('progress.jim?file=' + $('#params').attr('rfile'),
|
||||
function(data) {
|
||||
if (handle)
|
||||
$('#progressbar').reportprogress(data);
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#progressbar').reportprogress(0);
|
||||
|
||||
$('#back').button().click(function() {
|
||||
window.location = '/cgi-bin/browse.jim?dir=' + $('#params').attr('dir');
|
||||
});
|
||||
|
||||
$('#mpgit').button().click(function() {
|
||||
$('#mpgdiv').hide('slow');
|
||||
$('#progressdiv').show('slow');
|
||||
handle = setInterval("update()", 1000);
|
||||
$('#output').load('execute.jim?file=' + $('#params').attr('rfile'),
|
||||
function() {
|
||||
clearInterval(handle);
|
||||
handle = 0;
|
||||
$('#back').show();
|
||||
$('#progressbar').reportprogress(100);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
26
var/mongoose/cgi-bin/browse/mpg/progress.jim
Executable file
26
var/mongoose/cgi-bin/browse/mpg/progress.jim
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/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 [cgi_get file]
|
||||
set rfile [file normalize $tsfile]
|
||||
set bfile [file rootname $rfile]
|
||||
|
||||
if {![file exists "${bfile}.mpg"]} {
|
||||
puts "0"
|
||||
} else {
|
||||
set sz [file size $rfile]
|
||||
set nsz [expr [file size "${bfile}.mpg"] / 0.75]
|
||||
|
||||
set perc [expr $nsz * 100 / $sz]
|
||||
if {$perc > 100} { set perc 100 }
|
||||
puts $perc
|
||||
}
|
||||
|
||||
@@ -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 ""
|
||||
|
||||
@@ -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 ""
|
||||
|
||||
49
var/mongoose/cgi-bin/browse/resetnew.jim
Executable file
49
var/mongoose/cgi-bin/browse/resetnew.jim
Executable file
@@ -0,0 +1,49 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
package require pack
|
||||
source /mod/webif/lib/setup
|
||||
require ts.class hexdump
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
set dir [cgi_get dir]
|
||||
if {![file isdirectory $dir]} { exit }
|
||||
if {![file exists "$dir/.series"]} { exit }
|
||||
|
||||
set tot 0
|
||||
set watched 0
|
||||
foreach file [readdir -nocomplain $dir] {
|
||||
if {![string match {*.ts} $file]} { continue }
|
||||
#puts "FILE: $file"
|
||||
incr tot
|
||||
if {[set ts [ts fetch "$dir/$file"]] != 0} {
|
||||
if {![$ts flag "New"]} { incr watched }
|
||||
}
|
||||
}
|
||||
|
||||
set fd [open "$dir/.series"]
|
||||
set bytes [read $fd]
|
||||
close $fd
|
||||
set recs [unpack $bytes -uintle 0 32]
|
||||
set played [unpack $bytes -uintle 32 32]
|
||||
|
||||
puts "Current: $played/$recs"
|
||||
|
||||
#hexdump $bytes
|
||||
|
||||
puts "Calculated: $watched/$tot"
|
||||
|
||||
pack bytes $tot -intle 32 0
|
||||
pack bytes $watched -intle 32 32
|
||||
|
||||
#hexdump $bytes
|
||||
|
||||
set fd [open "$dir/.series" "w"]
|
||||
puts -nonewline $fd $bytes
|
||||
close $fd
|
||||
|
||||
@@ -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 ""
|
||||
|
||||
28
var/mongoose/cgi-bin/browse/shrunk.jim
Executable file
28
var/mongoose/cgi-bin/browse/shrunk.jim
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/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 "{"
|
||||
regsub -all {([\\["$])} $dir {\\\1} xdir
|
||||
foreach file [readdir -nocomplain $dir] {
|
||||
if {![string match {*.ts} $file]} { continue }
|
||||
|
||||
regsub -all {([\\["$])} [file rootname $file] {\\\1} xfile
|
||||
if {[catch {set eit [exec /mod/bin/stripts -cq "$xdir/$xfile"]}]} {
|
||||
continue
|
||||
}
|
||||
|
||||
puts " \"$file\": $eit,"
|
||||
}
|
||||
puts " \"dummy\": 0"
|
||||
puts "}"
|
||||
|
||||
16
var/mongoose/cgi-bin/browse/strip/analyse.jim
Executable file
16
var/mongoose/cgi-bin/browse/strip/analyse.jim
Executable 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]
|
||||
|
||||
52
var/mongoose/cgi-bin/browse/strip/execute.jim
Executable file
52
var/mongoose/cgi-bin/browse/strip/execute.jim
Executable 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"
|
||||
|
||||
27
var/mongoose/cgi-bin/browse/strip/progress.jim
Executable file
27
var/mongoose/cgi-bin/browse/strip/progress.jim
Executable 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
|
||||
}
|
||||
|
||||
66
var/mongoose/cgi-bin/browse/strip/strip.jim
Executable file
66
var/mongoose/cgi-bin/browse/strip/strip.jim
Executable 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>
|
||||
"
|
||||
|
||||
48
var/mongoose/cgi-bin/browse/strip/strip.js
Executable file
48
var/mongoose/cgi-bin/browse/strip/strip.js
Executable 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);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Content-Type: text/plain"
|
||||
echo
|
||||
|
||||
/bin/rm -rf /mod/*
|
||||
|
||||
7
var/mongoose/cgi-bin/cfwreset.cgi
Executable file
7
var/mongoose/cgi-bin/cfwreset.cgi
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Content-Type: text/plain"
|
||||
echo
|
||||
|
||||
touch /var/lib/humaxtv/mod/_RESET_CUSTOM_FIRMWARE_ENVIRONMENT
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
8
var/mongoose/cgi-bin/env.jim
Executable file
8
var/mongoose/cgi-bin/env.jim
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
puts "Content-type: text/plain\n"
|
||||
|
||||
foreach f [dict keys $env] {
|
||||
puts "$f = $env($f)"
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
@@ -49,7 +49,7 @@ puts {
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#progressbar').reportprogress(0);
|
||||
handle = setInterval("update()", 300);
|
||||
handle = setInterval("update()", 350);
|
||||
$.get('/cgi-bin/restart.jim?now=yes');
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
|
||||
source /mod/var/mongoose/include/restart.jim
|
||||
source /mod/webif/include/restart.jim
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/setup
|
||||
source /mod/webif/lib/setup
|
||||
require settings.class
|
||||
require plugin
|
||||
|
||||
@@ -29,6 +29,7 @@ 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]
|
||||
|
||||
# Handle updates
|
||||
|
||||
@@ -65,6 +66,7 @@ _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"
|
||||
|
||||
set acluser [cgi_get acluser "-"]
|
||||
set aclpass [cgi_get aclpass "-"]
|
||||
@@ -140,6 +142,17 @@ puts ">
|
||||
</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 "
|
||||
<tr>
|
||||
<form class=auto id=epg_style method=get action=$env(REQUEST_URI)>
|
||||
@@ -335,24 +348,5 @@ puts ">
|
||||
|
||||
eval_plugins settings
|
||||
|
||||
puts {
|
||||
<br><br>
|
||||
<fieldset style="display: inline">
|
||||
<legend> Reset Custom Firmware </legend>
|
||||
<button id=cfwreset>
|
||||
Click to remove all packages and settings installed by the custom firmware.
|
||||
</button>
|
||||
</fieldset>
|
||||
<script type=text/javascript>
|
||||
$('#cfwreset').jConfirmAction({
|
||||
yesAnswer: "Delete"
|
||||
}, function(el) {
|
||||
$('html').html('Restart the Humax using the remote control.');
|
||||
$.get('/cgi-bin/cfwreset');
|
||||
});
|
||||
</script>
|
||||
|
||||
}
|
||||
|
||||
footer
|
||||
|
||||
|
||||
@@ -73,5 +73,24 @@ $(document).ready(function () {
|
||||
.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');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1,49 +1,113 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
source /mod/webif/lib/setup
|
||||
require system.class findhsvc epg.class
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts "Pragma: no-cache"
|
||||
puts "Expires: Thu, 01 Jan 1970 00:00:00 GMT"
|
||||
puts ""
|
||||
|
||||
if {[catch {set pid [exec pgrep humaxtv]}]} { exit }
|
||||
|
||||
if {[catch {set data [exec lsof -p $pid | grep Video | fgrep .ts]} ]} {
|
||||
exit
|
||||
if {[catch {set pid [exec pgrep humaxtv]}]} {
|
||||
puts "Cannot find humaxtv process."
|
||||
exit
|
||||
}
|
||||
|
||||
set lines [split $data "\n"]
|
||||
foreach line $lines {
|
||||
regsub -all -- {[[:space:]]+} $line " " line
|
||||
set fields [split $line " "]
|
||||
set name [lindex [split $line "/"] end]
|
||||
set size($name) [lindex $fields 6]
|
||||
set seen($name) 0
|
||||
}
|
||||
proc get_data {} {
|
||||
global pid
|
||||
|
||||
sleep 2
|
||||
|
||||
set data [exec lsof -p $pid | grep Video | fgrep .ts]
|
||||
regsub -all -- {[[:space:]]+} $line " " line
|
||||
set lines [split $data "\n"]
|
||||
foreach line $lines {
|
||||
regsub -all -- {[[:space:]]+} $line " " line
|
||||
set fields [split $line " "]
|
||||
set name [lindex [split $line "/"] end]
|
||||
set size2 [lindex $fields 6]
|
||||
|
||||
if { $size2 > $size($name) && $seen($name) < 1 } {
|
||||
set mode "Recording"
|
||||
set icon "745_1_11_Video_1REC.png"
|
||||
set ret {}
|
||||
if {[catch {set data \
|
||||
[exec /mod/bin/lsof -p $pid | grep Video | fgrep .ts]} ]} {
|
||||
set ret {}
|
||||
} else {
|
||||
set mode "Watching"
|
||||
set icon "745_1_10_Video_2Live.png"
|
||||
foreach line [split $data "\n"] {
|
||||
regsub -all -- {[[:space:]]+} $line " " line
|
||||
set name [file rootname [file tail $line]]
|
||||
if {[dict exists $ret $name]} {
|
||||
set ret($name) -1
|
||||
} else {
|
||||
set size [lindex [split $line " "] 6]
|
||||
set ret($name) $size
|
||||
}
|
||||
}
|
||||
}
|
||||
return $ret
|
||||
}
|
||||
|
||||
incr seen($name)
|
||||
set play 0
|
||||
set rec 0
|
||||
set seen {}
|
||||
set output {}
|
||||
|
||||
lappend output "<img class=va src=/images/$icon><span class=va>
|
||||
$mode $name</span><br>"
|
||||
set data [get_data]
|
||||
if {[llength $data]} {
|
||||
sleep 3
|
||||
set ndata [get_data]
|
||||
foreach name [array names ndata] {
|
||||
if {![dict exists $seen $name]} { set seen($name) 0 }
|
||||
if {![dict exists $data $name]} { set data($name) 0 }
|
||||
if {$ndata($name) == -1} {
|
||||
incr rec
|
||||
incr play
|
||||
set mode "Chase Playing"
|
||||
set icon "745_1_11_Video_3REC_Live.png"
|
||||
} elseif {$ndata($name) > $data($name) && $seen($name) < 1} {
|
||||
incr rec
|
||||
set mode "Recording"
|
||||
set icon "745_1_11_Video_1REC.png"
|
||||
} else {
|
||||
incr play
|
||||
set mode "Playing"
|
||||
set icon "745_1_10_Video_2Live.png"
|
||||
}
|
||||
|
||||
incr seen($name)
|
||||
|
||||
lappend output "<img class=va src=/images/$icon><span class=va>
|
||||
$mode <i>$name</i></span>"
|
||||
}
|
||||
}
|
||||
|
||||
if {![system instandby] && $play < 1} {
|
||||
set hsvc [system param CUR_SVC Value USERCONFIG]
|
||||
|
||||
set ff [$rsvdb query "
|
||||
select usSvcid as svcid, usLcn as lcn,
|
||||
substr(szSvcName, 2) as name
|
||||
from channel.TBL_SVC
|
||||
where hSvc = $hsvc
|
||||
limit 1
|
||||
"]
|
||||
|
||||
if {[llength $ff] == 1} {
|
||||
lassign [lindex $ff 0] x svcid x lcn x name
|
||||
set epgs [epg dbfetch get \
|
||||
-service $svcid \
|
||||
-time [clock seconds]\
|
||||
]
|
||||
set prog ""
|
||||
if {[llength $epgs] == 1} {
|
||||
lassign $epgs epg
|
||||
set prog "- [$epg get name] ("
|
||||
append prog "[clock format [$epg get start] -format %H:%M] - "
|
||||
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 {[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 {[llength $output]} {
|
||||
puts [join $output " "]
|
||||
puts [join $output "<br>"]
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
set url "http://$env(HTTP_HOST):9091/"
|
||||
|
||||
puts "Content-Type: text/html
|
||||
Location: $url
|
||||
|
||||
<meta http-equiv=refresh content=\"0; url=$url\">
|
||||
|
||||
Transmission is available <a href=$url>here</a>
|
||||
|
||||
"
|
||||
|
||||
@@ -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 ""
|
||||
@@ -29,7 +29,7 @@ if {$stt <= [clock seconds]} {
|
||||
set current 0
|
||||
}
|
||||
|
||||
set favlist [epg favlist]
|
||||
set favgroup [[settings] channel_group]
|
||||
|
||||
set hours 4.0
|
||||
set seconds $($hours * 3600)
|
||||
@@ -51,7 +51,13 @@ 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"]]
|
||||
@@ -87,9 +93,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 }
|
||||
|
||||
@@ -218,12 +221,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
|
||||
|
||||
|
||||
@@ -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" -->
|
||||
|
||||
|
||||
57
var/mongoose/html/css/jquery.alerts.css
Normal file
57
var/mongoose/html/css/jquery.alerts.css
Normal 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;
|
||||
}
|
||||
@@ -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); }
|
||||
|
||||
|
||||
|
||||
91
var/mongoose/html/css/jqueryFileTree.css
Normal file
91
var/mongoose/html/css/jqueryFileTree.css
Normal file
@@ -0,0 +1,91 @@
|
||||
UL.jqueryFileTree {
|
||||
font-family: Verdana, sans-serif;
|
||||
font-size: 11px;
|
||||
line-height: 18px;
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
UL.jqueryFileTree LI {
|
||||
list-style: none;
|
||||
padding: 0px;
|
||||
padding-left: 20px;
|
||||
margin: 0px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
UL.jqueryFileTree A {
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
display: block;
|
||||
padding: 0px 2px;
|
||||
}
|
||||
|
||||
UL.jqueryFileTree A:hover {
|
||||
background: #BDF;
|
||||
}
|
||||
|
||||
/* Core Styles */
|
||||
.jqueryFileTree LI.directory { background: url(/img/filetree/directory.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.expanded { background: url(/img/filetree/folder_open.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.file { background: url(/img/filetree/file.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.wait { background: url(/img/filetree/spinner.gif) left top no-repeat; }
|
||||
/* File Extensions*/
|
||||
.jqueryFileTree LI.ext_3gp { background: url(/img/filetree/film.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_afp { background: url(/img/filetree/code.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_afpa { background: url(/img/filetree/code.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_asp { background: url(/img/filetree/code.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_aspx { background: url(/img/filetree/code.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_avi { background: url(/img/filetree/film.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_bat { background: url(/img/filetree/application.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_bmp { background: url(/img/filetree/picture.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_c { background: url(/img/filetree/code.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_cfm { background: url(/img/filetree/code.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_cgi { background: url(/img/filetree/code.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_com { background: url(/img/filetree/application.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_cpp { background: url(/img/filetree/code.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_css { background: url(/img/filetree/css.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_doc { background: url(/img/filetree/doc.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_exe { background: url(/img/filetree/application.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_gif { background: url(/img/filetree/picture.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_fla { background: url(/img/filetree/flash.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_h { background: url(/img/filetree/code.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_htm { background: url(/img/filetree/html.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_html { background: url(/img/filetree/html.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_jar { background: url(/img/filetree/java.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_jpg { background: url(/img/filetree/picture.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_jpeg { background: url(/img/filetree/picture.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_js { background: url(/img/filetree/script.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_lasso { background: url(/img/filetree/code.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_log { background: url(/img/filetree/txt.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_m4p { background: url(/img/filetree/music.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_mov { background: url(/img/filetree/film.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_mp3 { background: url(/img/filetree/music.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_mp4 { background: url(/img/filetree/film.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_mpg { background: url(/img/filetree/film.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_mpeg { background: url(/img/filetree/film.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_ogg { background: url(/img/filetree/music.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_pcx { background: url(/img/filetree/picture.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_pdf { background: url(/img/filetree/pdf.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_php { background: url(/img/filetree/php.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_png { background: url(/img/filetree/picture.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_ppt { background: url(/img/filetree/ppt.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_psd { background: url(/img/filetree/psd.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_pl { background: url(/img/filetree/script.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_py { background: url(/img/filetree/script.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_rb { background: url(/img/filetree/ruby.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_rbx { background: url(/img/filetree/ruby.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_rhtml { background: url(/img/filetree/ruby.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_rpm { background: url(/img/filetree/linux.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_ruby { background: url(/img/filetree/ruby.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_sql { background: url(/img/filetree/db.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_swf { background: url(/img/filetree/flash.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_tif { background: url(/img/filetree/picture.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_tiff { background: url(/img/filetree/picture.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_txt { background: url(/img/filetree/txt.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_vb { background: url(/img/filetree/code.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_wav { background: url(/img/filetree/music.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_wmv { background: url(/img/filetree/film.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_xls { background: url(/img/filetree/xls.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_xml { background: url(/img/filetree/code.png) left top no-repeat; }
|
||||
.jqueryFileTree LI.ext_zip { background: url(/img/filetree/zip.png) left top no-repeat; }
|
||||
@@ -326,3 +326,50 @@ div.cut
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
div.toolbarouter
|
||||
{
|
||||
position: relative;
|
||||
}
|
||||
|
||||
div.toolbar
|
||||
{
|
||||
position: absolute;
|
||||
top: -20px;
|
||||
left: 30px;
|
||||
z-index: 29;
|
||||
display: none;
|
||||
width: 80%;
|
||||
border: 1px solid #899caa;
|
||||
box-shadow: 2px 2px 11px #666;
|
||||
-moz-box-shadow: 2px 2px 11px #666;
|
||||
-webkit-box-shadow: 2px 2px 11px #666;
|
||||
border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
margin-top: -1px;
|
||||
background: #d2e0ea;
|
||||
padding: 6px;
|
||||
}
|
||||
|
||||
span.toolbarcell
|
||||
{
|
||||
float: left;
|
||||
border-right: 1px solid #ccc;
|
||||
text-align: center;
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
78
var/mongoose/html/dedup/dedup
Executable file
78
var/mongoose/html/dedup/dedup
Executable file
@@ -0,0 +1,78 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
source /mod/webif/lib/setup
|
||||
require ts.class
|
||||
|
||||
source /mod/webif/html/dedup/normalise.jim
|
||||
source /mod/webif/html/dedup/process.jim
|
||||
|
||||
set dirs {}
|
||||
|
||||
set doit 0
|
||||
foreach arg $argv {
|
||||
if {$arg eq "-yes"} {
|
||||
set doit 1
|
||||
} else {
|
||||
lappend dirs $arg
|
||||
}
|
||||
}
|
||||
if {![llength $dirs]} { lappend dirs [exec pwd] }
|
||||
|
||||
foreach dir $dirs {
|
||||
if {[string index $dir end] eq "/"} {
|
||||
set dir [string range $dir 0 end-1]
|
||||
}
|
||||
puts "\[$dir\]"
|
||||
loadseries $dir
|
||||
|
||||
foreach file [readdir $dir] {
|
||||
if {[file extension $file] ne ".hmt"} { continue }
|
||||
|
||||
set file "$dir/$file"
|
||||
|
||||
set base [file tail [file rootname $file]]
|
||||
lassign [dedupprocess $file] stat ts syn fn
|
||||
|
||||
puts -nonewline "$base -> "
|
||||
|
||||
switch $stat {
|
||||
inuse {
|
||||
puts -nonewline "In Use"
|
||||
}
|
||||
dup {
|
||||
puts -nonewline "Duplicate"
|
||||
if {$doit} {
|
||||
set dupdir "$dir/_duplicates"
|
||||
if {![file exists $dupdir]} {
|
||||
file mkdir $dupdir
|
||||
}
|
||||
while {[file exists $dupdir/$fn.hmt]} {
|
||||
append fn "~"
|
||||
}
|
||||
ts renamegroup $file "_duplicates/$fn"
|
||||
puts -nonewline " - Renamed to _duplicates/$fn"
|
||||
}
|
||||
}
|
||||
error {
|
||||
puts -nonewline "Cannot process"
|
||||
}
|
||||
nothing {
|
||||
puts -nonewline "Nothing to do"
|
||||
}
|
||||
preserve {
|
||||
puts -nonewline "Preserving"
|
||||
}
|
||||
ok {
|
||||
puts -nonewline $fn
|
||||
if {$doit} {
|
||||
# Dooooo, it.
|
||||
$ts settitle $syn
|
||||
ts renamegroup $file $fn
|
||||
puts -nonewline " ... Done"
|
||||
}
|
||||
}
|
||||
}
|
||||
puts ""
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
#!/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
|
||||
source process.jim
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
|
||||
@@ -15,6 +18,8 @@ set doit [cgi_get doit 0]
|
||||
|
||||
header
|
||||
|
||||
puts "<script type=text/javascript src=script.js></script>"
|
||||
|
||||
puts "<fieldset style=\"display: inline\">
|
||||
<legend>De-duplicate <span id=dir>$dir</span></legend>
|
||||
<table class=borders>
|
||||
@@ -26,38 +31,24 @@ 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 }
|
||||
altrow
|
||||
set ts [ts fetch $file 1]
|
||||
|
||||
set base [file tail [file rootname $file]]
|
||||
lassign [dedupprocess $file] stat ts syn fn
|
||||
|
||||
altrow
|
||||
puts "<td nowrap>$base</td>"
|
||||
set syn [$ts get synopsis]
|
||||
regsub -nocase -all -- {^new series\.* *} $syn "" syn
|
||||
regsub -nocase -all -- {^cbeebies\. *} $syn "" syn
|
||||
regsub -all -- { *[:].*$} $syn "" syn
|
||||
if {[string length $syn] > 40} {
|
||||
lassign [split $syn "."] v w
|
||||
set syn $v
|
||||
if {[string length $syn] < 6 && [string length $w] < 6} {
|
||||
append syn "_$w"
|
||||
}
|
||||
}
|
||||
if {[string length $syn] < 10} {
|
||||
if {[string match "${syn}*" [$ts get title]]} {
|
||||
set syn [$ts get title]
|
||||
} else {
|
||||
append syn " [$ts get title]"
|
||||
}
|
||||
}
|
||||
regsub -all -- {[\/ &]} $syn "_" fn
|
||||
puts "<td>$fn</td>"
|
||||
puts "<td>$syn</td>"
|
||||
puts "<td>"
|
||||
if {$fn in $seen} {
|
||||
switch $stat {
|
||||
inuse {
|
||||
puts -nonewline "In Use"
|
||||
}
|
||||
dup {
|
||||
puts -nonewline "Duplicate"
|
||||
if {$doit} {
|
||||
set dupdir "$dir/_duplicates"
|
||||
@@ -68,19 +59,25 @@ foreach file [readdir $dir] {
|
||||
ts renamegroup $file "_duplicates/$fn"
|
||||
puts -nonewline " - Renamed to _duplicates/$fn"
|
||||
}
|
||||
} elseif {[string length $syn] > 40} {
|
||||
}
|
||||
error {
|
||||
puts -nonewline "Cannot process"
|
||||
} elseif {$base eq $fn} {
|
||||
}
|
||||
nothing {
|
||||
puts -nonewline "Nothing to do"
|
||||
} elseif {[file exists "$dir/$fn.ts"]} {
|
||||
}
|
||||
preserve {
|
||||
puts -nonewline "Preserving"
|
||||
} elseif {$doit} {
|
||||
# Dooooo, it.
|
||||
$ts settitle $syn
|
||||
ts renamegroup $file $fn
|
||||
puts -nonewline "Done"
|
||||
}
|
||||
ok {
|
||||
if {$doit} {
|
||||
# Dooooo, it.
|
||||
$ts settitle $syn
|
||||
ts renamegroup $file $fn
|
||||
puts -nonewline "Done"
|
||||
}
|
||||
}
|
||||
}
|
||||
lappend seen $fn
|
||||
|
||||
puts "</td>"
|
||||
puts "</tr>"
|
||||
@@ -98,25 +95,8 @@ if {!$doit} { puts "<button id=dedup>Process folder</button>" }
|
||||
|
||||
puts {
|
||||
</small>
|
||||
|
||||
</div>
|
||||
|
||||
<script type=text/javascript>
|
||||
$('#browse').button().click(function() {
|
||||
window.location = '/cgi-bin/browse.jim?dir=' +
|
||||
encodeURIComponent($('#dir').text());
|
||||
});
|
||||
}
|
||||
|
||||
if {!$doit} {
|
||||
puts {
|
||||
$('#dedup').button().click(function() {
|
||||
window.location = window.location + '&doit=1';
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
puts "</script>"
|
||||
|
||||
footer
|
||||
|
||||
83
var/mongoose/html/dedup/normalise.jim
Executable file
83
var/mongoose/html/dedup/normalise.jim
Executable file
@@ -0,0 +1,83 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
set dedup_prefixes {
|
||||
{^new series\.* *}
|
||||
{^cbeebies\.* *}
|
||||
{^cbbc\.* *}
|
||||
{^brand new series *-* *}
|
||||
{^\.+}
|
||||
}
|
||||
|
||||
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 seriesmap
|
||||
|
||||
# Strip common prefixes
|
||||
foreach prefix $dedup_prefixes {
|
||||
regsub -nocase -all -- $prefix $title "" title
|
||||
}
|
||||
|
||||
# Strip anything following a colon.
|
||||
regsub -all -- { *[:].*$} $title "" title
|
||||
|
||||
# If the resulting string is longer than 40 characters then
|
||||
# split around . and take the left hand side if appropriate.
|
||||
if {[string length $title] > 40} {
|
||||
lassign [split $title "."] v w
|
||||
set title $v
|
||||
if {[string length $title] < 6 && [string length $w] < 6} {
|
||||
append title "_$w"
|
||||
}
|
||||
}
|
||||
|
||||
# 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
|
||||
} 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]
|
||||
}
|
||||
|
||||
return $title
|
||||
}
|
||||
|
||||
31
var/mongoose/html/dedup/process.jim
Executable file
31
var/mongoose/html/dedup/process.jim
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
require system.class
|
||||
|
||||
proc dedupprocess {file} {{seen {}}} {
|
||||
set ts [ts fetch $file 1]
|
||||
set dir [file dirname $file]
|
||||
set base [file tail [file rootname $file]]
|
||||
set syn [dedupnormalise [$ts get synopsis] [$ts get title]]
|
||||
# Escape special characters to create the filename.
|
||||
regsub -all -- {[\/ &]} $syn "_" fn
|
||||
regsub -all -- {[?]} $fn "" fn
|
||||
|
||||
set stat ok
|
||||
if {[system inuse [file rootname $file]]} {
|
||||
set stat inuse
|
||||
} elseif {$fn in $seen} {
|
||||
set stat dup
|
||||
} elseif {[string length $syn] > 40} {
|
||||
set stat error
|
||||
} elseif {$base eq $fn} {
|
||||
set stat nothing
|
||||
} elseif {[file exists "$dir/$fn.ts"]} {
|
||||
set stat preserve
|
||||
}
|
||||
|
||||
lappend seen $fn
|
||||
|
||||
return [list $stat $ts $syn $fn]
|
||||
}
|
||||
|
||||
14
var/mongoose/html/dedup/script.js
Executable file
14
var/mongoose/html/dedup/script.js
Executable file
@@ -0,0 +1,14 @@
|
||||
|
||||
$(function() {
|
||||
|
||||
$('#browse').button().click(function() {
|
||||
window.location = '/cgi-bin/browse.jim?dir=' +
|
||||
encodeURIComponent($('#dir').text());
|
||||
});
|
||||
|
||||
$('#dedup').button().click(function() {
|
||||
window.location = window.location + '&doit=1';
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
<!--#include virtual="/lib/header.shtml" -->
|
||||
|
||||
<fieldset style="display: inline; float: left; clear: left">
|
||||
<legend>Diagnostics</legend>
|
||||
Diagnostic:
|
||||
<input name=seq id=seq autocorrect=off autocapitalize=off
|
||||
value=general size=30 maxlength=50
|
||||
class="text ui-widget-content ui-corner-all">
|
||||
<button id=rundiag>Run Diagnostic</button>
|
||||
</fieldset>
|
||||
|
||||
<fieldset style="display: inline; float: left; clear: left">
|
||||
<legend>Log Files</legend>
|
||||
<!--#exec cmd="/mod/var/mongoose/include/logfiles.jim" -->
|
||||
</fieldset>
|
||||
|
||||
<div style="margin-top: 2em; display: none; float: left; clear: left"
|
||||
id=results></div>
|
||||
|
||||
<script type=text/javascript>
|
||||
$('#rundiag').button().click(function() {
|
||||
$('#results')
|
||||
.slideDown()
|
||||
.text('\n\nRunning diagnostic, please wait...\n\n')
|
||||
.load('/cgi-bin/diag.jim?diag=' +
|
||||
encodeURIComponent($('#seq').val()));
|
||||
});
|
||||
$('a.log').click(function() {
|
||||
$('#results')
|
||||
.slideDown()
|
||||
.text('\n\nLoading log, please wait...\n\n')
|
||||
.load('/cgi-bin/cat.jim?file=' +
|
||||
encodeURIComponent($(this).attr('file')), function() {
|
||||
$('#results').wrapInner('<pre>');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--#include virtual="/lib/footer.shtml" -->
|
||||
|
||||
139
var/mongoose/html/diag/diag.jim
Executable file
139
var/mongoose/html/diag/diag.jim
Executable file
@@ -0,0 +1,139 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require pretty_size
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
|
||||
header
|
||||
|
||||
puts {
|
||||
<script type=text/javascript src=/js/enadis.js></script>
|
||||
<script type=text/javascript src=script.js></script>
|
||||
|
||||
<fieldset class=cleft>
|
||||
<legend>Utilities</legend>
|
||||
<table>
|
||||
|
||||
<tr>
|
||||
<td>Run Diagnostic:</td>
|
||||
<td><input name=seq id=seq autocorrect=off autocapitalize=off
|
||||
value=general size=30 maxlength=50
|
||||
class="text ui-widget-content ui-corner-all">
|
||||
<button id=rundiag>Run Diagnostic</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Package:</td>
|
||||
<td><input name=fopkg id=fopkg autocorrect=off autocapitalize=off
|
||||
value='' size=30 maxlength=50
|
||||
class="text ui-widget-content ui-corner-all">
|
||||
<button id=runfopkg>Force re-install</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr><td colspan=2 style="height: 10px"></td></tr>
|
||||
|
||||
<tr>
|
||||
<td colspan=2 align=center>
|
||||
<button id=runedit style="width: 48%">File Editor</button>
|
||||
<button id=dbinfo style="width: 48%">Database Browser</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan=2 align=center>
|
||||
<button id=channelinfo style="width: 48%">Channel Information</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
}
|
||||
|
||||
if {[system model] eq "HDR"} {
|
||||
puts {
|
||||
<tr>
|
||||
<td colspan=2 align=center>
|
||||
<button id=dlna style="width: 48%">DLNA Server</button>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
|
||||
puts {
|
||||
|
||||
<tr><td colspan=2 style="height: 10px"></td></tr>
|
||||
|
||||
<tr>
|
||||
<td colspan=2>
|
||||
<button id=reboot style="width: 100%">Reboot System</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan=2>
|
||||
<button id=runreset style="width: 100%"
|
||||
}
|
||||
|
||||
if {[system modversion 1] < 200} {
|
||||
puts -nonewline " disabled class=ui-state-disabled"
|
||||
}
|
||||
|
||||
puts {
|
||||
>
|
||||
Remove all custom firmware packages and settings
|
||||
</button>
|
||||
}
|
||||
|
||||
if {[system modversion 1] < 200} {
|
||||
puts {
|
||||
<div class=footnote style="text-align: center">
|
||||
(Install custom firmware v2.00 to enable this option)
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
puts {
|
||||
|
||||
<div id=resetdone class="hidden blood">
|
||||
Restart your Humax with the remote control.<br>
|
||||
Allow it to turn off completely before restarting.<br>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
<span class=also style="padding-left: 5px">
|
||||
View:
|
||||
<a href=/jim/ref.html target=_blank>Jim Reference Manual</a> |
|
||||
<a href=/jim/oo.html target=_blank>OO</a> |
|
||||
<a href=/jim/sqlite.html target=_blank>Sqlite</a>
|
||||
</span>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class=left>
|
||||
<legend>View Log Files</legend>
|
||||
}
|
||||
|
||||
foreach file [lsort [concat \
|
||||
[glob -nocomplain /var/log/*.log] \
|
||||
[glob -nocomplain /mod/tmp/*.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>"
|
||||
}
|
||||
|
||||
puts {
|
||||
</fieldset>
|
||||
|
||||
<div style="margin-top: 2em; display: none; float: left; clear: left"
|
||||
id=results></div>
|
||||
|
||||
}
|
||||
|
||||
footer
|
||||
|
||||
@@ -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
|
||||
83
var/mongoose/html/diag/script.js
Normal file
83
var/mongoose/html/diag/script.js
Normal file
@@ -0,0 +1,83 @@
|
||||
|
||||
$(function() {
|
||||
|
||||
$('button').button();
|
||||
|
||||
$('#rundiag').click(function() {
|
||||
$('#results')
|
||||
.slideDown()
|
||||
.text('\n\nRunning diagnostic, please wait...\n\n')
|
||||
.load('rundiag.jim?diag=' +
|
||||
encodeURIComponent($('#seq').val()), function() {
|
||||
$('#results').wrapInner('<pre>');
|
||||
});
|
||||
});
|
||||
|
||||
$('#runfopkg').click(function() {
|
||||
$('#results')
|
||||
.slideDown()
|
||||
.text('\n\nForcibly re-installing package, please wait...\n\n')
|
||||
.load('/cgi-bin/opkg.jim?cmd=install+--force-reinstall+' +
|
||||
encodeURIComponent($('#fopkg').val()), function() {
|
||||
$('#results').wrapInner('<pre>');
|
||||
$('#fopkg').val('');
|
||||
});
|
||||
});
|
||||
|
||||
$('a.log').click(function() {
|
||||
$('#results')
|
||||
.slideDown()
|
||||
.text('\n\nLoading log, please wait...\n\n')
|
||||
.load('/cgi-bin/cat.jim?file=' +
|
||||
encodeURIComponent($(this).attr('file')), function() {
|
||||
$('#results').wrapInner('<pre>');
|
||||
});
|
||||
});
|
||||
|
||||
$('#runedit').click(function(e) {
|
||||
e.preventDefault();
|
||||
window.location = '/edit/edit.jim';
|
||||
});
|
||||
|
||||
$('#dbinfo').click(function(e) {
|
||||
e.preventDefault();
|
||||
window.location = '/cgi-bin/db.jim';
|
||||
});
|
||||
|
||||
$('#channelinfo').click(function(e) {
|
||||
e.preventDefault();
|
||||
window.location = '/cgi-bin/channel.jim';
|
||||
});
|
||||
|
||||
$('#dlna').click(function(e) {
|
||||
e.preventDefault();
|
||||
window.location = '/dlna/dlna.jim';
|
||||
});
|
||||
|
||||
$('#reboot').click(function(e) {
|
||||
e.preventDefault();
|
||||
if (confirm('Are you sure you wish to perform a reboot now?'))
|
||||
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';
|
||||
});
|
||||
|
||||
$('#runreset').click(function(e) {
|
||||
e.preventDefault();
|
||||
if (!confirm('Are you sure? This will completely remove all packages and settings.'))
|
||||
return;
|
||||
if (!confirm('Are you really sure?'))
|
||||
return;
|
||||
if (!confirm('One last time, are you sure?'))
|
||||
return;
|
||||
$.get('/cgi-bin/cfwreset.cgi', function() {
|
||||
$('button').disable();
|
||||
$('#resetdone').slideDown();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
84
var/mongoose/html/dlna/dlna.jim
Executable file
84
var/mongoose/html/dlna/dlna.jim
Executable file
@@ -0,0 +1,84 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
package require sqlite3
|
||||
source /mod/webif/lib/setup
|
||||
require ts.class pretty_size
|
||||
|
||||
puts "Content-Type: text/html\r\n\r\n"
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
header
|
||||
|
||||
#append dmsfile ".rr"
|
||||
|
||||
set vars {
|
||||
object.container 0
|
||||
object.item.videoItem.movie 0
|
||||
object.item.imageItem.photo 0
|
||||
object.item.audioItem.musicTrack 0
|
||||
}
|
||||
|
||||
if {[file exists $dmsfile] && ![catch {set db [sqlite3.open $dmsfile]}]} {
|
||||
catch {
|
||||
foreach ret [$db query "
|
||||
select class, count(*) from tblObject group by 1
|
||||
"] {
|
||||
lassign $ret x class x num
|
||||
set vars($class) $num
|
||||
}
|
||||
}
|
||||
$db close
|
||||
}
|
||||
|
||||
if {[system param DMS_START_ON]} {
|
||||
set cfgstat "Enabled"
|
||||
} else {
|
||||
set cfgstat "Disabled"
|
||||
}
|
||||
|
||||
if {[system is_listening 9000]} {
|
||||
set stat "Running."
|
||||
set img "745_1_10_Video_2Live.png"
|
||||
} else {
|
||||
set stat "Not running."
|
||||
set img "745_1_11_Video_1REC.png"
|
||||
}
|
||||
|
||||
puts "
|
||||
<script type=text/javascript src=script.js></script>
|
||||
<fieldset class=cleft>
|
||||
<legend>DLNA Server Information</legend>
|
||||
|
||||
<table class=keyval cellpadding=5>
|
||||
<tr>
|
||||
<th>Server Status</th>
|
||||
<td class=va>$cfgstat - <img class=va src=/images/$img> $stat</td>
|
||||
</tr><tr>
|
||||
<th>Folders Indexed</th>
|
||||
<td>$vars(object.container)</td>
|
||||
</tr><tr>
|
||||
<th>Movies Indexed</th>
|
||||
<td>$vars(object.item.videoItem.movie)</td>
|
||||
</tr><tr>
|
||||
<th>Photos Indexed</th>
|
||||
<td>$vars(object.item.imageItem.photo)</td>
|
||||
</tr><tr>
|
||||
<th>Music Tracks Indexed</th>
|
||||
<td>$vars(object.item.audioItem.musicTrack)</td>
|
||||
</tr><tr>
|
||||
|
||||
</table>
|
||||
</fieldset>
|
||||
<div class=cleft style=\"padding-top: 0.5em\">
|
||||
<button id=dlnareset>Reset DLNA Database</button>
|
||||
</div>
|
||||
<div id=results class=\"cleft hidden blood\"
|
||||
style=\"border: solid 1px #ccc; margin: 1em; padding: 1em;\">
|
||||
</div>
|
||||
"
|
||||
|
||||
footer
|
||||
|
||||
27
var/mongoose/html/dlna/reset.jim
Executable file
27
var/mongoose/html/dlna/reset.jim
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
source /mod/webif/lib/setup
|
||||
require system.class
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
|
||||
set menupath "Settings->System->Internet Setting->Content Share"
|
||||
set dbpath "/mnt/hd2/dms_cds.db"
|
||||
|
||||
if {[system param DMS_START_ON] || [system is_listening 9000]} {
|
||||
puts "To reset the DLNA Database, disable <i>Content Sharing</i>"
|
||||
puts " in the Humax menus at<br>"
|
||||
puts "<span class=also style=\"padding-left: 5em\">$menupath</span><br>"
|
||||
puts "and click the button again."
|
||||
} elseif {![file exists $dbpath]} {
|
||||
puts "The DLNA Database does not exist.<br>"
|
||||
puts "(already reset?)"
|
||||
} else {
|
||||
file delete $dbpath
|
||||
puts "The DLNA Database has been reset.<br>"
|
||||
puts "You can now re-enable <i>Content Sharing</i> in the Humax menus."
|
||||
puts "<br>"
|
||||
puts "<span class=also style=\"padding-left: 5em\">$menupath</span><br>"
|
||||
}
|
||||
|
||||
11
var/mongoose/html/dlna/script.js
Normal file
11
var/mongoose/html/dlna/script.js
Normal file
@@ -0,0 +1,11 @@
|
||||
$(function() {
|
||||
|
||||
$('button').button();
|
||||
|
||||
$('#dlnareset').click(function(e) {
|
||||
e.preventDefault();
|
||||
$('#results').empty().slideDown().load('reset.jim');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
18
var/mongoose/html/edit/create.jim
Executable file
18
var/mongoose/html/edit/create.jim
Executable 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
|
||||
}
|
||||
|
||||
74
var/mongoose/html/edit/edit.jim
Executable file
74
var/mongoose/html/edit/edit.jim
Executable file
@@ -0,0 +1,74 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
|
||||
header
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
set file [cgi_get file "/tmp/hosts"]
|
||||
|
||||
puts {
|
||||
<script type=text/javascript src=/js/enadis.js></script>
|
||||
<script type=text/javascript src=/js/tabsupport.js></script>
|
||||
<script type=text/javascript src=/js/jqueryFileTree.js></script>
|
||||
<link rel=stylesheet type=text/css href=/css/jqueryFileTree.css />
|
||||
<script type=text/javascript src=script.js></script>
|
||||
<link rel=stylesheet href=style.css type=text/css />
|
||||
|
||||
<fieldset class=cleft>
|
||||
<legend>File Editor</legend>
|
||||
|
||||
<div id=msg class=blood style="padding-bottom: 0.7em">
|
||||
Use the <i>Open</i> button below to begin.
|
||||
</div>
|
||||
|
||||
<textarea cols=80 rows=20 id=editor></textarea>
|
||||
|
||||
<br>
|
||||
<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" />
|
||||
|
||||
</fieldset>
|
||||
|
||||
<div class=cleft>
|
||||
<button id=back>Back to diagnostics</button>
|
||||
</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
|
||||
|
||||
43
var/mongoose/html/edit/files.jim
Executable file
43
var/mongoose/html/edit/files.jim
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
|
||||
set root [cgi_get dir]
|
||||
|
||||
set files [lsort [readdir -nocomplain $root]]
|
||||
|
||||
puts "<ul class=jqueryFileTree class=hidden>"
|
||||
|
||||
foreach dir $files {
|
||||
set path "$root/$dir"
|
||||
regsub -all -- {\/+} $path "/" path
|
||||
if {![file isdirectory $path]} continue
|
||||
puts -nonewline "<li class=\"directory collapsed\"><a href=# rel=\""
|
||||
puts -nonewline [cgi_quote_html $path]
|
||||
puts "\">[cgi_quote_html $dir]</a></li>"
|
||||
}
|
||||
|
||||
foreach file $files {
|
||||
set path "$root/$file"
|
||||
regsub -all -- {\/+} $path "/" path
|
||||
if {[file isdirectory $path]} continue
|
||||
set ext [file extension $file]
|
||||
puts -nonewline "<li class=\"file"
|
||||
if {[string length $ext]} {
|
||||
puts -nonewline " ext_[string range $ext 1 end]"
|
||||
}
|
||||
puts -nonewline "\">"
|
||||
puts -nonewline "<a href=# rel=\"[cgi_quote_html $path]\">"
|
||||
puts -nonewline [cgi_quote_html $file]
|
||||
puts "</a></li>"
|
||||
}
|
||||
|
||||
puts "</ul>"
|
||||
|
||||
32
var/mongoose/html/edit/get.jim
Executable file
32
var/mongoose/html/edit/get.jim
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require chunked pretty_size
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
set file [cgi_get file "/tmp/hosts"]
|
||||
if {$file eq "-"} { exit }
|
||||
|
||||
start_chunked "text/plain"
|
||||
|
||||
if {![file exists $file]} {
|
||||
chunk ">>> File $file does not exist.\r\n"
|
||||
} else {
|
||||
set type [exec /mod/bin/file --brief --mime-type --dereference $file]
|
||||
if {![string match {text/*} $type]} {
|
||||
chunk ">>> File $file is not a plain file ($type)"
|
||||
} elseif {[file size $file] > 102400} {
|
||||
chunk ">>> File $file is too large."
|
||||
chunk ">>> [pretty_size [file size $file]]"
|
||||
} else {
|
||||
set fp [open $file r]
|
||||
chunk [read $fp]
|
||||
close $fp
|
||||
}
|
||||
}
|
||||
|
||||
end_chunked
|
||||
|
||||
23
var/mongoose/html/edit/put.jim
Executable file
23
var/mongoose/html/edit/put.jim
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
set file [cgi_get file "/tmp/testfile"]
|
||||
if {$file eq "-"} { exit }
|
||||
set data [cgi_get data]
|
||||
|
||||
if {[catch {set fp [open $file w]} msg]} {
|
||||
puts "Error, $msg"
|
||||
} else {
|
||||
$fp puts -nonewline $data
|
||||
close $fp
|
||||
puts "File saved."
|
||||
}
|
||||
|
||||
147
var/mongoose/html/edit/script.js
Normal file
147
var/mongoose/html/edit/script.js
Normal file
@@ -0,0 +1,147 @@
|
||||
|
||||
$(function() {
|
||||
|
||||
var file = null;
|
||||
var changed = false;
|
||||
|
||||
$('button').button();
|
||||
$('button.editactive').disable();
|
||||
$('#editor').tabsupport().disable();
|
||||
|
||||
function loadfile(f)
|
||||
{
|
||||
if (!f)
|
||||
f = file;
|
||||
|
||||
$('button.editactive').disable();
|
||||
$('#editor').disable().val('');
|
||||
$('#msg').text('Loading ' + f);
|
||||
$.get('get.jim?file=' + encodeURIComponent(f), function(data) {
|
||||
if (data.match('^>>>'))
|
||||
{
|
||||
$('#msg').text(data);
|
||||
file = null;
|
||||
changed = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#editor').val(data).enable();
|
||||
$('button.editactive').enable();
|
||||
$('#msg').html('Editing <i>' + f + '</i>');
|
||||
file = f;
|
||||
changed = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function result(msg)
|
||||
{
|
||||
$('#result')
|
||||
.html(msg)
|
||||
.slideDown('slow')
|
||||
.delay(5000)
|
||||
.slideUp('slow');
|
||||
}
|
||||
|
||||
$('#chooser').fileTree({
|
||||
root: '/',
|
||||
script: 'files.jim',
|
||||
multiFolder: false
|
||||
}, function(file) {
|
||||
$('#chooserd').dialog('close');
|
||||
loadfile(file);
|
||||
});
|
||||
|
||||
$('#chooserd').dialog({
|
||||
title: "Choose File to Edit",
|
||||
modal: true, autoOpen: false,
|
||||
height: '500', width: '600',
|
||||
draggable: true, resizable: true,
|
||||
closeOnEscape: true,
|
||||
buttons: {
|
||||
"Cancel" : function() {$(this).dialog('close');}
|
||||
}
|
||||
});
|
||||
|
||||
$('#open').click(function() {
|
||||
$('#chooserd').dialog('open');
|
||||
});
|
||||
|
||||
$('#editor').change(function() {
|
||||
changed = true;
|
||||
});
|
||||
|
||||
$('#save').click(function() {
|
||||
if (!changed)
|
||||
{
|
||||
result('No changes to save.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!confirm('Save file?'))
|
||||
return;
|
||||
$.post('put.jim', {
|
||||
'file': file,
|
||||
'data': $('#editor').val()
|
||||
}, function(data) {
|
||||
result(data);
|
||||
});
|
||||
});
|
||||
|
||||
$('#revert').click(function() {
|
||||
if (!changed)
|
||||
{
|
||||
result('No changes to revert.');
|
||||
return;
|
||||
}
|
||||
if (!confirm('Discard changes and re-load file?'))
|
||||
return;
|
||||
loadfile();
|
||||
});
|
||||
|
||||
$('#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');
|
||||
});
|
||||
|
||||
});
|
||||
24
var/mongoose/html/edit/style.css
Normal file
24
var/mongoose/html/edit/style.css
Normal file
@@ -0,0 +1,24 @@
|
||||
textarea
|
||||
{
|
||||
background: white;
|
||||
color: black;
|
||||
}
|
||||
|
||||
#filename
|
||||
{
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.loading
|
||||
{
|
||||
font-style: italic;
|
||||
color: #aaa;
|
||||
background: white;
|
||||
}
|
||||
|
||||
#chooser
|
||||
{
|
||||
border: solid 1px #bbb;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
@@ -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" -->
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
blank.png
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 4.4 KiB |
@@ -1 +0,0 @@
|
||||
302.png -
|
||||
@@ -1 +0,0 @@
|
||||
303.png -
|
||||
@@ -1 +0,0 @@
|
||||
305.png -
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 8.1 KiB |
@@ -1 +0,0 @@
|
||||
4Music.png
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user