Compare commits
101 Commits
0.8.13@214
...
0.11.0@136
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f550931f71 | ||
|
|
a294c084b3 | ||
|
|
7172c7c107 | ||
|
|
f7933beaf8 | ||
|
|
3dbc3cbf82 | ||
|
|
41047e8668 | ||
|
|
d6df19dd32 | ||
|
|
79bff00465 | ||
|
|
4ce9701792 | ||
|
|
6ff5b7a8e3 | ||
|
|
25523058f0 | ||
|
|
d661c8016e | ||
|
|
ebcd6cdbf7 | ||
|
|
4fe5bd1bff | ||
|
|
d5679ead84 | ||
|
|
e666711eeb | ||
|
|
775add8c04 | ||
|
|
d4dc56b816 | ||
|
|
e720740507 | ||
|
|
3c327ff80d | ||
|
|
d05632e8d3 | ||
|
|
c208e186c3 | ||
|
|
328ca16b5c | ||
|
|
e15b82fe2d | ||
|
|
0a2c7966b5 | ||
|
|
57b78c4c0d | ||
|
|
eb0adb8f29 | ||
|
|
6e06f3875a | ||
|
|
b691be415a | ||
|
|
c149d7ae3c | ||
|
|
38757583bb | ||
|
|
dec82728cb | ||
|
|
49170bdd39 | ||
|
|
1bf67cf177 | ||
|
|
e669a3d08f | ||
|
|
39ed7752bc | ||
|
|
e4f61f4047 | ||
|
|
4e36ecc6f0 | ||
|
|
d2712f2a76 | ||
|
|
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 | ||
|
|
ef1e7b82e8 | ||
|
|
1a7cb41a16 | ||
|
|
7a66306f78 | ||
|
|
a014fec23d | ||
|
|
d307699ab1 | ||
|
|
3f6e8754c6 | ||
|
|
742a56485a | ||
|
|
fa9905d8bd | ||
|
|
a3ecbe1d3f | ||
|
|
924bc72832 | ||
|
|
909605b074 | ||
|
|
f62904edb4 | ||
|
|
8d36fe22dd | ||
|
|
2e0d49537d | ||
|
|
572e31efcc |
@@ -1,9 +1,9 @@
|
||||
Package: webif
|
||||
Priority: optional
|
||||
Section: web
|
||||
Version: 0.8.13
|
||||
Version: 0.11.0
|
||||
Architecture: mipsel
|
||||
Maintainer: af123@hummypkg.org.uk
|
||||
Depends: mongoose(>=3.0-7),jim(>=0.71-1),jim-sqlite3(>=0.71-1),jim-cgi(>=0.5),jim-oo,jim-pack,service-control,busybox(>=1.19.3-1),lsof,epg(>=1.0.8),hmt(>=1.1.4),ssmtp,anacron,trm,openssl-command,nicesplice,id3v2
|
||||
Suggests: ffmpeg,webif-iphone
|
||||
Depends: webif-channelicons(>=1.0.4),mongoose(>=3.0-7),jim(>=0.73-1),jim-oo,jim-sqlite3(>=0.73-1),jim-cgi(>=0.6),jim-binary,service-control(>=1.2),busybox(>=1.20.2-1),lsof,epg(>=1.0.9-1),hmt(>=1.1.10),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2),stripts(>=1.1.2),smartmontools,tmenu(>=1.05)
|
||||
Suggests: ffmpeg
|
||||
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
bin/status
Symbolic link
1
bin/status
Symbolic link
@@ -0,0 +1 @@
|
||||
../webif/cgi-bin/status.jim
|
||||
@@ -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."
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ function refresh_files()
|
||||
.button('option', 'disabled', false);
|
||||
$('#delete_button').removeAttr('disabled')
|
||||
.button('option', 'disabled', false);
|
||||
$('#view_button').removeAttr('disabled')
|
||||
.button('option', 'disabled', false);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -38,6 +40,15 @@ $(document).ready(function() {
|
||||
});
|
||||
}
|
||||
});
|
||||
$('#view_button').click(function() {
|
||||
var backup = $('input.restore:checked').val();
|
||||
$('#results').load('/cgi-bin/backup/view.jim?' +
|
||||
$('input.restore').serialize(), function() {
|
||||
$('#results').slideDown(function() {
|
||||
refresh_files();
|
||||
});
|
||||
});
|
||||
});
|
||||
$('#restore_button').click(function() {
|
||||
var backup = $('input.restore:checked').val();
|
||||
if (confirm('!!!!!!!!!!!!!!!!!!!!!!!!! PLEASE CONFIRM !!!!!!!!!!!!!!!!!!!!!!!!!\n\nAre you sure you wish to erase all scheduled recordings and favourite channels and then restore them from\n' + backup + '?'))
|
||||
|
||||
@@ -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
|
||||
|
||||
60
var/mongoose/cgi-bin/backup/view.jim
Executable file
60
var/mongoose/cgi-bin/backup/view.jim
Executable file
@@ -0,0 +1,60 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
|
||||
require rsv.class findhsvc
|
||||
|
||||
set dir /mod/var/backup
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
#set _cgi(restore_file) "backup-2011-Jul-09-20:37"
|
||||
|
||||
if {![dict exists $_cgi restore_file]} {
|
||||
puts "No filename supplied."
|
||||
exit
|
||||
}
|
||||
|
||||
set file [file tail [dict get $_cgi restore_file]]
|
||||
set ffile "/$dir/$file.rbk"
|
||||
|
||||
if {![file exists $ffile]} {
|
||||
puts "Backup file <i>$file</i> does not exist."
|
||||
exit
|
||||
}
|
||||
|
||||
if {[catch { set fd [open $ffile r] } msg]} {
|
||||
puts "Error opening <i>$file</i> - $msg"
|
||||
exit
|
||||
}
|
||||
|
||||
puts "Listing scheduled events from <i>$file</i>..."
|
||||
|
||||
set fields [lsort [[rsv] vars]]
|
||||
|
||||
set data [split [read $fd] "\n"]
|
||||
|
||||
foreach line $data {
|
||||
set vals [split $line "\t"]
|
||||
if {[lindex $vals 0] ne "event"} { continue }
|
||||
set vars {}
|
||||
set i 0
|
||||
foreach f $fields {
|
||||
if {$f eq "aulEventToRecordInfo"} { continue }
|
||||
incr i
|
||||
lappend vars $f [lindex $vals $i]
|
||||
}
|
||||
|
||||
set rsv [rsv new $vars]
|
||||
|
||||
puts " [$rsv name] ([$rsv channel_name])"
|
||||
}
|
||||
|
||||
close $fd
|
||||
rsv cleanup
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/setup
|
||||
require ts.class pretty_size system.class settings.class escape
|
||||
source /mod/webif/lib/setup
|
||||
require ts.class pretty_size system.class settings.class escape browse.class
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
@@ -30,12 +30,18 @@ if {$order eq "-"} {
|
||||
[settings new] sortorder $order
|
||||
}
|
||||
|
||||
set model [system model]
|
||||
set dustbin [system dustbin 1]
|
||||
|
||||
proc directory {file bfile} {
|
||||
global flatten
|
||||
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 ">"
|
||||
}
|
||||
|
||||
regsub -all " +" $bfile "" tbfile
|
||||
proc directory {file bfile tbfile} {
|
||||
puts "<div class=va>"
|
||||
set img "/images/711_1_09_Media_Folder.png"
|
||||
if {$bfile eq $::dustbin} { set img "/img/Dustbin_Folder.png" }
|
||||
@@ -47,23 +53,16 @@ proc directory {file bfile} {
|
||||
puts "$bfile</a><span class=filesize id=\"$tbfile\">
|
||||
</span>"
|
||||
|
||||
set noflat 0
|
||||
if $flatten {
|
||||
if {[string match {\[*\]} [file tail $file]]} { set noflat 1 }
|
||||
if {[file exists "$file/.noflatten"]} {
|
||||
set noflat 1
|
||||
}
|
||||
lassign [{dir iconset} $file] icons attrs
|
||||
|
||||
if $noflat {
|
||||
puts "<img alt=\"No-flatten\" title=\"No-flatten\"
|
||||
class=va src=/img/flat-tyre.png height=21>"
|
||||
}
|
||||
}
|
||||
puts "<span class=iconset>"
|
||||
puts [join $icons ""]
|
||||
puts "</span>"
|
||||
|
||||
puts -nonewline "
|
||||
<a href=#>
|
||||
<img class=\"dopt va\" border=0 width=45 "
|
||||
if $flatten { puts -nonewline "noflat=$noflat " }
|
||||
puts -nonewline [join $attrs " "]
|
||||
puts "
|
||||
src=/images/181_1_00_Help5_OPT_Plus.png>
|
||||
</a>
|
||||
@@ -77,18 +76,20 @@ proc directory {file bfile} {
|
||||
|
||||
proc entry {file} {{i 0}} {
|
||||
set bfile [file tail $file]
|
||||
regsub -all " +" $bfile "" tbfile
|
||||
if {[string index $bfile 0] == "\025"} {
|
||||
set bfile [string range $bfile 1 end]
|
||||
}
|
||||
if [file isdirectory "$file"] {
|
||||
directory $file $bfile
|
||||
continue
|
||||
directory $file $bfile $tbfile
|
||||
return
|
||||
}
|
||||
set ext [file extension $file]
|
||||
if {$ext in $::ignore || $ext ni $::include} { continue }
|
||||
if {$ext in $::ignore || $ext ni $::include} { return }
|
||||
|
||||
file stat $file st
|
||||
set sz [pretty_size $st(size)]
|
||||
set rsz $st(size)
|
||||
set sz [pretty_size $rsz]
|
||||
|
||||
set base [file rootname $file]
|
||||
|
||||
@@ -96,16 +97,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
|
||||
@@ -144,7 +148,22 @@ proc entry {file} {{i 0}} {
|
||||
set odencd 1
|
||||
set def unknown
|
||||
set bx 0
|
||||
set dlna 0
|
||||
if {$type eq "ts"} {
|
||||
set genre [$ts get genre]
|
||||
set glist [ts genrelist]
|
||||
if {[dict exists $glist $genre]} {
|
||||
set ret $glist($genre)
|
||||
} else {
|
||||
set ret $glist(0)
|
||||
}
|
||||
lassign $ret txt img
|
||||
if {$img eq "Unclassified"} {
|
||||
icon "/images/173_3_26_G3_$img.png" $txt
|
||||
} else {
|
||||
icon "/images/173_3_00_G3_$img.png" $txt
|
||||
}
|
||||
|
||||
# HD / SD
|
||||
if {[$ts get definition] eq "HD"} {
|
||||
set def HD
|
||||
@@ -153,34 +172,42 @@ proc entry {file} {{i 0}} {
|
||||
set def SD
|
||||
set img "172_1_26_SD"
|
||||
}
|
||||
puts "<img class=va src=/images/$img.png height=21>"
|
||||
icon "/images/$img.png"
|
||||
|
||||
# Locked
|
||||
if {[$ts flag "Locked"] > 0} {
|
||||
set locked 1
|
||||
puts "<img class=va src=/images/178_1_00_Icon_Lock.png
|
||||
height=21>"
|
||||
icon "/images/178_1_00_Icon_Lock.png" "Locked"
|
||||
}
|
||||
|
||||
# Encrypted
|
||||
if {[$ts flag "Encrypted"] > 0} {
|
||||
set encd 1
|
||||
puts "<img class=va
|
||||
src=/images/749_1_26_Video_Encryption.png
|
||||
height=21>"
|
||||
icon "/images/749_1_26_Video_Encryption.png" ""
|
||||
}
|
||||
if {![$ts flag "ODEncrypted"]} {
|
||||
puts "<img class=va src=/img/Decrypted.png height=21>"
|
||||
set odencd 0
|
||||
icon "/img/Decrypted.png" "Decrypted"
|
||||
}
|
||||
|
||||
# Guidance
|
||||
if {[$ts flag "Guidance"] > 0} {
|
||||
puts "<img class=va
|
||||
src=/images/174_1_26_GuidancePolicy.png
|
||||
height=21>"
|
||||
icon "/images/174_1_26_GuidancePolicy.png"
|
||||
}
|
||||
|
||||
# Indexed
|
||||
if {$::model eq "HDR" && [llength [$ts dlnaloc]]} {
|
||||
icon "/img/dlna.png" "Indexed by DLNA Server"
|
||||
set dlna 1
|
||||
}
|
||||
|
||||
# Shrunk (shown when necessary via Ajax)
|
||||
icon "/img/compress.png" "Shrunk" \
|
||||
"id=\"sp_$tbfile\"" "va hidden"
|
||||
# Timeshifted (shown when necessary via Ajax)
|
||||
icon "/img/clock.png" "Time-shifted Recording" \
|
||||
"id=\"tsr_$tbfile\"" "va hidden"
|
||||
|
||||
set bx [$ts get bookmarks]
|
||||
}
|
||||
|
||||
@@ -188,9 +215,10 @@ 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
|
||||
odencd=$odencd
|
||||
rsize=$rsz
|
||||
odencd=$odencd dlna=$dlna
|
||||
src=/images/181_1_00_Help5_OPT_Plus.png>
|
||||
</a>
|
||||
<div class=\"results blood\" style=\"margin: 0 0 0 5em\"></div>
|
||||
@@ -207,14 +235,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>
|
||||
@@ -244,13 +273,12 @@ if {$parent ne ""} {
|
||||
"
|
||||
}
|
||||
|
||||
# Strip double slashes
|
||||
regsub -all -- {\/+} "$dir/*" "/" dir
|
||||
|
||||
# Escape square brackets (for glob)
|
||||
regsub -all {([\\[])} $dir {\\\1} dir
|
||||
|
||||
proc s_time {a b} {
|
||||
global dir
|
||||
|
||||
set a "$dir/$a"
|
||||
set b "$dir/$b"
|
||||
|
||||
set ad [file isdirectory $a]
|
||||
set bd [file isdirectory $b]
|
||||
|
||||
@@ -262,9 +290,9 @@ proc s_time {a b} {
|
||||
return 0
|
||||
}
|
||||
|
||||
file stat $a l
|
||||
if {[catch {file stat $a l}]} { return 0}
|
||||
set at $l(ctime)
|
||||
file stat $b l
|
||||
if {[catch {file stat $b l}]} { return 0}
|
||||
set bt $l(ctime)
|
||||
|
||||
if {$at < $bt} { return -1 }
|
||||
@@ -272,13 +300,13 @@ proc s_time {a b} {
|
||||
return 0
|
||||
}
|
||||
|
||||
set files [glob -nocomplain $dir]
|
||||
set files [readdir -nocomplain $dir]
|
||||
switch $order {
|
||||
1 { set files [lsort -command s_time $files] }
|
||||
default { set files [lsort $files] }
|
||||
}
|
||||
|
||||
foreach file $files { entry $file }
|
||||
foreach file $files { entry "$dir/$file" }
|
||||
|
||||
puts "<a href=# id=selectall>Select all</a> | <a href=# id=deselectall>none</a>"
|
||||
|
||||
@@ -321,7 +349,6 @@ puts "<div class=brow>"
|
||||
puts {
|
||||
<button id=copy>Copy</button>
|
||||
<button id=cut>Cut</button>
|
||||
<button id=paste>Paste</button>
|
||||
<button id=delete>Delete</button>
|
||||
<button id=newdir>New Folder</button>
|
||||
<div id=deletewait class=blood style="display: none">
|
||||
@@ -348,6 +375,7 @@ if {[file exists /mnt/hd3/Streamer_down_file]} {
|
||||
puts {
|
||||
<button id=save_stream file=/mnt/hd3/Streamer_down_file>
|
||||
Save last streamed content (e.g. iPlayer/YouTube)
|
||||
<div id=streamstatus></div>
|
||||
</button>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,39 +13,67 @@ puts {
|
||||
<li><a href=#download>Download</a></li>
|
||||
|
||||
}
|
||||
if {[system model] eq "HDR"} {
|
||||
puts { <li class="separator"><a href=#decrypt>Decrypt</a></li> }
|
||||
if {$model eq "HDR"} {
|
||||
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 { <li class="cut"><a href=#crop>Crop</a></li> }
|
||||
puts {
|
||||
<li class="cut"><a href=#crop>Crop</a></li>
|
||||
<li class="cut"><a href=#chunk>Split (45m parts)</a></li>
|
||||
}
|
||||
}
|
||||
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 class=separator><a href=#rename>Rename</a></li>
|
||||
<li><a href=#download>Download</a></li>
|
||||
</ul>
|
||||
|
||||
<ul id=doptmenu class=contextMenu style="width: 250px">
|
||||
<li class=delete><a href=#delete>Delete</a></li>
|
||||
<li class=cut><a href=#cut>Cut to clipboard</a></li>
|
||||
<li class=pwcopy><a href=#copy>Copy to clipboard</a></li>
|
||||
<li class=pwpaste><a href=#paste>Paste to folder</a></li>
|
||||
<li class=separator><a href=#rename>Rename</a></li>
|
||||
<li class=separator><a href=#resetnew>Reset new flag</a></li>
|
||||
<li class="separator compress"><a href=#shrink>Auto-Shrink</a></li>
|
||||
<li class="compressr"><a href=#shrinkr>Recursive 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>
|
||||
<li class=decryptr><a href=#decryptr>Recursive Auto-Decrypt
|
||||
</a></li>
|
||||
}
|
||||
}
|
||||
if $flatten {
|
||||
puts { <li class="separator"><a href=#flat>No-Flatten</a></li> }
|
||||
}
|
||||
|
||||
puts {
|
||||
<li class=mpg><a href=#mpg>Auto-MPG Extract</a></li>
|
||||
</ul>
|
||||
|
||||
<div id=renameform title="Rename media file" style="display: none">
|
||||
<form id=renameform_form>
|
||||
<input type=hidden name="renameorig" id="renameorig" value="">
|
||||
<input type=hidden name="titleorig" id="titleorig" value="">
|
||||
<input type=hidden name="renamefile" id="renamefile" value="">
|
||||
<table border=0>
|
||||
<tr>
|
||||
<th>
|
||||
@@ -59,21 +87,79 @@ puts {
|
||||
class="text ui-widget-content ui-corner-all">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr style="display: none" class=tstype>
|
||||
<th>
|
||||
<label for="renametitle" style="padding-top: 0.5em">
|
||||
<label for="rename_title" style="padding-top: 0.5em">
|
||||
<b>New Medialist Title</b>
|
||||
</label>
|
||||
</th>
|
||||
<td>
|
||||
<input type=text name="renametitle" id="renametitle"
|
||||
<input type=text name="rename_title" id="rename_title"
|
||||
value="" size=70 maxlength=48
|
||||
class="text ui-widget-content ui-corner-all">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr style="display: none" class=tstype>
|
||||
<td colspan=2 id=synopsis style="font-style: italic"></td>
|
||||
<th>
|
||||
<label for="rename_synopsis" style="padding-top: 0.5em">
|
||||
<b>New Synopsis</b>
|
||||
</label>
|
||||
</th>
|
||||
<td>
|
||||
<textarea name="rename_synopsis" id="rename_synopsis"
|
||||
value="" cols=70 rows=4
|
||||
class="text ui-widget-content ui-corner-all"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr style="display: none" class=tstype>
|
||||
<th>
|
||||
<label for="rename_guidance" style="padding-top: 0.5em">
|
||||
<b>New Guidance Text</b>
|
||||
</label>
|
||||
</th>
|
||||
<td>
|
||||
<input type=text name="rename_guidance" id="rename_guidance"
|
||||
value="" size=70 maxlength=74
|
||||
class="text ui-widget-content ui-corner-all">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr style="display: none" class=tstype>
|
||||
<th>
|
||||
<label for="rename_genre" style="padding-top: 0.5em">
|
||||
<b>New Genre</b>
|
||||
</label>
|
||||
</th>
|
||||
<td>
|
||||
<select name="rename_genre" id="rename_genre"
|
||||
style="vertical-align: middle"
|
||||
class="text ui-widget-content ui-corner-all">
|
||||
}
|
||||
|
||||
set glist [ts genrelist]
|
||||
foreach genre [array names glist] {
|
||||
lassign $glist($genre) txt img
|
||||
if {$img eq "Unclassified"} {
|
||||
set img /images/173_3_26_G3_$img.png
|
||||
} else {
|
||||
set img /images/173_3_00_G3_$img.png
|
||||
}
|
||||
puts "<option value=$genre style=\"
|
||||
background: url($img) no-repeat left;
|
||||
padding: 8px 0 8px 30px;
|
||||
vertical-align: middle;
|
||||
\" onclick=\"this.parentNode.setAttribute('style',
|
||||
this.getAttribute('style'));\">$txt"
|
||||
}
|
||||
|
||||
puts {
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -1,109 +0,0 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require sqlite3
|
||||
package require cgi
|
||||
source /mod/var/mongoose/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]
|
||||
|
||||
if {[cgi_get do] eq "it"} {
|
||||
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 -f mp3 \
|
||||
-vn -acodec copy "${base}.mp3"]
|
||||
|
||||
if {[system pkginst id3v2]} {
|
||||
puts [exec /mod/bin/id3v2 \
|
||||
--song "[$ts get title]" \
|
||||
--comment "[$ts get synopsis]" \
|
||||
--album "[$ts get channel_name]" \
|
||||
--year "[clock format [$ts get start] -format {%Y}]" \
|
||||
"${base}.mp3"]
|
||||
}
|
||||
|
||||
set xtime [expr [expr [clock milliseconds] - $xstart] / 1000.0]
|
||||
puts "Time taken: $xtime"
|
||||
|
||||
exit
|
||||
}
|
||||
|
||||
header
|
||||
|
||||
puts "
|
||||
<link href=/css/jquery.progressbar.css rel=stylesheet type=text/css />
|
||||
<script type=\"text/javascript\" src=\"/js/jquery.progressbar.js\"></script>
|
||||
|
||||
<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>
|
||||
"
|
||||
|
||||
puts {
|
||||
|
||||
<div style="margin-top: 10px"></div>
|
||||
<div id=audiodiv><button id=audioit>Perform audio extraction</button></div>
|
||||
<div id=progressdiv style="display: none">
|
||||
Extracting audio: <div id=progressbar></div>
|
||||
}
|
||||
puts "<button id=back
|
||||
dir=\"[cgi_quote_url $dir]\"
|
||||
rfile=\"[cgi_quote_url $rfile]\"
|
||||
style=\"display: none\">Back to media list</button>"
|
||||
puts {
|
||||
<div id=output class=pre style="margin-top: 10px"></div>
|
||||
</div>
|
||||
|
||||
<script type=text/javascript>
|
||||
|
||||
var handle = 0;
|
||||
|
||||
function update()
|
||||
{
|
||||
$.get('/cgi-bin/browse/audio_progress.jim?file='
|
||||
+ $('#back').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=' + $(this).attr('dir');
|
||||
});
|
||||
|
||||
$('#audioit').button().click(function() {
|
||||
$('#audiodiv').hide('slow');
|
||||
$('#progressdiv').show('slow');
|
||||
handle = setInterval("update()", 1000);
|
||||
$('#output').load(document.URL + '&do=it', function() {
|
||||
clearInterval(handle);
|
||||
handle = 0;
|
||||
$('#back').show();
|
||||
$('#progressbar').reportprogress(100);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
}
|
||||
|
||||
52
var/mongoose/cgi-bin/browse/audio/audio.jim
Executable file
52
var/mongoose/cgi-bin/browse/audio/audio.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=audio.js></script>
|
||||
|
||||
<fieldset class=cleft>
|
||||
<legend>Audio Extraction</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=audiodiv style=\"padding: 1em\">
|
||||
<button id=audioit>Perform audio extraction</button>
|
||||
</div>
|
||||
|
||||
<div id=progressdiv class=hidden>
|
||||
Extracting audio: <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/audio/audio.js
Executable file
35
var/mongoose/cgi-bin/browse/audio/audio.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');
|
||||
});
|
||||
|
||||
$('#audioit').button().click(function() {
|
||||
$('#audiodiv').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);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
39
var/mongoose/cgi-bin/browse/audio/execute.jim
Executable file
39
var/mongoose/cgi-bin/browse/audio/execute.jim
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/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 -f mp3 \
|
||||
-vn -acodec copy "${base}.mp3"]
|
||||
|
||||
if {[system pkginst id3v2]} {
|
||||
puts [exec /mod/bin/id3v2 \
|
||||
--song "[$ts get title]" \
|
||||
--comment "[$ts get synopsis]" \
|
||||
--album "[$ts get channel_name]" \
|
||||
--year "[clock format [$ts get start] -format {%Y}]" \
|
||||
"${base}.mp3"]
|
||||
}
|
||||
|
||||
set xtime [expr [expr [clock milliseconds] - $xstart] / 1000.0]
|
||||
puts "Time taken: $xtime"
|
||||
|
||||
@@ -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,29 +1,26 @@
|
||||
(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;
|
||||
|
||||
function disableall()
|
||||
{
|
||||
$('button,a,input').disable();
|
||||
}
|
||||
|
||||
function pastedialogue()
|
||||
{
|
||||
$('#pwdialogue').dialog({
|
||||
title: "Pasting from clipboard",
|
||||
modal: true, autoOpen: true,
|
||||
height: 'auto', width: 'auto',
|
||||
show: 'scale', hide: 'fade',
|
||||
draggable: false, resizable: false,
|
||||
closeOnEscape: false,
|
||||
open: function() {
|
||||
$('.ui-dialog-titlebar-close').hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function reloadclipboard()
|
||||
{
|
||||
$('#clipboard')
|
||||
@@ -34,9 +31,15 @@ function reloadclipboard()
|
||||
// Start Clipboard post-load actions
|
||||
|
||||
if ($('#clipclear').length)
|
||||
{
|
||||
$('#paste').enable();
|
||||
$('#doptmenu').enableContextMenuItems('#paste');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#paste').disable();
|
||||
$('#doptmenu').disableContextMenuItems('#paste');
|
||||
}
|
||||
|
||||
$('#clipclear').button().click(function() {
|
||||
$.get('/cgi-bin/browse/clipboard.jim?act=clear', function() {
|
||||
@@ -51,6 +54,19 @@ $('a.clipdel').click(function() {
|
||||
});
|
||||
});
|
||||
|
||||
$('#paste').button()
|
||||
.click(function() {
|
||||
disableall();
|
||||
pastedialogue();
|
||||
$('#pwfeedback').load(
|
||||
'/cgi-bin/browse/clipboard.jim?act=paste&dir='
|
||||
+ encodeURIComponent(dir), function() {
|
||||
$('#pwdialogue').dialog('close');
|
||||
window.location.reload(true);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// End Clipboard post-load actions
|
||||
|
||||
});
|
||||
@@ -58,19 +74,17 @@ $('a.clipdel').click(function() {
|
||||
|
||||
function epginfo_callback(data, status, xhr)
|
||||
{
|
||||
var width = 85;
|
||||
//console.log(status);
|
||||
//console.dir(data);
|
||||
|
||||
if (status != 'success')
|
||||
return;
|
||||
|
||||
//console.log(status);
|
||||
//console.dir(data);
|
||||
$('#rename_title').val(data.title);
|
||||
$('#rename_synopsis').val(data.synopsis);
|
||||
$('#rename_guidance').val(data.guidance);
|
||||
$('#rename_genre').val(data.genre);
|
||||
|
||||
$('#titleorig').val(data.title);
|
||||
$('#renametitle').val(data.title);
|
||||
if (data.synopsis.length > width)
|
||||
data.synopsis = data.synopsis.substring(0, width) + '...';
|
||||
$('#synopsis').html(data.synopsis);
|
||||
$('tr.tstype').show('slow');
|
||||
}
|
||||
|
||||
@@ -79,10 +93,14 @@ function insert_folder_size(folder, size)
|
||||
folder = folder.replace(/ /g, '');
|
||||
folder = folder.replace(/([ #;&,.+*~\':"!^$[\]()=>|\/@])/g, '\\$1');
|
||||
//console.log("Folder: (%s) = (%s)", folder, size);
|
||||
if (folder == "")
|
||||
$('#dirsize').text(' (' + size + 'iB)');
|
||||
if (size.search(/\d$/) == -1)
|
||||
size += 'iB';
|
||||
else
|
||||
$('#' + folder).text(' (' + size + 'iB)');
|
||||
size += ' bytes';
|
||||
if (folder == "")
|
||||
$('#dirsize').text(' (' + size + ')');
|
||||
else
|
||||
$('#' + folder).text(' (' + size + ')');
|
||||
}
|
||||
|
||||
function folder_size_callback(data, status, xhr)
|
||||
@@ -107,6 +125,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;
|
||||
@@ -145,7 +181,7 @@ function new_callback(file, type, id)
|
||||
function rename_submit()
|
||||
{
|
||||
var s = $('#renameform_form').serialize();
|
||||
$.get('/cgi-bin/browse/rename.jim?' + s,
|
||||
$.post('/cgi-bin/browse/rename.jim', s,
|
||||
function() { window.location.reload(true); });
|
||||
}
|
||||
|
||||
@@ -197,22 +233,34 @@ 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
|
||||
$(menu).disableContextMenuItems('#chunk');
|
||||
|
||||
$(menu).enableContextMenuItems('#new');
|
||||
if (el.attr('new') == 1)
|
||||
$(menu).changeContextMenuItem('#new', 'Mark watched');
|
||||
@@ -232,31 +280,66 @@ function preparemenu(el, menu)
|
||||
$(menu).enableContextMenuItems('#delete');
|
||||
}
|
||||
|
||||
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).enableContextMenuItems('#decrypt');
|
||||
$(menu).disableContextMenuItems('#audio');
|
||||
$(menu).disableContextMenuItems('#mpg');
|
||||
}
|
||||
else
|
||||
{
|
||||
$(menu).disableContextMenuItems('#decrypt');
|
||||
$(menu).enableContextMenuItems('#audio');
|
||||
if (el.attr('def') == 'HD')
|
||||
$(menu).disableContextMenuItems('#mpg');
|
||||
else
|
||||
$(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');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function fixdmenu(el, menu, flag, tag, descr, recurse)
|
||||
{
|
||||
var a = el.attr(flag);
|
||||
var b = el.attr(flag + 'r');
|
||||
|
||||
if (a == undefined) a = 0;
|
||||
if (b == undefined) b = 0;
|
||||
|
||||
if (a > 0)
|
||||
$(menu).changeContextMenuItem(tag, 'Disable ' + descr);
|
||||
else
|
||||
$(menu).changeContextMenuItem(tag, 'Enable ' + descr);
|
||||
|
||||
if (recurse)
|
||||
{
|
||||
if (b > 0)
|
||||
{
|
||||
$(menu).changeContextMenuItem(tag + 'r',
|
||||
'Disable Recursive ' + descr);
|
||||
$(menu).disableContextMenuItems(tag);
|
||||
}
|
||||
else
|
||||
{
|
||||
$(menu).changeContextMenuItem(tag + 'r',
|
||||
'Enable Recursive ' + descr);
|
||||
$(menu).enableContextMenuItems(tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function preparedmenu(el, menu)
|
||||
{
|
||||
if (el.attr('noflat') != undefined)
|
||||
@@ -267,11 +350,16 @@ function preparedmenu(el, menu)
|
||||
$(menu).changeContextMenuItem('#flat',
|
||||
'Prevent Flatten');
|
||||
}
|
||||
|
||||
fixdmenu(el, menu, 'autoshrink', '#shrink', 'Auto-shrink', 1);
|
||||
fixdmenu(el, menu, 'autodedup', '#dedup', 'Auto-dedup', 0);
|
||||
fixdmenu(el, menu, 'autodecrypt', '#decrypt', 'Auto-decrypt', 1);
|
||||
fixdmenu(el, menu, 'autompg', '#mpg', 'Auto-mpg', 0);
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var dir = $('#dir').text();
|
||||
dir = $('#dir').text();
|
||||
|
||||
var menuclick = function(action, el, pos)
|
||||
{
|
||||
@@ -303,10 +391,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,
|
||||
@@ -315,11 +403,11 @@ var menuclick = function(action, el, pos)
|
||||
|
||||
case 'rename':
|
||||
$('#rename').val(decodeURIComponent(bfile));
|
||||
$('#renameorig').val(decodeURIComponent(file));
|
||||
$('#renamefile').val(decodeURIComponent(file));
|
||||
|
||||
$('#titleorig').val('');
|
||||
$('#renametitle').val('');
|
||||
$('#synopsis').val('');
|
||||
$('#rename_title').val('');
|
||||
$('#rename_synopsis').val('');
|
||||
$('#rename_guidance').val('');
|
||||
$('tr.tstype').css('display', 'none');
|
||||
|
||||
if (type == 'ts')
|
||||
@@ -333,21 +421,37 @@ var menuclick = function(action, el, pos)
|
||||
|
||||
case 'download':
|
||||
window.location.href = '/cgi-bin/browse/download.jim?file=' +
|
||||
file;
|
||||
file + '&base=' +
|
||||
encodeURIComponent(document.URL.match(/:\/\/(.[^/]+)/)[1]);
|
||||
break;
|
||||
|
||||
case 'crop':
|
||||
window.location.href = '/cgi-bin/browse/crop.jim?file=' +
|
||||
window.location.href = '/cgi-bin/browse/crop/crop.jim?file=' +
|
||||
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;
|
||||
break;
|
||||
|
||||
case 'decrypt':
|
||||
window.location.href = '/cgi-bin/browse/decrypt.jim?file=' +
|
||||
file;
|
||||
window.location.href =
|
||||
'/cgi-bin/browse/decrypt/decrypt.jim?file=' + file;
|
||||
break;
|
||||
|
||||
case 'audio':
|
||||
window.location.href = '/cgi-bin/browse/audio.jim?file=' +
|
||||
window.location.href = '/cgi-bin/browse/audio/audio.jim?file=' +
|
||||
file;
|
||||
break;
|
||||
|
||||
case 'mpg':
|
||||
window.location.href = '/cgi-bin/browse/mpg/mpg.jim?file=' +
|
||||
file;
|
||||
break;
|
||||
|
||||
@@ -357,16 +461,44 @@ var menuclick = function(action, el, pos)
|
||||
}
|
||||
};
|
||||
|
||||
function flagdir(file, flag, iconset, output, options)
|
||||
{
|
||||
var url = '/cgi-bin/browse/flagdir.jim?dir=' + file +
|
||||
'&flag=' + flag;
|
||||
|
||||
$(output).load(url, function() {
|
||||
$(iconset)
|
||||
.empty()
|
||||
.html('<img src=/img/loading.gif> Updating...')
|
||||
.load('/cgi-bin/browse/iconset.jim?file=' + file);
|
||||
if ($(options).attr(flag) == '1')
|
||||
$(options).attr(flag, 0);
|
||||
else
|
||||
$(options).attr(flag, 1);
|
||||
}).delay(3000).slideUp();
|
||||
}
|
||||
|
||||
var dmenuclick = function(action, el, pos)
|
||||
{
|
||||
var direl = $(el).parent().parent();
|
||||
var file = $(el).parent().prevAll('a.dbf').last().attr('file');
|
||||
var iconset = $(el).parent().prevAll('span.iconset').last();
|
||||
var bfile = file.replace(/.*\//g, '');
|
||||
bfile = bfile.replace(/[\x00-\x1f]+/g, '');
|
||||
var results = $(el).parent().next('div.results');
|
||||
|
||||
switch (action)
|
||||
{
|
||||
case 'paste':
|
||||
pastedialogue();
|
||||
$('#pwfeedback').load(
|
||||
'/cgi-bin/browse/clipboard.jim?act=paste&dir=' +
|
||||
file, function() {
|
||||
$('#pwdialogue').dialog('close');
|
||||
reloadclipboard();
|
||||
});
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
|
||||
if (confirm('Are you sure you wish to delete "' +
|
||||
@@ -406,7 +538,27 @@ var dmenuclick = function(action, el, pos)
|
||||
break;
|
||||
|
||||
case 'flat':
|
||||
var url = '/cgi-bin/browse/flat.jim?file=' + file;
|
||||
flagdir(file, 'noflatten', iconset, results, el);
|
||||
break;
|
||||
|
||||
case 'dedup':
|
||||
flagdir(file, 'autodedup', iconset, results, el);
|
||||
break;
|
||||
|
||||
case 'mpg':
|
||||
flagdir(file, 'autompg', iconset, results, el);
|
||||
break;
|
||||
|
||||
case 'shrink':
|
||||
flagdir(file, 'autoshrink', iconset, results, el);
|
||||
break;
|
||||
|
||||
case 'decrypt':
|
||||
flagdir(file, 'autodecrypt', iconset, results, el);
|
||||
break;
|
||||
|
||||
case 'resetnew':
|
||||
var url = '/cgi-bin/browse/resetnew.jim?dir=' + file;
|
||||
$.get(url, function() { window.location.reload(true); });
|
||||
break;
|
||||
|
||||
@@ -426,6 +578,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',
|
||||
@@ -438,6 +600,13 @@ var dmenuclick = function(action, el, pos)
|
||||
// Disable items which are not yet implemented.
|
||||
$('#optmenu').disableContextMenuItems('#title');
|
||||
|
||||
var $buttons = {
|
||||
"Close" : function() {$(this).dialog('close');}
|
||||
};
|
||||
var $buttonsp = $.extend(
|
||||
{"Play" : function() { doplay(); }},
|
||||
$buttons);
|
||||
|
||||
// Create reusable dialogue.
|
||||
var $dialog = $('#dialogue').dialog({
|
||||
title: "Media Details",
|
||||
@@ -445,23 +614,43 @@ var dmenuclick = function(action, el, pos)
|
||||
height: 600, width: 700,
|
||||
show: 'scale', hide: 'fade',
|
||||
draggable: true, resizable: true,
|
||||
buttons: {
|
||||
"Close": function() {
|
||||
$(this).dialog('close');
|
||||
}
|
||||
},
|
||||
buttons: $buttons,
|
||||
close: function(e,u) { $('#dialogue').empty().html(
|
||||
'<img src="/img/loading.gif" alt="loading">'); }
|
||||
});
|
||||
|
||||
function doplay()
|
||||
{
|
||||
var file = $dialog.attr('file');
|
||||
var type = $dialog.attr('type');
|
||||
|
||||
disableall();
|
||||
|
||||
window.location = '/play/play.jim?' +
|
||||
'dir=' + encodeURIComponent(dir) +
|
||||
'&file=' + file;
|
||||
}
|
||||
|
||||
// Bind dialogue open to filenames.
|
||||
$('a.bf').click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var file = $(this).attr('file');
|
||||
var type = $(this).attr('type');
|
||||
var opt = $(this).nextAll('a').find('img.opt');
|
||||
|
||||
var url = '/cgi-bin/browse/file.jim?file=' + file
|
||||
+ '&type=' + type;
|
||||
$('#dialogue').load(url);
|
||||
$dialog.load(url);
|
||||
|
||||
$dialog.attr('file', file);
|
||||
$dialog.attr('type', type);
|
||||
|
||||
if (type == 'ts' &&
|
||||
(opt.attr('odencd') == 0 || opt.attr('dlna') == 1))
|
||||
$dialog.dialog("option", "buttons", $buttonsp);
|
||||
else
|
||||
$dialog.dialog("option", "buttons", $buttons);
|
||||
$dialog.dialog('open');
|
||||
});
|
||||
|
||||
@@ -516,6 +705,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);
|
||||
@@ -529,7 +722,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);
|
||||
});
|
||||
|
||||
@@ -557,7 +750,7 @@ var dmenuclick = function(action, el, pos)
|
||||
files.push($(this).attr('file'));
|
||||
});
|
||||
//console.log("%o", files);
|
||||
window.location.href = '/cgi-bin/browse/join.jim?files=' +
|
||||
window.location.href = '/cgi-bin/browse/join/join.jim?files=' +
|
||||
files.join();
|
||||
});
|
||||
|
||||
@@ -622,28 +815,6 @@ var dmenuclick = function(action, el, pos)
|
||||
});
|
||||
});
|
||||
|
||||
$('#paste').button().disable()
|
||||
.click(function() {
|
||||
disableall();
|
||||
$('#pwdialogue').dialog({
|
||||
title: "Pasting from clipboard",
|
||||
modal: true, autoOpen: true,
|
||||
height: 'auto', width: 'auto',
|
||||
show: 'scale', hide: 'fade',
|
||||
draggable: false, resizable: false,
|
||||
closeOnEscape: false,
|
||||
open: function() {
|
||||
$('.ui-dialog-titlebar-close').hide();
|
||||
}
|
||||
});
|
||||
$('#pwfeedback').load(
|
||||
'/cgi-bin/browse/clipboard.jim?act=paste&dir='
|
||||
+ encodeURIComponent(dir), function() {
|
||||
$('#pwdialogue').dialog('close');
|
||||
window.location.reload(true);
|
||||
});
|
||||
});
|
||||
|
||||
$('#newdir').button().click(function() {
|
||||
$('#newdirform').dialog({
|
||||
autoOpen: true,
|
||||
@@ -674,5 +845,30 @@ var dmenuclick = function(action, el, pos)
|
||||
|
||||
});
|
||||
|
||||
var streamsize = 0;
|
||||
|
||||
function checkstream()
|
||||
{
|
||||
$.get('/cgi-bin/streamsize.jim', function(size) {
|
||||
//console.log('Stream size: %o', size);
|
||||
var mb = size / (1024 * 1024);
|
||||
mb = mb|0;
|
||||
if (streamsize && size > streamsize)
|
||||
{
|
||||
rate = (size - streamsize) * 8.0 /
|
||||
(3 * 1048576);
|
||||
$('#streamstatus').text(mb +
|
||||
' MiB (growing @' + rate.toFixed(2) +
|
||||
' Mib/s)');
|
||||
}
|
||||
else
|
||||
$('#streamstatus').text(mb + ' MiB');
|
||||
streamsize = size;
|
||||
});
|
||||
}
|
||||
|
||||
if ($('#streamstatus').length)
|
||||
setInterval(checkstream, 3000);
|
||||
|
||||
});
|
||||
|
||||
|
||||
6
var/mongoose/cgi-bin/browse/chunk/chunk.css
Normal file
6
var/mongoose/cgi-bin/browse/chunk/chunk.css
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
div.progressbar
|
||||
{
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
72
var/mongoose/cgi-bin/browse/chunk/chunk.jim
Executable file
72
var/mongoose/cgi-bin/browse/chunk/chunk.jim
Executable file
@@ -0,0 +1,72 @@
|
||||
#!/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]
|
||||
|
||||
# 45 minute chunks
|
||||
set max $(45 * 60)
|
||||
|
||||
set len [$ts duration 1]
|
||||
|
||||
set esttime $(int($len * 0.025))
|
||||
if {[$ts get definition] eq "HD"} { set esttime $($esttime * 4) }
|
||||
|
||||
header
|
||||
|
||||
puts "
|
||||
<script type=text/javascript src=/js/jquery.progressbar.js></script>
|
||||
<script type=text/javascript src=chunk.js></script>
|
||||
<link href=/css/jquery.progressbar.css rel=stylesheet type=text/css />
|
||||
<link href=chunk.css rel=stylesheet type=text/css />
|
||||
|
||||
<fieldset class=cleft>
|
||||
<legend>Split recording into 45 minute segments</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>
|
||||
<tr><th>Size:</th><td>[pretty_size [$ts size]] ([$ts get definition])</td></tr>
|
||||
<tr><th>Time:</th>
|
||||
<td>Splitting will take around [clock format $esttime -format "%T"]</td></tr>
|
||||
"
|
||||
|
||||
set bytesperminute $([$ts size] / ($len / 60))
|
||||
|
||||
while {$len > 0} {
|
||||
incr part
|
||||
incr len -$max
|
||||
puts "<tr class=\"part hidden\">
|
||||
<th>Part $part</th><td>
|
||||
<div id=progresspart$part class=progressbar></div>
|
||||
<div id=progressstat$part class=also>waiting...</div>
|
||||
</td></tr>"
|
||||
}
|
||||
|
||||
puts "
|
||||
</table>
|
||||
<span class=hidden id=params parts=$part bpm=$bytesperminute
|
||||
file=\"[cgi_quote_url $rfile]\">
|
||||
</span>
|
||||
|
||||
<div id=chunkdiv style=\"padding: 1em\">
|
||||
<button id=chunkit>Split recording into $part parts</button>
|
||||
</div>
|
||||
|
||||
<div id=findiv style=\"padding: 1em\" class=hidden>
|
||||
<button id=back dir=\"[cgi_quote_url [file dirname $rfile]]\">
|
||||
Back to Media Browser
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
"
|
||||
|
||||
76
var/mongoose/cgi-bin/browse/chunk/chunk.js
Normal file
76
var/mongoose/cgi-bin/browse/chunk/chunk.js
Normal file
@@ -0,0 +1,76 @@
|
||||
var handle;
|
||||
var currentpart = 0;
|
||||
var stime = 0;
|
||||
|
||||
function xprogress()
|
||||
{
|
||||
var file = $('#params').attr('file');
|
||||
var bpm = $('#params').attr('bpm');
|
||||
|
||||
if (currentpart > 0)
|
||||
$.get('progress.jim?part=' + currentpart + '&file=' + file,
|
||||
function(data) {
|
||||
if (currentpart > 0)
|
||||
{
|
||||
perc = (data / bpm) * 100 / 45;
|
||||
$('#progresspart' + currentpart)
|
||||
.reportprogress(perc);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function xpart(part)
|
||||
{
|
||||
var parts = $('#params').attr('parts');
|
||||
var file = $('#params').attr('file');
|
||||
|
||||
if (part++ < parts)
|
||||
{
|
||||
currentpart = part;
|
||||
$('#progressstat' + part)
|
||||
.text('extracting...')
|
||||
.addClass('blood');
|
||||
stime = new Date().getTime();
|
||||
$.get('extract.jim?parts=' + parts +
|
||||
'&part=' + part +
|
||||
'&file=' + file,
|
||||
function(data) {
|
||||
var taken = (new Date().getTime() - stime) / 1000;
|
||||
$('#progressstat' + part)
|
||||
.text('done... (' + taken + ' seconds)')
|
||||
.removeClass('blood');
|
||||
currentpart = 0;
|
||||
$('#progresspart' + part)
|
||||
.reportprogress(100);
|
||||
xpart(part);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
clearInterval(handle);
|
||||
$('#findiv').show('slow');
|
||||
}
|
||||
}
|
||||
|
||||
$(function() {
|
||||
|
||||
$('div.progressbar').reportprogress(0);
|
||||
|
||||
$('#chunkit').button().click(function(e) {
|
||||
e.preventDefault();
|
||||
$('#chunkdiv').hide('slow');
|
||||
$('tr.part').show('slow');
|
||||
|
||||
handle = setInterval("xprogress()", 1000);
|
||||
xpart(0);
|
||||
});
|
||||
|
||||
$('#back').button().click(function(e) {
|
||||
e.preventDefault();
|
||||
var dir = $(this).attr('dir');
|
||||
|
||||
window.location = '/cgi-bin/browse.jim?dir=' + dir;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
38
var/mongoose/cgi-bin/browse/chunk/extract.jim
Executable file
38
var/mongoose/cgi-bin/browse/chunk/extract.jim
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/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 part [cgi_get part -]
|
||||
set parts [cgi_get parts "?"]
|
||||
|
||||
if {$part eq "-"} exit
|
||||
|
||||
set start $(($part - 1) * 45 * 600 - 600)
|
||||
set end $($part * 45 * 600 + 600)
|
||||
|
||||
puts "START: $start"
|
||||
puts "END: $end"
|
||||
|
||||
set ts [ts fetch $rfile]
|
||||
|
||||
set base [file rootname $rfile]
|
||||
|
||||
set cmd [list /mod/bin/nicesplice -in $base -out "$base.part$part"]
|
||||
if {$start > 0} { lappend cmd -cut 0 $start }
|
||||
lappend cmd -cut $end 9999999
|
||||
|
||||
puts "CMD: ($cmd)"
|
||||
|
||||
puts [exec {*}$cmd]
|
||||
|
||||
set ts [ts fetch "$base.part$part.ts"]
|
||||
$ts settitle "$part/$parts. [string range [ts get $title] 0 40]"
|
||||
|
||||
17
var/mongoose/cgi-bin/browse/chunk/progress.jim
Executable file
17
var/mongoose/cgi-bin/browse/chunk/progress.jim
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/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 file [cgi_get file]
|
||||
set part [cgi_get part]
|
||||
|
||||
set rfile "[file rootname $file].part$part"
|
||||
puts [file size $rfile]
|
||||
|
||||
@@ -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"
|
||||
@@ -47,6 +47,7 @@ switch $action {
|
||||
puts "</span>"
|
||||
}
|
||||
puts "</div>"
|
||||
puts "<button id=paste>Paste to current folder</button>"
|
||||
puts "<button id=clipclear>Empty clipboard</button>"
|
||||
}
|
||||
add {
|
||||
@@ -58,7 +59,7 @@ switch $action {
|
||||
set mode [cgi_get mode copy]
|
||||
foreach p $path {
|
||||
set p [cgi_unquote_input $p]
|
||||
if {$dir ne "0" && ![string match "$dir/*" $p]} {
|
||||
if {$dir ne "0" && [string first "$dir/" $p] != 0} {
|
||||
puts "$p not in directory<br>"
|
||||
continue
|
||||
}
|
||||
@@ -94,19 +95,27 @@ switch $action {
|
||||
catch {puts [exec /mod/bin/busybox/cp -r \
|
||||
$path $dir]}
|
||||
}
|
||||
} else {
|
||||
set root [file rootname $path]
|
||||
# Protect special characters in root.
|
||||
# In particular [] characters which are used a lot
|
||||
# for torrent names.
|
||||
regsub -all {([\\["$])} $root {\\\1} root
|
||||
foreach f [glob -nocomplain "${root}.*"] {
|
||||
if {$mode eq "cut"} {
|
||||
catch {file rename $f "$dir/[file tail $f]"}
|
||||
} else {
|
||||
catch {file copy $f "$dir/[file tail $f]"}
|
||||
} elseif {[string match {*.ts} $path]} {
|
||||
set ts [ts fetch $path]
|
||||
if {![catch {$ts get file}]} {
|
||||
foreach f [$ts fileset] {
|
||||
if {$mode eq "cut"} {
|
||||
catch {file rename $f \
|
||||
"$dir/[file tail $f]"}
|
||||
} else {
|
||||
catch {file copy $f \
|
||||
"$dir/[file tail $f]"}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if {$mode eq "cut"} {
|
||||
catch {file rename $path \
|
||||
"$dir/[file tail $path]"}
|
||||
} else {
|
||||
catch {file copy $path \
|
||||
"$dir/[file tail $path]"}
|
||||
}
|
||||
}
|
||||
}
|
||||
$cb clear
|
||||
|
||||
@@ -1,191 +0,0 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/var/mongoose/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]
|
||||
|
||||
if {[cgi_get do] eq "it"} {
|
||||
|
||||
set cropstart [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/nicesplice \
|
||||
-in "$origdir/$shname" \
|
||||
-out "$dir/$shname" \
|
||||
-cutBookMarks]
|
||||
|
||||
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 croptime [expr [expr [clock milliseconds] - $cropstart] / 1000.0]
|
||||
puts "Time taken: $croptime"
|
||||
|
||||
exit
|
||||
}
|
||||
|
||||
header
|
||||
|
||||
puts "
|
||||
<link href=/css/jquery.progressbar.css rel=stylesheet type=text/css />
|
||||
<script type=\"text/javascript\" src=\"/js/jquery.progressbar.js\"></script>
|
||||
|
||||
<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>Bookmarks:</th><td>[$ts get bookmarks] @ "
|
||||
|
||||
set flag 0
|
||||
foreach b [$ts bookmarks] {
|
||||
if $flag { puts -nonewline ", " }
|
||||
incr flag
|
||||
puts -nonewline [clock format $b -format "%T"]
|
||||
}
|
||||
|
||||
puts "</td></tr><tr><th>File</th><td>"
|
||||
|
||||
puts "<div style=\"position: relative; top: -10px\">"
|
||||
|
||||
proc div {type left right} {
|
||||
set width $($right - $left)
|
||||
puts "<div class=$type style=\"left: ${left}px; width: ${width}px\">
|
||||
$type</div>"
|
||||
}
|
||||
|
||||
set keeping 0
|
||||
set last 0
|
||||
set start -1
|
||||
foreach b [$ts bookmarks] {
|
||||
if {$start < 0} {
|
||||
set start $b
|
||||
continue
|
||||
}
|
||||
set end $b
|
||||
|
||||
incr keeping $($end - $start)
|
||||
|
||||
set left $($start * 500 / $len)
|
||||
set right $($end * 500 / $len)
|
||||
|
||||
div cut $last $($left - 1)
|
||||
div keep $left $($right - 1)
|
||||
|
||||
set last $right
|
||||
|
||||
set start -1
|
||||
}
|
||||
|
||||
if {$start > 0} {
|
||||
incr keeping $($len - $start)
|
||||
set left $($start * 500 / $len)
|
||||
div cut $last $($left - 1)
|
||||
div keep $left 500
|
||||
} else {
|
||||
div cut $last 500
|
||||
}
|
||||
|
||||
set keepperc $($keeping * 100.0 / $len)
|
||||
set esttime $(int($keeping * 0.025))
|
||||
if {[$ts get definition] eq "HD"} { set esttime $($esttime * 4) }
|
||||
|
||||
puts "
|
||||
</div>
|
||||
</td></tr>
|
||||
<tr><th>Keeping:</th><td>
|
||||
[clock format $keeping -format "%T"] ([format "%.2f" $keepperc]%)
|
||||
</td></tr>
|
||||
<tr><th>Time:</th>
|
||||
<td>Cropping will take around [clock format $esttime -format "%T"]</td></tr>
|
||||
</table>
|
||||
"
|
||||
|
||||
puts "
|
||||
<div id=cropdiv>
|
||||
<button id=cropit>Perform crop operation</button>
|
||||
</div>
|
||||
<div id=progressdiv style=\"display: none\">
|
||||
Cropping: <div id=progressbar></div>
|
||||
<button id=back
|
||||
dir=\"[cgi_quote_url $dir]\"
|
||||
rfile=\"[cgi_quote_url $rfile]\"
|
||||
perc=\"$keepperc\"
|
||||
style=\"display: none\">Back to media list</button>"
|
||||
puts {
|
||||
<div id=output class=pre style="margin-top: 10px"></div>
|
||||
</div>
|
||||
|
||||
<script type=text/javascript>
|
||||
|
||||
var handle = 0;
|
||||
|
||||
function update()
|
||||
{
|
||||
$.get('/cgi-bin/browse/crop_progress.jim'
|
||||
+ '?perc=' + $('#back').attr('perc')
|
||||
+ '&file=' + $('#back').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=' + $(this).attr('dir');
|
||||
});
|
||||
|
||||
$('#cropit').button().click(function() {
|
||||
$('#cropdiv').hide('slow');
|
||||
$('#progressdiv').show('slow');
|
||||
handle = setInterval("update()", 1000);
|
||||
$('#output').text('Please do not interrupt...')
|
||||
.load(document.URL + '&do=it',
|
||||
function() {
|
||||
clearInterval(handle);
|
||||
handle = 0;
|
||||
$('#back').show();
|
||||
$('#progressbar').reportprogress(100);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
}
|
||||
|
||||
117
var/mongoose/cgi-bin/browse/crop/crop.jim
Executable file
117
var/mongoose/cgi-bin/browse/crop/crop.jim
Executable file
@@ -0,0 +1,117 @@
|
||||
#!/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]
|
||||
|
||||
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=crop.js></script>
|
||||
|
||||
<fieldset class=cleft>
|
||||
<legend>Crop recording</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>
|
||||
<tr><th>Size:</th><td>[pretty_size [$ts size]] ([$ts get definition])</td></tr>
|
||||
<tr><th>Bookmarks:</th><td>[$ts get bookmarks] @ "
|
||||
|
||||
set flag 0
|
||||
foreach b [$ts bookmarks] {
|
||||
if $flag { puts -nonewline ", " }
|
||||
incr flag
|
||||
puts -nonewline [clock format $b -format "%T"]
|
||||
}
|
||||
|
||||
puts "</td></tr><tr><th>File</th><td>"
|
||||
|
||||
puts "<div style=\"position: relative; top: -10px\">"
|
||||
|
||||
proc div {type left right} {
|
||||
set width $($right - $left)
|
||||
puts "<div class=$type style=\"left: ${left}px; width: ${width}px\">
|
||||
$type</div>"
|
||||
}
|
||||
|
||||
set keeping 0
|
||||
set last 0
|
||||
set start -1
|
||||
foreach b [$ts bookmarks] {
|
||||
if {$start < 0} {
|
||||
set start $b
|
||||
continue
|
||||
}
|
||||
set end $b
|
||||
|
||||
incr keeping $($end - $start)
|
||||
|
||||
set left $($start * 500 / $len)
|
||||
set right $($end * 500 / $len)
|
||||
|
||||
div cut $last $($left - 1)
|
||||
div keep $left $($right - 1)
|
||||
|
||||
set last $right
|
||||
|
||||
set start -1
|
||||
}
|
||||
|
||||
if {$start > 0} {
|
||||
incr keeping $($len - $start)
|
||||
set left $($start * 500 / $len)
|
||||
div cut $last $($left - 1)
|
||||
div keep $left 500
|
||||
} else {
|
||||
div cut $last 500
|
||||
}
|
||||
|
||||
set keepperc $($keeping * 100.0 / $len)
|
||||
set esttime $(int($keeping * 0.025))
|
||||
if {[$ts get definition] eq "HD"} { set esttime $($esttime * 4) }
|
||||
|
||||
puts "
|
||||
</div>
|
||||
</td></tr>
|
||||
<tr><th>Keeping:</th><td>
|
||||
[clock format $keeping -format "%T"] ([format "%.2f" $keepperc]%)
|
||||
</td></tr>
|
||||
<tr><th>Time:</th>
|
||||
<td>Cropping will take around [clock format $esttime -format "%T"]</td></tr>
|
||||
</table>
|
||||
|
||||
<span class=hidden id=params
|
||||
file=\"[cgi_quote_url $rfile]\"
|
||||
perc=\"$keepperc\"
|
||||
dir=\"[cgi_quote_url $dir]\"
|
||||
></span>
|
||||
|
||||
<div id=cropdiv style=\"padding: 1em\">
|
||||
<button id=cropit>Perform crop operation</button>
|
||||
</div>
|
||||
|
||||
<div id=progressdiv class=hidden>
|
||||
Cropping: <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>
|
||||
|
||||
"
|
||||
|
||||
38
var/mongoose/cgi-bin/browse/crop/crop.js
Executable file
38
var/mongoose/cgi-bin/browse/crop/crop.js
Executable file
@@ -0,0 +1,38 @@
|
||||
var handle = 0;
|
||||
|
||||
function update()
|
||||
{
|
||||
var perc = $('#params').attr('perc');
|
||||
var file = $('#params').attr('file');
|
||||
|
||||
$.get('progress.jim' + '?perc=' + perc + '&file=' + file,
|
||||
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');
|
||||
});
|
||||
|
||||
$('#cropit').button().click(function() {
|
||||
$('#cropdiv').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);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
58
var/mongoose/cgi-bin/browse/crop/execute.jim
Executable file
58
var/mongoose/cgi-bin/browse/crop/execute.jim
Executable file
@@ -0,0 +1,58 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require ts.class pretty_size system.class
|
||||
|
||||
puts "Content-Type: text/html\r\n\r\n"
|
||||
|
||||
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]
|
||||
|
||||
set len [$ts duration 1]
|
||||
|
||||
set cropstart [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/nicesplice \
|
||||
-in "$origdir/$shname" \
|
||||
-out "$dir/$shname" \
|
||||
-cutBookMarks]
|
||||
|
||||
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 croptime [expr [expr [clock milliseconds] - $cropstart] / 1000.0]
|
||||
puts "Time taken: $croptime"
|
||||
|
||||
@@ -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,133 +0,0 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require sqlite3
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/setup
|
||||
require ts.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]
|
||||
lassign [$ts dlnaloc] url
|
||||
|
||||
if {[cgi_get do] eq "it"} {
|
||||
set xstart [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"
|
||||
|
||||
exec wget -O "$rfile.decrypting" $url
|
||||
|
||||
puts "Moving recording to $origdir"
|
||||
|
||||
foreach f [glob -nocomplain "${base}.*"] {
|
||||
if {[file extension $f] eq ".decrypting"} { continue }
|
||||
set tail [file tail $f]
|
||||
puts " $tail"
|
||||
file rename $f "${origdir}/$tail"
|
||||
}
|
||||
|
||||
file rename "$rfile.decrypting" $rfile
|
||||
|
||||
foreach ext {nts hmt thm} {
|
||||
set sidecar "$shname.$ext"
|
||||
if {[file exists "$origdir/$sidecar"]} {
|
||||
puts "Copying back sidecar $ext"
|
||||
file copy "$origdir/$sidecar" "$dir/$sidecar"
|
||||
}
|
||||
}
|
||||
|
||||
if {[file exists "$dir/$shname.hmt"]} {
|
||||
exec /mod/bin/hmt -encrypted "$dir/$shname.hmt"
|
||||
}
|
||||
|
||||
set xtime [expr [expr [clock milliseconds] - $xstart] / 1000.0]
|
||||
puts "Time taken: $xtime"
|
||||
|
||||
exit
|
||||
}
|
||||
|
||||
header
|
||||
|
||||
puts "
|
||||
<link href=/css/jquery.progressbar.css rel=stylesheet type=text/css />
|
||||
<script type=\"text/javascript\" src=\"/js/jquery.progressbar.js\"></script>
|
||||
|
||||
<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>DLNA URL</th><td>$url</td></tr>
|
||||
</table>
|
||||
"
|
||||
|
||||
if {$url eq ""} {
|
||||
puts "This file has not been indexed by the media server.
|
||||
Cannot decrypt."
|
||||
puts "Have you enabled <i>Content Sharing</i> in the Humax menus?"
|
||||
exit
|
||||
}
|
||||
|
||||
puts {
|
||||
|
||||
<div style="margin-top: 10px"></div>
|
||||
<div id=decryptdiv><button id=decryptit>Perform decryption</button></div>
|
||||
<div id=progressdiv style="display: none">
|
||||
Decrypting: <div id=progressbar></div>
|
||||
}
|
||||
puts "<button id=back
|
||||
dir=\"[cgi_quote_url $dir]\"
|
||||
rfile=\"[cgi_quote_url $rfile]\"
|
||||
style=\"display: none\">Back to media list</button>"
|
||||
puts {
|
||||
<div id=output class=pre style="margin-top: 10px"></div>
|
||||
</div>
|
||||
|
||||
<script type=text/javascript>
|
||||
|
||||
var handle = 0;
|
||||
|
||||
function update()
|
||||
{
|
||||
$.get('/cgi-bin/browse/decrypt_progress.jim?file='
|
||||
+ $('#back').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=' + $(this).attr('dir');
|
||||
});
|
||||
|
||||
$('#decryptit').button().click(function() {
|
||||
$('#decryptdiv').hide('slow');
|
||||
$('#progressdiv').show('slow');
|
||||
handle = setInterval("update()", 1000);
|
||||
$('#output').load(document.URL + '&do=it', function() {
|
||||
clearInterval(handle);
|
||||
handle = 0;
|
||||
$('#back').show();
|
||||
$('#progressbar').reportprogress(100);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
}
|
||||
|
||||
72
var/mongoose/cgi-bin/browse/decrypt/decrypt.jim
Executable file
72
var/mongoose/cgi-bin/browse/decrypt/decrypt.jim
Executable file
@@ -0,0 +1,72 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require sqlite3
|
||||
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 rfile [cgi_get file]
|
||||
set ts [ts fetch $rfile]
|
||||
set dir [file dirname $rfile]
|
||||
set len [$ts duration 1]
|
||||
lassign [$ts dlnaloc] url
|
||||
|
||||
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=decrypt.js></script>
|
||||
|
||||
<fieldset class=cleft>
|
||||
<legend>Decrypt in-place</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>
|
||||
<tr><th>DLNA URL</th><td>$url</td></tr>
|
||||
</table>
|
||||
"
|
||||
|
||||
if {$url eq ""} {
|
||||
puts "This file has not been indexed by the media server.
|
||||
Cannot decrypt."
|
||||
puts "Have you enabled <i>Content Sharing</i> in the Humax menus?"
|
||||
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
|
||||
dir=\"[cgi_quote_url $dir]\"
|
||||
file=\"[cgi_quote_url $rfile]\"
|
||||
></span>
|
||||
|
||||
<div id=decryptdiv style=\"padding: 1em\">
|
||||
<button id=decryptit>Perform decryption</button>
|
||||
</div>
|
||||
|
||||
<div id=progressdiv class=hidden>
|
||||
Decrypting: <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/decrypt/decrypt.js
Executable file
35
var/mongoose/cgi-bin/browse/decrypt/decrypt.js
Executable file
@@ -0,0 +1,35 @@
|
||||
|
||||
var handle = 0;
|
||||
|
||||
function update()
|
||||
{
|
||||
$.get('progress.jim?file=' + $('#params').attr('file'),
|
||||
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');
|
||||
});
|
||||
|
||||
$('#decryptit').button().click(function() {
|
||||
$('#decryptdiv').hide('slow');
|
||||
$('#progressdiv').show('slow');
|
||||
handle = setInterval("update()", 1000);
|
||||
$('#output').load('execute.jim?file=' + $('#params').attr('file'),
|
||||
function() {
|
||||
clearInterval(handle);
|
||||
handle = 0;
|
||||
$('#back').show();
|
||||
$('#progressbar').reportprogress(100);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
71
var/mongoose/cgi-bin/browse/decrypt/execute.jim
Executable file
71
var/mongoose/cgi-bin/browse/decrypt/execute.jim
Executable file
@@ -0,0 +1,71 @@
|
||||
#!/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]
|
||||
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]
|
||||
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 "The file already exists in _original, cannot decrypt."
|
||||
exit
|
||||
}
|
||||
|
||||
exec wget -O "$rfile.decrypting" $url
|
||||
|
||||
puts "Moving recording to $origdir"
|
||||
|
||||
foreach f [glob -nocomplain "${base}.*"] {
|
||||
if {[file extension $f] eq ".decrypting"} { continue }
|
||||
set tail [file tail $f]
|
||||
puts " $tail"
|
||||
file rename $f "${origdir}/$tail"
|
||||
}
|
||||
|
||||
file rename "$rfile.decrypting" $rfile
|
||||
|
||||
foreach ext {nts hmt thm} {
|
||||
set sidecar "$shname.$ext"
|
||||
if {[file exists "$origdir/$sidecar"]} {
|
||||
puts "Copying back sidecar $ext"
|
||||
file copy "$origdir/$sidecar" "$dir/$sidecar"
|
||||
}
|
||||
}
|
||||
|
||||
if {[file exists "$dir/$shname.hmt"]} {
|
||||
exec /mod/bin/hmt -encrypted "$dir/$shname.hmt"
|
||||
}
|
||||
|
||||
set xtime [expr [expr [clock milliseconds] - $xstart] / 1000.0]
|
||||
puts "Time taken: $xtime"
|
||||
|
||||
@@ -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"
|
||||
@@ -22,9 +22,10 @@ if {[system pkginst undelete]} {
|
||||
proc bindir {file} {
|
||||
global dustbin
|
||||
set dir [file dirname $file]
|
||||
regsub "^[system mediaroot]" $dir $dustbin dir
|
||||
system mkdir_p $dir
|
||||
return $dir
|
||||
regsub "^[system mediaroot]" $dir $dustbin ndir
|
||||
if {$dir eq $ndir} { set ndir $dustbin }
|
||||
system mkdir_p $ndir
|
||||
return $ndir
|
||||
}
|
||||
|
||||
proc touch {file} {
|
||||
@@ -33,15 +34,17 @@ proc touch {file} {
|
||||
|
||||
puts "<div id=deleting class=blood><img src=/img/loading.gif>Deleting...</div>"
|
||||
puts "<ul style=\"list-style-type: square\">"
|
||||
|
||||
foreach file [cgi_get files] {
|
||||
|
||||
puts -nonewline "<li>\"$file\"..."
|
||||
regsub -all {([\\["$])} $dir {\\\1} dir
|
||||
if {![string match "$dir/*" $file]} {
|
||||
|
||||
if {[string first "$dir/" $file] != 0} {
|
||||
puts "Error - outside directory."
|
||||
continue
|
||||
}
|
||||
|
||||
if {[string first $dustbin $file] > -1} {
|
||||
if {$dustbin ne "" && [string first $dustbin $file] > -1} {
|
||||
set ldustbin ""
|
||||
} else {
|
||||
set ldustbin $dustbin
|
||||
@@ -52,7 +55,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 {
|
||||
@@ -66,7 +71,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"
|
||||
@@ -11,6 +11,7 @@ cgi_input
|
||||
#cgi_dump
|
||||
|
||||
set file [cgi_get file]
|
||||
set urlbase [cgi_get base ""]
|
||||
|
||||
# Default to just downloading the raw file.
|
||||
set url $file
|
||||
@@ -22,7 +23,7 @@ if {[string match {*.ts} $file]} {
|
||||
# If it's encrypted on disk and the DLNA option is available,
|
||||
# then use the server to perform decryption on the fly.
|
||||
if {[$ts flag "ODEncrypted"] > 0} {
|
||||
set dlna [$ts dlnaloc]
|
||||
set dlna [$ts dlnaloc $urlbase]
|
||||
if {[llength $dlna]} { lassign $dlna url mime }
|
||||
|
||||
#puts "DLNA: $dlna"
|
||||
|
||||
@@ -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 ""
|
||||
@@ -17,6 +17,8 @@ set ts [ts fetch $file]
|
||||
|
||||
puts "{"
|
||||
puts "\"title\" : \"[$ts get title]\","
|
||||
puts "\"synopsis\" : \"[$ts get synopsis]\""
|
||||
puts "\"synopsis\" : \"[$ts get synopsis]\","
|
||||
puts "\"guidance\" : \"[$ts get guidance]\","
|
||||
puts "\"genre\" : [$ts get genre]"
|
||||
puts "}"
|
||||
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -85,13 +85,29 @@ if {$type eq "ts"} {
|
||||
<th>Size</th>
|
||||
<td>$sz</td>
|
||||
"
|
||||
set dlna [$ts dlnaloc]
|
||||
lassign $dlna url
|
||||
if {[llength $dlna]} {
|
||||
lassign [$ts dlnaloc] url
|
||||
if {$url ne ""} {
|
||||
puts "</tr><tr><th>DLNA URL</th>
|
||||
<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]
|
||||
@@ -102,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."
|
||||
}
|
||||
|
||||
15
var/mongoose/cgi-bin/browse/iconset.jim
Executable file
15
var/mongoose/cgi-bin/browse/iconset.jim
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require browse.class
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
|
||||
set file [cgi_get file]
|
||||
|
||||
if {[file isdirectory $file]} {
|
||||
lassign [{dir iconset} $file] icons #attrs
|
||||
puts [join $icons ""]
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/setup
|
||||
require ts.class pretty_size
|
||||
|
||||
puts "Content-Type: text/html\r\n\r\n"
|
||||
header
|
||||
|
||||
cgi_input 1
|
||||
#cgi_dump
|
||||
|
||||
puts {
|
||||
<style>
|
||||
#filelist { list-style-type: none; margin: 0; padding: 0; }
|
||||
#filelist li { margin: 0 3px 3px 3px; padding: 0.4em; padding-left: 1.5em;
|
||||
height: 35px; }
|
||||
#filelist li span { position: absolute; margin-left: -1.3em; }
|
||||
span.pl { padding-left: 2em; }
|
||||
</style>
|
||||
|
||||
<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="/js/touchbridge.js"></script>
|
||||
|
||||
<p><b>
|
||||
Drag the files below into order, enter a name for the resulting file and then
|
||||
click the <i>Join</i> button.</b>
|
||||
}
|
||||
|
||||
puts "<ul id=filelist>"
|
||||
set esize 0
|
||||
foreach file [split [cgi_get files] ","] {
|
||||
set file [cgi_unquote_input $file]
|
||||
set dir [file dirname $file]
|
||||
set ts [ts fetch $file]
|
||||
puts "<li class=\"va ui-state-default\" id=\"$file\"><span
|
||||
class=\"va ui-icon ui-icon-arrowthick-2-n-s\"></span>
|
||||
<img class=va src=/img/Video_TS.png>
|
||||
<span class=pl>
|
||||
$file ([clock format [$ts duration 1] -format "%T"])
|
||||
\[[pretty_size [$ts size]]\]
|
||||
<br><i style=\"font-size: 0.8em\">[$ts get title]</i>
|
||||
</span>
|
||||
</li>"
|
||||
incr esize [$ts size]
|
||||
}
|
||||
puts "</ul>"
|
||||
|
||||
puts "
|
||||
<br><br>
|
||||
|
||||
<div id=joindiv>
|
||||
Name for joined file:
|
||||
<input id=dest name=dfile class=\"text ui-widget-content ui-corner-all\"
|
||||
length=20 maxlength=50>
|
||||
<button id=dojoin>Join</button>
|
||||
</div>
|
||||
|
||||
<div id=progressdiv style=\"display: none\">
|
||||
Joining: <div id=progressbar></div>
|
||||
<button id=back
|
||||
dir=\"[cgi_quote_url $dir]\"
|
||||
esize=\"$esize\"
|
||||
style=\"display: none\">Back to media list</button>
|
||||
<div id=output class=pre style=\"margin-top: 10px\"></div>
|
||||
</div>
|
||||
"
|
||||
|
||||
puts {
|
||||
<script type=text/javascript>
|
||||
|
||||
$('#filelist li').hover(
|
||||
function() { $(this).css('cursor', 'pointer'); },
|
||||
function() { $(this).css('cursor', 'auto'); }
|
||||
);
|
||||
|
||||
var handle = 0;
|
||||
|
||||
function update()
|
||||
{
|
||||
$.get('/cgi-bin/browse/join_progress.jim'
|
||||
+ '?esize=' + $('#back').attr('esize')
|
||||
+ '&file=' + $('#back').attr('dir') + '/' + $('#dest').val(),
|
||||
function(data) {
|
||||
if (handle)
|
||||
$('#progressbar').reportprogress(data);
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#progressbar').reportprogress(0);
|
||||
|
||||
$('#back').button().click(function() {
|
||||
window.location = '/cgi-bin/browse.jim?dir=' + $(this).attr('dir');
|
||||
});
|
||||
|
||||
$('#filelist').sortable().disableSelection();
|
||||
|
||||
$('#dojoin').button().attr('disabled', true).addClass('ui-state-disabled')
|
||||
.click(function() {
|
||||
var files = $('#filelist').sortable('toArray');
|
||||
var sfiles = new Array();
|
||||
for (x in files)
|
||||
sfiles.push(encodeURIComponent(files[x]));
|
||||
|
||||
$('#joindiv').hide('slow');
|
||||
$('#progressdiv').show('slow');
|
||||
handle = setInterval("update()", 1000);
|
||||
|
||||
$('#output').text('Please do not interrupt...')
|
||||
.load('/cgi-bin/browse/join_backend.jim?files=' +
|
||||
sfiles.join() + '&dest=' + $('#dest').val(),
|
||||
function() {
|
||||
clearInterval(handle);
|
||||
handle = 0;
|
||||
$('#back').show();
|
||||
$('#progressbar').reportprogress(100);
|
||||
});
|
||||
});
|
||||
|
||||
$('#dest').val('').keyup(function() {
|
||||
if ($(this).val().length > 0)
|
||||
$('#dojoin')
|
||||
.removeProp('disabled').removeClass('ui-state-disabled');
|
||||
else
|
||||
$('#dojoin')
|
||||
.prop('disabled', true).addClass('ui-state-disabled');
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
}
|
||||
|
||||
footer
|
||||
|
||||
@@ -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"
|
||||
6
var/mongoose/cgi-bin/browse/join/join.css
Normal file
6
var/mongoose/cgi-bin/browse/join/join.css
Normal file
@@ -0,0 +1,6 @@
|
||||
#filelist { list-style-type: none; margin: 0; padding: 0; }
|
||||
#filelist li { margin: 0 3px 3px 3px; padding: 0.4em; padding-left: 1.5em;
|
||||
height: 35px; }
|
||||
#filelist li span { position: absolute; margin-left: -1.3em; }
|
||||
span.pl { padding-left: 2em; }
|
||||
|
||||
65
var/mongoose/cgi-bin/browse/join/join.jim
Executable file
65
var/mongoose/cgi-bin/browse/join/join.jim
Executable file
@@ -0,0 +1,65 @@
|
||||
#!/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"
|
||||
header
|
||||
|
||||
cgi_input 1
|
||||
#cgi_dump
|
||||
|
||||
puts "
|
||||
<link href=/css/jquery.progressbar.css rel=stylesheet type=text/css />
|
||||
<link href=join.css rel=stylesheet type=text/css />
|
||||
<script type=text/javascript src=/js/jquery.progressbar.js></script>
|
||||
<script type=text/javascript src=/js/touchbridge.js></script>
|
||||
<script type/text/javascript src=join.js></script>
|
||||
|
||||
<p><b>
|
||||
Drag the files below into order, enter a name for the resulting file and then
|
||||
click the <i>Join</i> button.</b>
|
||||
"
|
||||
|
||||
puts "<ul id=filelist>"
|
||||
set esize 0
|
||||
foreach file [split [cgi_get files] ","] {
|
||||
set file [cgi_unquote_input $file]
|
||||
set dir [file dirname $file]
|
||||
set ts [ts fetch $file]
|
||||
puts "<li class=\"va ui-state-default\" id=\"$file\"><span
|
||||
class=\"va ui-icon ui-icon-arrowthick-2-n-s\"></span>
|
||||
<img class=va src=/img/Video_TS.png>
|
||||
<span class=pl>
|
||||
$file ([clock format [$ts duration 1] -format "%T"])
|
||||
\[[pretty_size [$ts size]]\]
|
||||
<br><i style=\"font-size: 0.8em\">[$ts get title]</i>
|
||||
</span>
|
||||
</li>"
|
||||
incr esize [$ts size]
|
||||
}
|
||||
puts "</ul>"
|
||||
|
||||
puts "
|
||||
<br><br>
|
||||
|
||||
<div id=joindiv>
|
||||
Name for joined file:
|
||||
<input id=dest name=dfile class=\"text ui-widget-content ui-corner-all\"
|
||||
length=20 maxlength=50>
|
||||
<button id=dojoin>Join</button>
|
||||
</div>
|
||||
|
||||
<div id=progressdiv style=\"display: none\">
|
||||
Joining: <div id=progressbar></div>
|
||||
<button id=back
|
||||
dir=\"[cgi_quote_url $dir]\"
|
||||
esize=\"$esize\"
|
||||
style=\"display: none\">Back to media list</button>
|
||||
<div id=output class=pre style=\"margin-top: 10px\"></div>
|
||||
</div>
|
||||
"
|
||||
|
||||
footer
|
||||
|
||||
62
var/mongoose/cgi-bin/browse/join/join.js
Executable file
62
var/mongoose/cgi-bin/browse/join/join.js
Executable file
@@ -0,0 +1,62 @@
|
||||
|
||||
$('#filelist li').hover(
|
||||
function() { $(this).css('cursor', 'pointer'); },
|
||||
function() { $(this).css('cursor', 'auto'); }
|
||||
);
|
||||
|
||||
var handle = 0;
|
||||
|
||||
function update()
|
||||
{
|
||||
$.get('progress.jim'
|
||||
+ '?esize=' + $('#back').attr('esize')
|
||||
+ '&file=' + $('#back').attr('dir') + '/' + $('#dest').val(),
|
||||
function(data) {
|
||||
if (handle)
|
||||
$('#progressbar').reportprogress(data);
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#progressbar').reportprogress(0);
|
||||
|
||||
$('#back').button().click(function() {
|
||||
window.location = '/cgi-bin/browse.jim?dir=' + $(this).attr('dir');
|
||||
});
|
||||
|
||||
$('#filelist').sortable().disableSelection();
|
||||
|
||||
$('#dojoin').button().attr('disabled', true).addClass('ui-state-disabled')
|
||||
.click(function() {
|
||||
var files = $('#filelist').sortable('toArray');
|
||||
var sfiles = new Array();
|
||||
for (x in files)
|
||||
sfiles.push(encodeURIComponent(files[x]));
|
||||
|
||||
$('#joindiv').hide('slow');
|
||||
$('#progressdiv').show('slow');
|
||||
handle = setInterval("update()", 1000);
|
||||
|
||||
$('#output').text('Please do not interrupt...')
|
||||
.load('execute.jim?files=' +
|
||||
sfiles.join() + '&dest=' + $('#dest').val(),
|
||||
function() {
|
||||
clearInterval(handle);
|
||||
handle = 0;
|
||||
$('#back').show();
|
||||
$('#progressbar').reportprogress(100);
|
||||
});
|
||||
});
|
||||
|
||||
$('#dest').val('').keyup(function() {
|
||||
if ($(this).val().length > 0)
|
||||
$('#dojoin')
|
||||
.removeProp('disabled').removeClass('ui-state-disabled');
|
||||
else
|
||||
$('#dojoin')
|
||||
.prop('disabled', true).addClass('ui-state-disabled');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -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 ""
|
||||
@@ -9,45 +10,40 @@ puts ""
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
#renameorig
|
||||
#titleorig
|
||||
#rename
|
||||
#renametitle
|
||||
set file [cgi_get renamefile "-"]
|
||||
if {$file eq "-"} exit
|
||||
|
||||
#set _cgi(renameorig) "/media/My Video/The Walking Dead/The Walking Dead_20110521_2201.ts"
|
||||
#set _cgi(rename) "Last Episode"
|
||||
|
||||
if {![dict exists $_cgi renameorig]} { exit }
|
||||
|
||||
set file [dict get $_cgi renameorig]
|
||||
set newfile [dict get $_cgi rename]
|
||||
|
||||
if {[string length [string trim $newfile]] == 0 || $file eq $newfile} {
|
||||
set newfile ""
|
||||
}
|
||||
set newfile [string trim [cgi_get rename]]
|
||||
set dir [file dirname $file]
|
||||
|
||||
if {[file isdirectory $file]} {
|
||||
#puts "Directory."
|
||||
if {$newfile ne ""} {
|
||||
set dir [file dirname $file]
|
||||
set newfile "${dir}/${newfile}"
|
||||
file rename $file $newfile
|
||||
}
|
||||
} elseif {[set ts [ts fetch $file]] != 0} {
|
||||
#puts "TS file."
|
||||
|
||||
catch {
|
||||
set title [dict get $_cgi renametitle]
|
||||
set titleorig [dict get $_cgi titleorig]
|
||||
|
||||
if {[string length [string trim $title]] > 0 &&
|
||||
$title ne $titleorig} {
|
||||
$ts settitle $title
|
||||
foreach attr {title synopsis guidance genre} {
|
||||
if {[catch {
|
||||
set new [string trim [cgi_get "rename_$attr"]]
|
||||
set old [$ts get $attr]
|
||||
if {[string length $new] > 0 && $new ne $old} {
|
||||
$ts set$attr $new
|
||||
}
|
||||
} msg]} {
|
||||
puts "$attr: $msg"
|
||||
}
|
||||
}
|
||||
if {$newfile ne ""} { ts renamegroup $file $newfile }
|
||||
|
||||
if {"$dir/$newfile.ts" ne "$file"} { ts renamegroup $file $newfile }
|
||||
} else {
|
||||
#puts "Normal file."
|
||||
if {$newfile ne ""} { ts renamegroup $file $newfile }
|
||||
if {$newfile ne ""} {
|
||||
set newfile "$dir/$newfile[file extension $file]"
|
||||
puts "Rename ($file) -> ($newfile)"
|
||||
file rename $file $newfile
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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 ""
|
||||
|
||||
27
var/mongoose/cgi-bin/browse/shrunk.jim
Executable file
27
var/mongoose/cgi-bin/browse/shrunk.jim
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
|
||||
#puts "Content-Type: text/plain"
|
||||
puts "Content-Type: application/json"
|
||||
puts ""
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
set dir [cgi_get dir "/media/My Video/Children"]
|
||||
|
||||
puts "{"
|
||||
foreach file [readdir -nocomplain $dir] {
|
||||
if {![string match {*.ts} $file]} { continue }
|
||||
|
||||
set xfile [file rootname $file]
|
||||
if {[catch {set eit [exec /mod/bin/stripts -cq "$dir/$xfile"]}]} {
|
||||
continue
|
||||
}
|
||||
|
||||
puts " \"$file\": $eit,"
|
||||
}
|
||||
puts " \"dummy\": 0"
|
||||
puts "}"
|
||||
|
||||
@@ -12,19 +12,20 @@ cgi_input
|
||||
#set _cgi(dir) "/media/My Video"
|
||||
|
||||
set dir [dict get $_cgi dir]
|
||||
set dlen [string length "$dir/"]
|
||||
|
||||
#9.4G /media/My Video/Archive
|
||||
#1.4G /media/My Video/CSI_ Crime Scene Investigation
|
||||
puts "{"
|
||||
regsub -all {([\\["$])} $dir {\\\1} xdir
|
||||
foreach line [split [exec /mod/bin/busybox/du -h -d 1 "$dir/"] "\n"] {
|
||||
lassign [split $line "\t"] size node
|
||||
regsub -- "^$xdir/" $node "" node
|
||||
set node [string range $node $dlen end]
|
||||
puts "\"$node\" : \"$size\","
|
||||
}
|
||||
|
||||
# Handle symbolic links.
|
||||
foreach file [glob -nocomplain "$dir/*"] {
|
||||
foreach file [readdir $dir] {
|
||||
set file "$dir/$file"
|
||||
if {[catch {set lk [file readlink $file]}]} continue
|
||||
|
||||
if {![string match "/*" $lk]} { set lk "$dir/$lk" }
|
||||
|
||||
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/*
|
||||
|
||||
18
var/mongoose/cgi-bin/cfwreset.cgi
Executable file
18
var/mongoose/cgi-bin/cfwreset.cgi
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -n "$QUERY_STRING" ] && rma="${QUERY_STRING##*=}" || rma=0
|
||||
|
||||
echo "Content-Type: text/plain"
|
||||
echo
|
||||
|
||||
if [ "$rma" = 1 ]; then
|
||||
modver="`cat /etc/modversion`"
|
||||
if [ "$modver" -ge 215 ]; then
|
||||
touch /var/lib/humaxtv_backup/.rma
|
||||
else
|
||||
touch /var/lib/humaxtv/.rma
|
||||
fi
|
||||
else
|
||||
touch /var/lib/humaxtv/mod/_RESET_CUSTOM_FIRMWARE_ENVIRONMENT
|
||||
fi
|
||||
|
||||
@@ -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"
|
||||
@@ -71,6 +71,7 @@ foreach tw [$db query {
|
||||
switch $name {
|
||||
"BBC ONE" { set mux "PSB1/BBC A" }
|
||||
"ITV1" { set mux "PSB2/D3&4" }
|
||||
"ITV" { set mux "PSB2/D3&4" }
|
||||
"BBC One HD" { set mux "PSB3/BBC B (HD)" }
|
||||
"ITV3" { set mux "COM4/SDN" }
|
||||
"Dave" { set mux "COM5/ARQ A" }
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -1,125 +0,0 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/setup
|
||||
require ts.class pretty_size altrow
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
set dir [cgi_get dir "/media/My Video"]
|
||||
set doit [cgi_get doit 0]
|
||||
|
||||
# Strip double slashes
|
||||
|
||||
header
|
||||
|
||||
puts "<fieldset style=\"display: inline\">
|
||||
<legend>De-duplicate <span id=dir>$dir</span></legend>
|
||||
<table class=borders>
|
||||
<tr>
|
||||
<th>File</th>
|
||||
<th>Proposed Filename</th>
|
||||
<th>Proposed Title</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
"
|
||||
|
||||
regsub -all -- {\/+} "$dir/*" "/" sdir
|
||||
|
||||
set seen {}
|
||||
|
||||
foreach file [lsort [glob -nocomplain "$sdir"]] {
|
||||
if {[file extension $file] ne ".hmt"} { continue }
|
||||
altrow
|
||||
set ts [ts fetch $file 1]
|
||||
set base [file tail [file rootname $file]]
|
||||
puts "<td nowrap>$base</td>"
|
||||
set syn [$ts get synopsis]
|
||||
regsub -nocase -all -- {^new series\.* *} $syn "" syn
|
||||
regsub -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} {
|
||||
puts -nonewline "Duplicate"
|
||||
if {$doit} {
|
||||
set dupdir "$dir/_duplicates"
|
||||
if {![file exists $dupdir]} { file mkdir $dupdir }
|
||||
while {[file exists $dupdir/$fn.hmt]} {
|
||||
append fn "~"
|
||||
}
|
||||
ts renamegroup $file "_duplicates/$fn"
|
||||
puts -nonewline " - Renamed to _duplicates/$fn"
|
||||
}
|
||||
} elseif {[string length $syn] > 40} {
|
||||
puts -nonewline "Cannot process"
|
||||
} elseif {$base eq $fn} {
|
||||
puts -nonewline "Nothing to do"
|
||||
} elseif {[file exists "$dir/$fn.ts"]} {
|
||||
puts -nonewline "Preserving"
|
||||
} elseif {$doit} {
|
||||
# Dooooo, it.
|
||||
$ts settitle $syn
|
||||
ts renamegroup $file $fn
|
||||
puts -nonewline "Done"
|
||||
}
|
||||
lappend seen $fn
|
||||
|
||||
puts "</td>"
|
||||
puts "</tr>"
|
||||
}
|
||||
|
||||
puts {
|
||||
</table>
|
||||
</fieldset>
|
||||
<div style="padding-top: 2em">
|
||||
<small>
|
||||
<button id=browse>Back to media browser</button>
|
||||
}
|
||||
|
||||
if {!$doit} { puts "<button id=dedup>Process folder</button>" }
|
||||
|
||||
puts {
|
||||
</small>
|
||||
|
||||
</div>
|
||||
|
||||
<script type=text/javascript>
|
||||
$('#browse').button().click(function() {
|
||||
window.location = '/cgi-bin/browse.jim?dir=' +
|
||||
encodeURIComponent($('#dir').text());
|
||||
});
|
||||
}
|
||||
|
||||
if {!$doit} {
|
||||
puts {
|
||||
$('#dedup').button().click(function() {
|
||||
window.location = window.location + '&doit=1';
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
puts "</script>"
|
||||
|
||||
footer
|
||||
|
||||
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)"
|
||||
}
|
||||
|
||||
23
var/mongoose/cgi-bin/epg/db.jim
Executable file
23
var/mongoose/cgi-bin/epg/db.jim
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
|
||||
PATH=$PATH:/mod/bin export PATH
|
||||
|
||||
echo "Content-Type: text/plain"
|
||||
echo ""
|
||||
|
||||
[ -n "$QUERY_STRING" ] && data="${QUERY_STRING##*=}" || data=epg
|
||||
|
||||
case $data in
|
||||
channels)
|
||||
sqlite3 -header -batch -separator ' ' \
|
||||
/var/lib/humaxtv/channel.db '
|
||||
select * from TBL_SVC;
|
||||
'
|
||||
;;
|
||||
|
||||
|
||||
*) /mod/bin/epg -p dump ;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -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"
|
||||
@@ -79,7 +79,7 @@ if {[$record get event_crid] != ""} {
|
||||
puts "
|
||||
<tr>
|
||||
<th>CRID</th><td>
|
||||
<a href=/cgi-bin/epg_search.jim?crid=[$record get event_crid]>
|
||||
<a href=/cgi-bin/epg/search.jim?crid=[$record get event_crid]>
|
||||
<img border=0 height=14
|
||||
src=/images/421_1_00_CH_Title_2R_Arrow.png>
|
||||
[$record get channel_crid][$record get event_crid]
|
||||
@@ -93,7 +93,7 @@ if {[$record get series_crid] != ""} {
|
||||
puts "
|
||||
<tr>
|
||||
<th nowrap>Series CRID</th><td>
|
||||
<a href=/cgi-bin/epg_search.jim?scrid=[$record get series_crid]>
|
||||
<a href=/cgi-bin/epg/search.jim?scrid=[$record get series_crid]>
|
||||
<img border=0 height=14
|
||||
src=/images/421_1_00_CH_Title_2R_Arrow.png>
|
||||
[$record get channel_crid][$record get series_crid]
|
||||
@@ -107,7 +107,7 @@ if {[$record get rec_crid] != ""} {
|
||||
set rec [$record recommended]
|
||||
if {$rec != ""} {
|
||||
puts "<tr><th>Recommends</th><td>
|
||||
<a href=/cgi-bin/epg_search.jim?crid=[$rec get event_crid]>
|
||||
<a href=/cgi-bin/epg/search.jim?crid=[$rec get event_crid]>
|
||||
<img border=0 height=14
|
||||
src=/images/421_1_00_CH_Title_2R_Arrow.png>
|
||||
[$rec get name]
|
||||
@@ -126,7 +126,7 @@ puts "
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<a class=footnote href=/cgi-bin/epg_dump.jim?service=[$record get service_id]&event=[$record get event_id]&raw=1>
|
||||
<a class=footnote href=/cgi-bin/epg/dump.jim?service=[$record get service_id]&event=[$record get event_id]&raw=1>
|
||||
<img border=0 src=/images/532_1_00_Find_Path_Arrow.png>
|
||||
Show raw EPG info
|
||||
</a>
|
||||
@@ -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"
|
||||
@@ -60,7 +60,7 @@ if {$ct > 0 } {
|
||||
} elseif {$scrid ne ""} {
|
||||
set records [epg fetch dump -scrid $scrid]
|
||||
} elseif {$searchterm ne ""} {
|
||||
set records [epg fetch $cmd -extra $searchterm]
|
||||
set records [epg dbfetch $cmd -term $searchterm]
|
||||
} else {
|
||||
set records {}
|
||||
}
|
||||
@@ -108,7 +108,7 @@ foreach record [lsort -command rsort $records] {
|
||||
puts "<td>[$record get channel_num]</td>"
|
||||
puts "<td>[$record channel_icon 50]</td>"
|
||||
puts "<td nowrap>
|
||||
<a href=/cgi-bin/epg_service.jim?service=[$record get service_id]>
|
||||
<a href=/cgi-bin/epg/service.jim?service=[$record get service_id]>
|
||||
[$record get channel_name]
|
||||
</a></td>"
|
||||
puts [$record cell]
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/setup
|
||||
source /mod/webif/lib/setup
|
||||
require epg.class spinner.class altrow
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
@@ -53,7 +53,7 @@ puts {
|
||||
set i 0
|
||||
foreach record $records {
|
||||
altrow
|
||||
$record get_channel_info
|
||||
#$record get_channel_info
|
||||
set ended [$record ended]
|
||||
if {[$record showing]} {
|
||||
puts "<td><img src=/images/111_1_00_Cursor_2R_Arrow.png></td>"
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/setup
|
||||
source /mod/webif/lib/setup
|
||||
require pkg.class chunked
|
||||
|
||||
cgi_input
|
||||
@@ -11,7 +11,7 @@ set cmd [cgi_get cmd update]
|
||||
|
||||
proc opkg {cmd} {
|
||||
chunk ">>> opkg $cmd\r\n"
|
||||
set bcmd "|/mod/var/mongoose/lib/opkg $cmd"
|
||||
set bcmd "|/mod/webif/lib/bin/opkg $cmd"
|
||||
set fd [open $bcmd r]
|
||||
while {[gets $fd line] >= 0} {
|
||||
chunk "$line\r\n"
|
||||
@@ -30,6 +30,9 @@ if {$cmd eq "update" || $cmd eq "upgrade"} {
|
||||
chunk "Updating package meta information\r\n"
|
||||
pkg fetchmeta
|
||||
chunk "Done.\r\n"
|
||||
chunk "Updating diagnostic meta information\r\n"
|
||||
pkg fetchdiagmeta
|
||||
chunk "Done.\r\n"
|
||||
}
|
||||
|
||||
end_chunked
|
||||
|
||||
@@ -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,9 +1,8 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/setup
|
||||
require settings.class
|
||||
require plugin
|
||||
source /mod/webif/lib/setup
|
||||
require settings.class plugin system.class
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
@@ -22,6 +21,17 @@ if {[cgi_get act] eq "https"} {
|
||||
exit
|
||||
}
|
||||
|
||||
if {[cgi_get act] eq "xtelnet"} {
|
||||
if {[cgi_get val off] eq "off"} {
|
||||
file delete /mod/boot/xtelnet
|
||||
puts "Telnet server expert mode will be disabled after next reboot."
|
||||
} else {
|
||||
exec /mod/bin/busybox/touch /mod/boot/xtelnet
|
||||
puts "Telnet server expert mode will be enabled after next reboot."
|
||||
}
|
||||
exit
|
||||
}
|
||||
|
||||
set settings [settings new]
|
||||
|
||||
set hostname [$settings hostname]
|
||||
@@ -29,6 +39,10 @@ set smtp_server [$settings smtp_server]
|
||||
set channel_group [$settings channel_group]
|
||||
set epg_style [$settings epg_style]
|
||||
set pkgdev [$settings pkgdev]
|
||||
set notoolbar [$settings notoolbar]
|
||||
set nomobile [$settings nomobile]
|
||||
set xepghours [$settings xepghours]
|
||||
if {$xepghours == 0} { set xepghours 4 }
|
||||
|
||||
# Handle updates
|
||||
|
||||
@@ -63,11 +77,11 @@ proc handle_str_update {var old {text "Value"}} {
|
||||
handle_str_update hostname $hostname Hostname
|
||||
_handle_update ascii smtp_server $smtp_server "SMTP Server"
|
||||
handle_int_update channel_group $channel_group "Channel Group"
|
||||
handle_int_update xepghours $xepghours "Grid EPG Hours"
|
||||
handle_str_update epg_style $epg_style "EPG Type"
|
||||
if {[dict exists $_cgi pkgdevoff] && ![dict exists $_cgi pkgdev]} {
|
||||
set _cgi(pkgdev) 0
|
||||
}
|
||||
handle_int_update pkgdev $pkgdev "Development Package Display"
|
||||
handle_int_update notoolbar $notoolbar "Disable toolbar"
|
||||
handle_int_update nomobile $nomobile "Disable mobile link"
|
||||
|
||||
set acluser [cgi_get acluser "-"]
|
||||
set aclpass [cgi_get aclpass "-"]
|
||||
@@ -143,6 +157,28 @@ 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 -nonewline "
|
||||
<tr>
|
||||
<th class=key>Mobile link on main page?</th>
|
||||
<td><input id=mobile_toggle name=mobile type=checkbox value=yes"
|
||||
if {$nomobile == 0} { puts -nonewline " checked" }
|
||||
puts ">
|
||||
<div id=mobile_output></div>
|
||||
</td>
|
||||
</tr>
|
||||
"
|
||||
|
||||
puts "
|
||||
<tr>
|
||||
<form class=auto id=epg_style method=get action=$env(REQUEST_URI)>
|
||||
@@ -197,6 +233,33 @@ puts "
|
||||
</tr>
|
||||
"
|
||||
|
||||
puts "
|
||||
<tr>
|
||||
<form class=auto id=xepghours method=get action=$env(REQUEST_URI)>
|
||||
<th class=key>Grid-style EPG Hours</th>
|
||||
<td><select id=xepghours name=xepghours
|
||||
class=\"text ui-widget-content ui-corner-all\">
|
||||
"
|
||||
|
||||
foreach xehopt {2 3 4 5 6} {
|
||||
puts -nonewline "<option value=$xehopt"
|
||||
if {$xehopt == $xepghours} {
|
||||
puts -nonewline " selected"
|
||||
}
|
||||
puts ">$xehopt hours"
|
||||
}
|
||||
|
||||
puts "
|
||||
</select>
|
||||
<small>
|
||||
<input name=xepghours value=\"set\" type=submit>
|
||||
</small>
|
||||
<div id=xepghours_output></div>
|
||||
</td>
|
||||
</form>
|
||||
</tr>
|
||||
"
|
||||
|
||||
puts "
|
||||
</table>
|
||||
</fieldset>
|
||||
@@ -318,57 +381,43 @@ $('button.pwchange').click(function(el) {
|
||||
</script>
|
||||
}
|
||||
|
||||
puts "
|
||||
puts -nonewline "
|
||||
<br><br>
|
||||
<fieldset style=\"display: inline\">
|
||||
<legend> Advanced Settings </legend>
|
||||
<table>
|
||||
<tr>
|
||||
<th class=key>Show development and advanced packages?</th>
|
||||
<td><input name=pkgdev id=pkgdev value=1 type=checkbox
|
||||
"
|
||||
if {$pkgdev} { puts -nonewline " checked" }
|
||||
puts ">
|
||||
</td>
|
||||
</tr>
|
||||
"
|
||||
|
||||
puts "
|
||||
if {[system modversion 1] >= 214} {
|
||||
|
||||
puts -nonewline "
|
||||
<tr>
|
||||
<form class=auto id=pkgdev method=get action=$env(REQUEST_URI)>
|
||||
<th class=key>Show development and advanced packages?</th>
|
||||
<td><input name=pkgdevoff value=0 type=hidden>
|
||||
<input name=pkgdev id=pkgdev value=1 type=checkbox
|
||||
"
|
||||
if {$pkgdev} { puts " checked" }
|
||||
puts {
|
||||
>
|
||||
<small>
|
||||
<input id=pkgdev_submit value="save" type=submit>
|
||||
</small>
|
||||
<div id=pkgdev_output></div>
|
||||
<th class=key>Expert mode telnet server?</th>
|
||||
<td><input id=xtelnet_toggle name=xtelnet type=checkbox value=yes"
|
||||
if {[file exists /mod/boot/xtelnet]} { puts -nonewline " checked" }
|
||||
puts ">
|
||||
<div id=xtelnet_output></div>
|
||||
</td>
|
||||
</form>
|
||||
</tr>
|
||||
"
|
||||
|
||||
}
|
||||
|
||||
puts "
|
||||
</table>
|
||||
<div id=pkgdev_output></div>
|
||||
</fieldset>
|
||||
"
|
||||
|
||||
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
|
||||
|
||||
|
||||
@@ -21,20 +21,45 @@
|
||||
|
||||
$(document).ready(function () {
|
||||
$(":submit").button();
|
||||
$(":checkbox").iphoneStyle();
|
||||
//$('[type="checkbox"] :not(.yesno)').iphoneStyle();
|
||||
$('[type="checkbox"]').iphoneStyle({
|
||||
checkedLabel: 'YES',
|
||||
uncheckedLabel: 'NO'
|
||||
});
|
||||
$('form.auto').each(function(i, el) {
|
||||
var id = $(this).attr('id');
|
||||
var output = '#' + id + '_output'
|
||||
var output = '#' + id + '_output';
|
||||
$(this).ajaxForm({
|
||||
target: output,
|
||||
success: function() {
|
||||
$(output).css('font-style', 'italic');
|
||||
$(output).show('slow');
|
||||
$(output).delay(2000).fadeOut('slow');
|
||||
$(output)
|
||||
.css('font-style', 'italic')
|
||||
.show('slow')
|
||||
.delay(2000)
|
||||
.fadeOut('slow');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#pkgdev').change(function() {
|
||||
var arg = '0';
|
||||
if ($(this).attr('checked'))
|
||||
arg = '1';
|
||||
|
||||
$(this).disable();
|
||||
|
||||
$('#pkgdev_output')
|
||||
.empty()
|
||||
.show('slow')
|
||||
.load('/cgi-bin/settings.jim?pkgdev=' + arg,
|
||||
function() {
|
||||
$('#pkgdev').enable();
|
||||
$('#pkgdev_output')
|
||||
.css('font-style', 'italic')
|
||||
.delay(2000).fadeOut('slow');
|
||||
});
|
||||
});
|
||||
|
||||
$('#https_toggle').change(function() {
|
||||
var arg = 'off';
|
||||
if ($(this).attr('checked'))
|
||||
@@ -54,5 +79,63 @@ $(document).ready(function () {
|
||||
.delay(2000).fadeOut('slow');
|
||||
});
|
||||
});
|
||||
|
||||
$('#xtelnet_toggle').change(function() {
|
||||
var arg = 'off';
|
||||
if ($(this).attr('checked'))
|
||||
arg = 'on';
|
||||
|
||||
$(this).disable();
|
||||
|
||||
$('#xtelnet_output')
|
||||
.empty()
|
||||
.html('<img src=/img/loading.gif>Please Wait...')
|
||||
.show('slow')
|
||||
.load('/cgi-bin/settings.jim?act=xtelnet&val=' + arg,
|
||||
function() {
|
||||
$('#xtelnet_toggle').enable();
|
||||
$('#xtelnet_output')
|
||||
.css('font-style', 'italic')
|
||||
.delay(2000).fadeOut('slow');
|
||||
});
|
||||
});
|
||||
|
||||
$('#toolbar_toggle').change(function() {
|
||||
var arg = '1';
|
||||
if ($(this).attr('checked'))
|
||||
arg = '0';
|
||||
|
||||
$(this).disable();
|
||||
|
||||
$('#toolbar_output')
|
||||
.empty()
|
||||
.show('slow')
|
||||
.load('/cgi-bin/settings.jim?notoolbar=' + arg,
|
||||
function() {
|
||||
$('#toolbar_toggle').enable();
|
||||
$('#toolbar_output')
|
||||
.css('font-style', 'italic')
|
||||
.delay(2000).fadeOut('slow');
|
||||
});
|
||||
});
|
||||
|
||||
$('#mobile_toggle').change(function() {
|
||||
var arg = '1';
|
||||
if ($(this).attr('checked'))
|
||||
arg = '0';
|
||||
|
||||
$(this).disable();
|
||||
|
||||
$('#mobile_output')
|
||||
.empty()
|
||||
.show('slow')
|
||||
.load('/cgi-bin/settings.jim?nomobile=' + arg,
|
||||
function() {
|
||||
$('#mobile_toggle').enable();
|
||||
$('#mobile_output')
|
||||
.css('font-style', 'italic')
|
||||
.delay(2000).fadeOut('slow');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1,49 +1,184 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require system.class findhsvc epg.class rsv.class
|
||||
|
||||
if {[catch {set pid [exec pgrep humaxtv]}]} { exit }
|
||||
set runmode cli
|
||||
if {[string match {*jim} $argv0]} { set runmode cgi }
|
||||
|
||||
if {[catch {set data [exec lsof -p $pid | grep Video | fgrep .ts]} ]} {
|
||||
exit
|
||||
set schedtime 1200
|
||||
case $runmode {
|
||||
cgi {
|
||||
cgi_input
|
||||
set type [cgi_get type "full"]
|
||||
puts "Content-Type: text/html"
|
||||
puts "Pragma: no-cache"
|
||||
puts "Expires: Thu, 01 Jan 1970 00:00:00 GMT"
|
||||
puts ""
|
||||
}
|
||||
cli {
|
||||
set type "full"
|
||||
if {"-X" in $argv} { set schedtime 7200 }
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
if {[catch {set pid [exec pgrep humaxtv]}]} {
|
||||
puts "Cannot find humaxtv process."
|
||||
exit
|
||||
}
|
||||
|
||||
sleep 2
|
||||
proc get_data {} {
|
||||
global pid
|
||||
|
||||
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>"
|
||||
if {$type eq "full"} {
|
||||
set data [get_data]
|
||||
} else {
|
||||
set 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)
|
||||
|
||||
if {$runmode eq "cgi"} {
|
||||
lappend output [concat \
|
||||
"<span class=\"va stitem\">\n" \
|
||||
" <img class=va src=/images/$icon>\n" \
|
||||
" <span>$mode <i>$name</i></span>\n" \
|
||||
"</span>\n" \
|
||||
]
|
||||
} else {
|
||||
lappend output "$mode $name"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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]%\]"
|
||||
}
|
||||
|
||||
if {$runmode eq "cgi"} {
|
||||
lappend output [concat \
|
||||
"<span class=\"va stitem\">\n" \
|
||||
" [epg channelicon $name 30 \
|
||||
{vertical-align: middle; padding: 0 4px 0 2px}]\n" \
|
||||
" <span>Watching <i>$lcn: $name $prog</i></span>\n" \
|
||||
"</span>\n" \
|
||||
]
|
||||
} else {
|
||||
lappend output "Watching $lcn: $name $prog"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if {[system instandby]} {
|
||||
if {$runmode eq "cgi"} {
|
||||
lappend output [concat \
|
||||
"<span class=\"va stitem\">\n" \
|
||||
" <img class=va width=28 style=\"padding: 0 4px\"" \
|
||||
"src=/img/standby.png>\n" \
|
||||
" <span>System is in standby.</span>\n" \
|
||||
"</span>" \
|
||||
]
|
||||
} else {
|
||||
lappend output "System is in standby."
|
||||
}
|
||||
}
|
||||
|
||||
set events [rsv list tbl_reservation \
|
||||
" where ersvtype = 3 and nsttime - [clock seconds] < $schedtime
|
||||
and nsttime > [clock seconds] "]
|
||||
foreach event $events {
|
||||
if {$runmode eq "cgi"} {
|
||||
set icon "175_1_11_Reservation_Record.png"
|
||||
lappend output [concat \
|
||||
"<span class=\"va stitem\">\n" \
|
||||
" <img class=va src=/images/$icon width=20>\n" \
|
||||
" <span>Will record <i>[$event name]</i>" \
|
||||
" on [$event channel_name] at"\
|
||||
" [clock format [$event get nsttime] -format {%H:%M}]" \
|
||||
" </span>\n" \
|
||||
"</span>\n" \
|
||||
} else {
|
||||
lappend output [concat \
|
||||
"Will record '[$event name]' " \
|
||||
"on [$event channel_name] at " \
|
||||
"[clock format [$event get nsttime] -format {%H:%M}]" \
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
if {[llength $output]} {
|
||||
puts [join $output " "]
|
||||
if {$runmode eq "cgi"} {
|
||||
puts [join $output "\n<br>\n"]
|
||||
} else {
|
||||
puts [join $output "\n"]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
12
var/mongoose/cgi-bin/streamsize.jim
Executable file
12
var/mongoose/cgi-bin/streamsize.jim
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
set stream "/mnt/hd3/Streamer_down_file"
|
||||
|
||||
puts "Content-type: text/plain\n"
|
||||
|
||||
if {[file exists $stream]} {
|
||||
puts -nonewline [file size $stream]
|
||||
} else {
|
||||
puts -nonewline 0
|
||||
}
|
||||
|
||||
@@ -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 ""
|
||||
@@ -11,27 +11,32 @@ require epg.class spinner.class altrow epg_search totop
|
||||
|
||||
cgi_input
|
||||
|
||||
puts {<link type="text/css" href="/css/xepg.css" rel="Stylesheet" />}
|
||||
puts {
|
||||
<link type="text/css" href="/css/xepg.css" rel="Stylesheet" />
|
||||
<script type=text/javascript src=/js/enadis.js></script>
|
||||
}
|
||||
|
||||
[spinner new {
|
||||
text "Loading Now/Next Information..."
|
||||
text "Loading EPG Information..."
|
||||
size "1.2em"
|
||||
style "margin: 1em;"
|
||||
}] start
|
||||
|
||||
require epg_popup
|
||||
|
||||
set stt [cgi_get stt [clock seconds]]
|
||||
if {$stt <= [clock seconds]} {
|
||||
set stt [clock seconds]
|
||||
set now [clock seconds]
|
||||
set stt [cgi_get stt $now]
|
||||
if {$stt <= $now} {
|
||||
set stt $now
|
||||
set current 1
|
||||
} else {
|
||||
set current 0
|
||||
}
|
||||
|
||||
set favlist [epg favlist]
|
||||
set favgroup [[settings] channel_group]
|
||||
|
||||
set hours 4.0
|
||||
set hours [expr 1.0 * [[settings] xepghours]]
|
||||
if {$hours == 0} { set hours 4.0 }
|
||||
set seconds $($hours * 3600)
|
||||
|
||||
set ostt $stt
|
||||
@@ -40,7 +45,7 @@ set stt [expr int($stt / 1800.0) * 1800]
|
||||
set ett $(int($stt + $seconds))
|
||||
set offset $(($ostt - $stt) / 1800.0)
|
||||
|
||||
set chanpx 120
|
||||
set chanpx 160
|
||||
set eventpx 1000
|
||||
set totalpx $($chanpx + $eventpx)
|
||||
set contwidth $($totalpx + 50)
|
||||
@@ -51,28 +56,55 @@ set secpx $($minpx / 60.0)
|
||||
|
||||
set start [clock milliseconds]
|
||||
if {$::qepg} {
|
||||
set records [epg dbfetch dump -trange "$stt:$ett"]
|
||||
if {$favgroup} {
|
||||
set records [epg dbfetch dump \
|
||||
-trange "$stt:$ett" -fav $favgroup]
|
||||
} else {
|
||||
set records [epg dbfetch dump -trange "$stt:$ett"]
|
||||
}
|
||||
|
||||
} else {
|
||||
require channelsort
|
||||
set records [channelsort [epg fetch dump -trange "$stt:$ett"]]
|
||||
}
|
||||
set got [clock milliseconds]
|
||||
|
||||
puts "<div id=buttons style=\"width: $eventpx; margin-left: ${chanpx}px;\">"
|
||||
if {$stt > [clock seconds]} {
|
||||
puts "<button id=earlier><<< Earlier</button>"
|
||||
proc but {label time {active 1}} {
|
||||
puts -nonewline "<button style=\"margin-right: 2em\" tt=$time"
|
||||
if {$active} {
|
||||
puts -nonewline " class=nav"
|
||||
} else {
|
||||
puts -nonewline " disabled class=\"nav ui-state-disabled\""
|
||||
}
|
||||
puts " active=$active>$label</button>"
|
||||
}
|
||||
puts "<button id=later>Later >>></button>"
|
||||
|
||||
puts "<!-- Hours $hours ($seconds) -->"
|
||||
puts "<div id=buttons style=\"width: $eventpx; margin-left: ${chanpx}px;\">"
|
||||
|
||||
but "<< -1 Week" $($stt - 3600 * 24 * 7) \
|
||||
$($stt - $now + 3600 >= 3600 * 24 * 7)
|
||||
but "<< -1 Day" $($stt - 3600 * 24) $($stt - $now >= 3600 * 23)
|
||||
but "<< Earlier", $($stt - 3600 * 4) $($stt > $now)
|
||||
but "< Now >" $now $($current == 0)
|
||||
but ">> Later" $ett;
|
||||
but ">> +1 Day" $($stt + 3600 * 24) $($stt < $now + 8 * 3600 * 24)
|
||||
but ">> +1 Week" $($stt + 3600 * 24 * 7) $($stt < $now + 8 * 3600 * 24)
|
||||
|
||||
puts "</div>"
|
||||
|
||||
puts "
|
||||
<script type=text/javascript>
|
||||
\$('button.nav').button();
|
||||
</script>
|
||||
<div id=xepg style=\"min-width: ${contwidth}px; overflow: auto\">
|
||||
<div id=xepgnow></div>
|
||||
<div id=xegrid>
|
||||
"
|
||||
|
||||
puts "<div id=epgdate style=\"width: ${eventpx}px; margin-left: ${chanpx}px;\">"
|
||||
puts [clock format $stt -format {%a %D}]
|
||||
puts [clock format $stt -format {%a %d/%m/%Y}]
|
||||
puts "<input type=hidden id=xepg_dp stt=$stt>"
|
||||
puts "</div>"
|
||||
|
||||
puts "<div class=xechan style=\"width: ${chanpx}px;\"> </div>"
|
||||
@@ -87,9 +119,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 }
|
||||
|
||||
@@ -98,7 +127,7 @@ foreach e $records {
|
||||
|
||||
puts "[$e channel_icon 30] "
|
||||
puts "$chnum
|
||||
<a href=/cgi-bin/epg_service.jim?service=[$e get service_id]
|
||||
<a href=/cgi-bin/epg/service.jim?service=[$e get service_id]
|
||||
title=\"[$e get channel_name]\">
|
||||
[$e get channel_name]
|
||||
</a></div>"
|
||||
@@ -170,6 +199,9 @@ puts "
|
||||
Switch to standard now/next display.
|
||||
</button></small>
|
||||
</div>
|
||||
"
|
||||
|
||||
puts "
|
||||
|
||||
<script type=text/javascript>
|
||||
\$(document).ready(function() {
|
||||
@@ -177,12 +209,37 @@ puts "
|
||||
\$('#epgswitch').button().click(function() {
|
||||
window.location = '/epg.shtml';
|
||||
});
|
||||
\$('#earlier').button().click(function() {
|
||||
window.location = '/cgi-bin/xepg.jim?stt=$earlier';
|
||||
|
||||
\$('button.nav').click(function() {
|
||||
window.location = '/cgi-bin/xepg.jim?stt=' + \$(this).attr('tt') +
|
||||
'&pos=' + \$('#xegrid').scrollTop();
|
||||
});
|
||||
\$('#later').button().click(function() {
|
||||
window.location = '/cgi-bin/xepg.jim?stt=$ett';
|
||||
|
||||
\$('#xepg_dp').datepicker({
|
||||
buttonImage: '/img/cal.gif',
|
||||
buttonImageOnly: true,
|
||||
showOn: 'button',
|
||||
dateFormat: '@',
|
||||
minDate: '[expr $now * 1000]',
|
||||
maxDate: '[expr ($now + 7 * 86400) * 1000]',
|
||||
onSelect: function(val, sel) {
|
||||
var stt = \$(this).attr('stt');
|
||||
// Extract date part
|
||||
dval = ~~(val / 86400000);
|
||||
// Extract current time part
|
||||
var tm = ~~(stt % 86400);
|
||||
|
||||
var ret = dval * 86400 + tm;
|
||||
|
||||
window.location = '/cgi-bin/xepg.jim?stt=' + ret;
|
||||
}
|
||||
});
|
||||
|
||||
\$('img.ui-datepicker-trigger').hover(
|
||||
function() { \$(this).css('cursor', 'pointer'); },
|
||||
function() { \$(this).css('cursor', 'auto'); }
|
||||
);
|
||||
|
||||
"
|
||||
|
||||
if {$current} {
|
||||
@@ -218,12 +275,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,11 @@
|
||||
.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.compressr A { background-image: url(/img/context/compressr.png); }
|
||||
.contextMenu LI.dedup A { background-image: url(/img/context/dedup.png); }
|
||||
.contextMenu LI.decrypt A { background-image: url(/img/context/decrypt.png); }
|
||||
.contextMenu LI.decryptr A { background-image: url(/img/context/decryptr.png); }
|
||||
.contextMenu LI.mpg A { background-image: url(/img/context/mpg.png); }
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
/* progress bar container */
|
||||
#progressbar{
|
||||
.progressbar, #progressbar{
|
||||
border:1px solid black;
|
||||
width:200px;
|
||||
height:20px;
|
||||
@@ -8,7 +8,7 @@
|
||||
color:black;
|
||||
}
|
||||
/* color bar */
|
||||
#progressbar div.progress{
|
||||
.progressbar div.progress,#progressbar div.progress{
|
||||
position:absolute;
|
||||
width:0;
|
||||
height:100%;
|
||||
@@ -16,13 +16,13 @@
|
||||
background-color:#369;
|
||||
}
|
||||
/* text on bar */
|
||||
#progressbar div.progress .text{
|
||||
.progressbar div.progress .text,#progressbar div.progress .text{
|
||||
position:absolute;
|
||||
text-align:center;
|
||||
color:white;
|
||||
}
|
||||
/* text off bar */
|
||||
#progressbar div.text{
|
||||
.progressbar div.text,#progressbar div.text{
|
||||
position:absolute;
|
||||
width:100%;
|
||||
height:100%;
|
||||
|
||||
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; }
|
||||
@@ -127,7 +127,7 @@ table.keyval td
|
||||
color: black;
|
||||
}
|
||||
|
||||
pre, .pre
|
||||
pre, .pre, .prelike
|
||||
{
|
||||
font-family: Consolas, 'Courier New', Courier, monospace;
|
||||
color: black;
|
||||
@@ -145,7 +145,10 @@ pre, .pre
|
||||
-webkit-border-top-right-radius: 4px;
|
||||
-moz-border-radius-topright: 4px;
|
||||
-khtml-border-top-right-radius: 4px;
|
||||
}
|
||||
|
||||
pre, .pre
|
||||
{
|
||||
white-space: pre-wrap;
|
||||
white-space: -moz-pre-wrap !important;
|
||||
white-space: -pre-wrap;
|
||||
@@ -244,6 +247,12 @@ pre, .pre
|
||||
color: black;
|
||||
}
|
||||
|
||||
.redshade
|
||||
{
|
||||
background: #ff4000;
|
||||
color: white;
|
||||
}
|
||||
|
||||
img.progress
|
||||
{
|
||||
background: transparent url(/img/percentback.png) top left no-repeat;
|
||||
@@ -315,7 +324,7 @@ div.cut
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
font.also
|
||||
.also
|
||||
{
|
||||
font-size: 0.9em;
|
||||
font-style: italic;
|
||||
@@ -323,3 +332,76 @@ font.also
|
||||
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;
|
||||
}
|
||||
|
||||
button.blue
|
||||
{
|
||||
background: url(/img/gloss_wave_blue.png) repeat-x center;
|
||||
border: 1px solid blue;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
button.green
|
||||
{
|
||||
background: url(/img/gloss_wave_green.png) repeat-x center;
|
||||
border: 1px solid green;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
button.red
|
||||
{
|
||||
background: url(/img/gloss_wave_red.png) repeat-x center;
|
||||
border: 1px solid green;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
div#restart_block
|
||||
{
|
||||
z-index: 31;
|
||||
}
|
||||
|
||||
|
||||
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 ""
|
||||
}
|
||||
}
|
||||
|
||||
102
var/mongoose/html/dedup/dedup.jim
Executable file
102
var/mongoose/html/dedup/dedup.jim
Executable file
@@ -0,0 +1,102 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require ts.class pretty_size altrow
|
||||
|
||||
source normalise.jim
|
||||
source process.jim
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
set dir [cgi_get dir "/media/My Video"]
|
||||
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>
|
||||
<tr>
|
||||
<th>File</th>
|
||||
<th>Proposed Filename</th>
|
||||
<th>Proposed Title</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
"
|
||||
|
||||
loadseries $dir
|
||||
foreach file [readdir $dir] {
|
||||
set file "$dir/$file"
|
||||
if {[file extension $file] ne ".hmt"} { continue }
|
||||
|
||||
set base [file tail [file rootname $file]]
|
||||
lassign [dedupprocess $file] stat ts syn fn
|
||||
|
||||
altrow
|
||||
puts "<td nowrap>$base</td>"
|
||||
puts "<td>$fn</td>"
|
||||
puts "<td>$syn</td>"
|
||||
puts "<td>"
|
||||
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 {
|
||||
if {$doit} {
|
||||
# Dooooo, it.
|
||||
$ts settitle $syn
|
||||
ts renamegroup $file $fn
|
||||
puts -nonewline "Done"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
puts "</td>"
|
||||
puts "</tr>"
|
||||
}
|
||||
|
||||
puts {
|
||||
</table>
|
||||
</fieldset>
|
||||
<div style="padding-top: 2em">
|
||||
<small>
|
||||
<button id=browse>Back to media browser</button>
|
||||
}
|
||||
|
||||
if {!$doit} { puts "<button id=dedup>Process folder</button>" }
|
||||
|
||||
puts {
|
||||
</small>
|
||||
</div>
|
||||
}
|
||||
|
||||
footer
|
||||
|
||||
84
var/mongoose/html/dedup/normalise.jim
Executable file
84
var/mongoose/html/dedup/normalise.jim
Executable file
@@ -0,0 +1,84 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
set dedup_prefixes {
|
||||
{^new series\.* *}
|
||||
{^cbeebies\.* *}
|
||||
{^cbbc\.* *}
|
||||
{^t4: *}
|
||||
{^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 {[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"
|
||||
}
|
||||
}
|
||||
|
||||
# if still short, add the reserve string.
|
||||
if {[string length $title] < 6} {
|
||||
if {[string match "${title}*" $reserve]} {
|
||||
set title $reserve
|
||||
} else {
|
||||
append title " $reserve"
|
||||
}
|
||||
}
|
||||
|
||||
# Shorten if too long.
|
||||
if {[string length $title] > 40} {
|
||||
set title [string range $title 0 39]
|
||||
}
|
||||
|
||||
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,38 +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"
|
||||
class=pre 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')));
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--#include virtual="/lib/footer.shtml" -->
|
||||
|
||||
24
var/mongoose/html/diag/clearlog.jim
Executable file
24
var/mongoose/html/diag/clearlog.jim
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
|
||||
set logdirs {/var/log /mod/tmp /mnt/hd3}
|
||||
set logext {.log}
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
set log [cgi_get file 0]
|
||||
|
||||
set ldir [file dirname $log]
|
||||
if {[file dirname $log] in $logdirs && [file extension $log] in $logext} {
|
||||
file copy -force "/dev/null" $log
|
||||
puts "Cleared $log"
|
||||
exit
|
||||
}
|
||||
puts "Cannot clear $log"
|
||||
|
||||
195
var/mongoose/html/diag/diag.jim
Executable file
195
var/mongoose/html/diag/diag.jim
Executable file
@@ -0,0 +1,195 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require pretty_size system.class pkg.class
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
|
||||
pkg loaddiagmeta
|
||||
|
||||
set smv [system modversion 1]
|
||||
|
||||
header
|
||||
|
||||
puts {
|
||||
<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 class=va><span class=cleft>
|
||||
<select name=diagsel id=diagsel class="text ui-widget-content ui-corner-all">
|
||||
<option value=0>-- Select diag or type name in box below --
|
||||
}
|
||||
|
||||
foreach diag [array names ::diagmeta] {
|
||||
puts "<option value=\"$diag\">$diag\n"
|
||||
}
|
||||
|
||||
puts {
|
||||
</select><br>
|
||||
<input name=seq id=seq autocorrect=off autocapitalize=off
|
||||
value="general" size=30 maxlength=50
|
||||
class="text ui-widget-content ui-corner-all">
|
||||
</span>
|
||||
<span class="left va">
|
||||
<button id=rundiag>Run Diagnostic</button>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<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>
|
||||
}
|
||||
if {[system model] eq "HDR"} {
|
||||
puts { <button id=diskdiag style="width: 48%">Hard Disk</button> }
|
||||
}
|
||||
puts {
|
||||
<button id=channelinfo style="width: 48%">Channel Information</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
}
|
||||
|
||||
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 {$smv < 200} {
|
||||
puts -nonewline " disabled class=ui-state-disabled"
|
||||
}
|
||||
|
||||
puts {
|
||||
>
|
||||
Remove all custom firmware packages and settings
|
||||
</button>
|
||||
}
|
||||
|
||||
if {$smv < 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>
|
||||
|
||||
<tr>
|
||||
<td colspan=2>
|
||||
<button id=runrma style="width: 100%"
|
||||
}
|
||||
|
||||
if {$smv < 213} {
|
||||
puts -nonewline " disabled class=ui-state-disabled"
|
||||
}
|
||||
|
||||
puts {
|
||||
>
|
||||
Set Return-to-manufacturer (RMA) Mode
|
||||
</button>
|
||||
}
|
||||
|
||||
if {$smv < 213} {
|
||||
puts {
|
||||
<div class=footnote style="text-align: center">
|
||||
(Install custom firmware v2.13 to enable this option)
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
puts {
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
<span class=also style="padding-left: 5px">
|
||||
View:
|
||||
<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] \
|
||||
[glob -nocomplain /mnt/hd3/*.log] \
|
||||
]] {
|
||||
puts "<a href=# class=log file=\"$file\">
|
||||
<img border=0 height=14 src=/images/421_1_00_CH_Title_2R_Arrow.png>
|
||||
[file tail $file]</a>
|
||||
(<span class=lsize>[pretty_size [file size $file]]</span>)
|
||||
<a class=\"va footnote logclear\" href=# file=\"$file\">
|
||||
<img class=va border=0 src=/img/close.png width=20>Clear</a>
|
||||
<br>"
|
||||
}
|
||||
|
||||
puts {
|
||||
</fieldset>
|
||||
|
||||
<div style="margin-top: 2em; display: none; float: left; clear: left"
|
||||
id=results></div>
|
||||
|
||||
}
|
||||
|
||||
footer
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user