Compare commits
84 Commits
1.0.7@1700
...
1.0.16@202
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3adbeb987a | ||
|
|
23fdc62b81 | ||
|
|
b88691c9e5 | ||
|
|
3c4b907091 | ||
|
|
1c00e63f48 | ||
|
|
59006ff474 | ||
|
|
616c0afff1 | ||
|
|
84899871e1 | ||
|
|
ed042ee230 | ||
|
|
3c44ec33f9 | ||
|
|
02d7bc3f33 | ||
|
|
492b37be41 | ||
|
|
c237f228a8 | ||
|
|
7a523a9ddb | ||
|
|
972366de14 | ||
|
|
aeb96c2c8a | ||
|
|
68f98c8a65 | ||
|
|
61b09db04b | ||
|
|
de2035e1e0 | ||
|
|
b4bd45566e | ||
|
|
692488a11f | ||
|
|
bd27200ba8 | ||
|
|
7e30a4272e | ||
|
|
945007f73d | ||
|
|
fc9c912f99 | ||
|
|
bf67161898 | ||
|
|
f029ab1ce6 | ||
|
|
bfd099a82e | ||
|
|
d9a284994e | ||
|
|
e6df0ae3af | ||
|
|
e14ccce2cc | ||
|
|
60111cd8b1 | ||
|
|
fb81a7e954 | ||
|
|
218221c069 | ||
|
|
a001241c5d | ||
|
|
a8a9f041f0 | ||
|
|
67df756156 | ||
|
|
a73afaf951 | ||
|
|
fe439ec25a | ||
|
|
2fa55d3c90 | ||
|
|
c76e6638a4 | ||
|
|
cd3cbf186c | ||
|
|
38956e2669 | ||
|
|
62a13e18cc | ||
|
|
52d05a7f48 | ||
|
|
612a61a5b1 | ||
|
|
17ba0bb00e | ||
|
|
5f473c9e72 | ||
|
|
e0ac834c78 | ||
|
|
604ac65172 | ||
|
|
dad2a630c7 | ||
|
|
2bf876262f | ||
|
|
972eab191c | ||
|
|
9fd84a8938 | ||
|
|
ceccfd9c1d | ||
|
|
c948926cc2 | ||
|
|
a087581573 | ||
|
|
3416d4e9e2 | ||
|
|
b4af9b62fc | ||
|
|
68fdfcc4d5 | ||
|
|
7c181557a1 | ||
|
|
0f1bbed6b9 | ||
|
|
8c4449ee36 | ||
|
|
23cc31a02a | ||
|
|
98c4182a1f | ||
|
|
1984d7151b | ||
|
|
97289969f1 | ||
|
|
0cfc8f233a | ||
|
|
ea2f231ad8 | ||
|
|
13af77c1e4 | ||
|
|
d08475daaa | ||
|
|
26981ebb2d | ||
|
|
fe7de23c67 | ||
|
|
fbd469ffec | ||
|
|
2c62699f00 | ||
|
|
2a4ec43ef6 | ||
|
|
7080242ff8 | ||
|
|
e2c099668e | ||
|
|
d801e71bf3 | ||
|
|
66a7fcec9c | ||
|
|
8dc232646b | ||
|
|
a505022d39 | ||
|
|
4fc05273e1 | ||
|
|
d81037aa5f |
@@ -1,6 +1,6 @@
|
||||
var/mongoose/html/css/EXTRA.css
|
||||
var/mongoose/html/favicon.ico
|
||||
var/mongoose/html/img/fav/57.png
|
||||
var/mongoose/html/img/fav/72.png
|
||||
var/mongoose/html/img/fav/114.png
|
||||
var/mongoose/html/img/fav/144.png
|
||||
webif/html/css/EXTRA.css
|
||||
webif/html/favicon.ico
|
||||
webif/html/img/fav/57.png
|
||||
webif/html/img/fav/72.png
|
||||
webif/html/img/fav/114.png
|
||||
webif/html/img/fav/144.png
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
Package: webif
|
||||
Priority: optional
|
||||
Section: web
|
||||
Version: 1.0.6-10
|
||||
Version: 1.0.16
|
||||
Architecture: mipsel
|
||||
Maintainer: af123@hummypkg.org.uk
|
||||
Depends: webif-channelicons(>=1.1.4),mongoose(>=3.0-9),jim(>=0.73-1),jim-oo,jim-sqlite3(>=0.73-1),jim-cgi(>=0.7),jim-binary,service-control(>=1.2),busybox(>=1.20.2-1),lsof,epg(>=1.0.13),hmt(>=1.1.14),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2),stripts(>=1.2.3),smartmontools,tmenu(>=1.05),ffmpeg,id3v2,multienv(>=1.6)
|
||||
Depends: webif-channelicons(>=1.1.12-1),lighttpd(>=1.4.35-2),jim(>=0.75-1),jim-oo,jim-sqlite3(>=0.75),jim-cgi(>=0.7),jim-binary(>=0.75),service-control(>=1.2),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.0.13),hmt(>=1.1.21),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2-1),stripts(>=1.2.5-3),smartmontools,tmenu(>=1.08),ffmpeg,id3v2,multienv(>=1.6),mongoose
|
||||
Suggests:
|
||||
Description: An evolving web interface for the Humax.
|
||||
Tags: http://hummy.tv/forum/threads/5031/
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Postinstall $*"
|
||||
# Relocate any stray files in /mod/var/mongoose
|
||||
|
||||
if [ -d /mod/var/mongoose -a ! -h /mod/var/mongoose ]; then
|
||||
(
|
||||
cd /mod/var/mongoose
|
||||
find . | cpio -pmud /mod/webif
|
||||
cd /mod/var
|
||||
rm -rf mongoose
|
||||
ln -s ../webif mongoose
|
||||
)
|
||||
fi
|
||||
|
||||
export tmpf=/tmp/cronf.$$
|
||||
|
||||
@@ -19,7 +29,7 @@ fi
|
||||
ana=$PKG_ROOT/etc/anacrontab
|
||||
egrep -v 'backup/backup.jim|bin/diskattrs' $ana > $tmpf
|
||||
cat $tmpf - << EOM > $ana
|
||||
1 8 sched_backup /mod/webif/cgi-bin/backup/backup.jim
|
||||
1 8 sched_backup /mod/webif/html/backup/backup.jim
|
||||
1 5 diskattrs /mod/webif/lib/bin/diskattrs
|
||||
EOM
|
||||
|
||||
@@ -37,7 +47,7 @@ if [ ! -f /mod/webif/.strip-updated ]; then
|
||||
fi
|
||||
|
||||
/mod/webif/lib/bin/diskattrs
|
||||
/mod/webif/lib/bin/resetnew
|
||||
#/mod/webif/lib/bin/resetnew
|
||||
|
||||
[ -f $tmpf ] && rm -f $tmpf
|
||||
|
||||
|
||||
16
CONTROL/preinst
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Handle moving the legacy /var/mongoose directory to /webif..
|
||||
|
||||
if [ -h /mod/webif -a -d /mod/var/mongoose -a ! -h /mod/var/mongoose ]; then
|
||||
echo "Relocating web interface files..."
|
||||
|
||||
cd /mod
|
||||
rm webif || exit 1
|
||||
mv var/mongoose webif || exit 1
|
||||
cd var
|
||||
ln -s ../webif mongoose
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
1
var/mongoose
Symbolic link
@@ -0,0 +1 @@
|
||||
../webif
|
||||
@@ -1,83 +0,0 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
|
||||
require rsv.class
|
||||
|
||||
set dir /mod/var/backup
|
||||
|
||||
httpheader
|
||||
|
||||
set now [clock seconds]
|
||||
set file [file tail [cgi_get file \
|
||||
[clock format $now -format "auto-%Y-%b-%d-%H:%M"]]]
|
||||
|
||||
if {[string match {auto-*} $file]} {
|
||||
# Delete any automatic backups over 7 days old.
|
||||
set mt $(15 * 86400)
|
||||
foreach af [glob -nocomplain "$dir/auto-*"] {
|
||||
set aft [file mtime $af]
|
||||
set diff $($now - $aft)
|
||||
if {$diff > $mt} {
|
||||
puts "Removing $af"
|
||||
file delete $af
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
set ffile "/$dir/$file.rbk"
|
||||
|
||||
if {[file exists $ffile]} {
|
||||
puts "Backup file <i>$file</i> already exists."
|
||||
exit
|
||||
}
|
||||
|
||||
if {[catch { set fd [open $ffile w] } msg]} {
|
||||
puts "Error creating backup file. - $msg"
|
||||
exit
|
||||
}
|
||||
|
||||
puts "Backing up scheduled recordings and events..."
|
||||
|
||||
set events [rsv list]
|
||||
|
||||
set fields [lsort [[rsv] vars]]
|
||||
|
||||
#puts $fd "# [join $fields "\t"]"
|
||||
|
||||
foreach event $events {
|
||||
puts " Backing up scheduled event '[$event name]'"
|
||||
puts -nonewline $fd "event\t"
|
||||
|
||||
foreach f $fields {
|
||||
if {$f eq "aulEventToRecordInfo"} { continue }
|
||||
puts -nonewline $fd "[$event get $f]\t"
|
||||
}
|
||||
puts $fd ""
|
||||
}
|
||||
puts "Done."
|
||||
|
||||
puts "Backing up channel favourites..."
|
||||
|
||||
set grp 0
|
||||
foreach res [$rsvdb query {
|
||||
select eFavGroup,
|
||||
TBL_FAV.eSvcType,
|
||||
substr(szSvcName, 2) as szSvcName,
|
||||
favIdx
|
||||
from TBL_FAV join TBL_SVC using (hSvc)
|
||||
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)\t$res(favIdx)"
|
||||
}
|
||||
puts "Done."
|
||||
|
||||
close $fd
|
||||
rsv cleanup
|
||||
|
||||
@@ -1,135 +0,0 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
|
||||
require rsv.class findhsvc system.class
|
||||
|
||||
set dir /mod/var/backup
|
||||
|
||||
httpheader
|
||||
|
||||
set file [file tail [cgi_get restore_file]]
|
||||
if {$file == 0} {
|
||||
puts "No filename supplied."
|
||||
exit
|
||||
}
|
||||
|
||||
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 "Restoring scheduled events from <i>$file</i>..."
|
||||
|
||||
$rsvdb query {begin transaction;}
|
||||
$rsvdb query {delete from TBL_RESERVATION;}
|
||||
|
||||
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]
|
||||
}
|
||||
|
||||
# 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
|
||||
# changed during a channel scan.
|
||||
|
||||
puts " Restoring [$rsv name]"
|
||||
|
||||
set bad 0
|
||||
# First, the service number
|
||||
set ohsvc [$rsv get hsvc]
|
||||
if {$ohsvc > 0} {
|
||||
set hsvc [$rsv fix_hsvc]
|
||||
if {$hsvc == 0} {
|
||||
puts " Cannot find channel, restore failed."
|
||||
set bad 1
|
||||
} elseif {$hsvc != $ohsvc} {
|
||||
puts -nonewline " Service number has "
|
||||
puts "changed $ohsvc -> $hsvc, fixing."
|
||||
} else {
|
||||
puts " No change in channel service."
|
||||
}
|
||||
}
|
||||
|
||||
if {!$bad} {
|
||||
if {[catch {$rsv insert pending 1} msg]} {
|
||||
puts " Error inserting event, $msg"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$rsvdb query {commit transaction;}
|
||||
|
||||
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"]
|
||||
if {[lindex $vals 0] ne "fav"} { continue }
|
||||
|
||||
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} {
|
||||
set grp $group
|
||||
puts " Group $grp"
|
||||
}
|
||||
|
||||
puts " $chan"
|
||||
|
||||
if {$hsvc eq ""} {
|
||||
puts " Cannot map channel name to service."
|
||||
continue
|
||||
}
|
||||
|
||||
set query "
|
||||
insert into pending.fav(favIdx, hSvc, eFavGroup, eSvcType)
|
||||
values($idx, $hsvc, $group, $type);
|
||||
"
|
||||
|
||||
$rsvdb query $query
|
||||
}
|
||||
|
||||
$rsvdb query {commit transaction;}
|
||||
|
||||
system restartpending
|
||||
|
||||
close $fd
|
||||
rsv cleanup
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
source /mod/webif/lib/setup
|
||||
httpheader "text/plain"
|
||||
|
||||
foreach f [dict keys $env] {
|
||||
puts "$f = $env($f)"
|
||||
}
|
||||
|
||||
@@ -1,183 +0,0 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require system.class findhsvc epg.class rsv.class
|
||||
|
||||
set runmode cli
|
||||
if {[string match {*jim} $argv0]} { set runmode cgi }
|
||||
|
||||
set schedtime 1200
|
||||
case $runmode {
|
||||
cgi {
|
||||
set type [cgi_get type "full"]
|
||||
httpheader
|
||||
}
|
||||
cli {
|
||||
set type "full"
|
||||
if {"-X" in $argv} { set schedtime 7200 }
|
||||
}
|
||||
}
|
||||
|
||||
if {[catch {set pid [exec pgrep humaxtv]}]} {
|
||||
puts "Cannot find humaxtv process."
|
||||
exit
|
||||
}
|
||||
|
||||
proc get_data {} {
|
||||
global pid
|
||||
|
||||
set ret {}
|
||||
if {[catch {set data \
|
||||
[exec /mod/bin/lsof -p $pid | grep Video | fgrep .ts]} ]} {
|
||||
set ret {}
|
||||
} else {
|
||||
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
|
||||
}
|
||||
|
||||
set play 0
|
||||
set rec 0
|
||||
set seen {}
|
||||
set output {}
|
||||
|
||||
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 {[file exists "/mod/tmp/webif_auto/decrypting.$name.ts"]} {
|
||||
set mode "Decrypting"
|
||||
set icon "178_1_00_Icon_Lock.png style=\"padding: 0 0.2em 0 0.5em\""
|
||||
} elseif {$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]} {
|
||||
if {$runmode eq "cgi"} {
|
||||
puts [join $output "\n<br>\n"]
|
||||
} else {
|
||||
puts [join $output "\n"]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
<!--#include virtual="/lib/header.shtml" -->
|
||||
<!--#exec cmd="/mod/webif/include/backup.jim" -->
|
||||
<!--#include virtual="/lib/footer.shtml" -->
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
|
||||
httpheader
|
||||
|
||||
# dir=%2Fmedia%2FMy+Video%2FWeatherview
|
||||
# aexpiry_days=13
|
||||
|
||||
set dir [cgi_get dir "-"]
|
||||
set days [cgi_get aexpiry_days 7]
|
||||
if {$dir eq "-"} exit
|
||||
|
||||
if {![file isdirectory $dir]} {
|
||||
puts "Not a directory."
|
||||
exit
|
||||
}
|
||||
|
||||
set fd [open "$dir/.autoexpire" w]
|
||||
puts $fd $days
|
||||
$fd close
|
||||
puts "Ok."
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require system.class chunked
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
set diag [cgi_get diag general]
|
||||
|
||||
start_chunked
|
||||
|
||||
if {[system modversion 1] < 113} {
|
||||
chunk ">>> Diagnostics only available with customised firmware 1.13 or above."
|
||||
end_chunked
|
||||
exit
|
||||
}
|
||||
|
||||
chunk ">>> Beginning diagnostic $diag\r\n"
|
||||
|
||||
set bcmd "|/bin/diag $diag"
|
||||
set fd [open $bcmd r]
|
||||
while {[gets $fd line] >= 0} {
|
||||
chunk "$line\r\n"
|
||||
#chunk_pad
|
||||
}
|
||||
close $fd
|
||||
chunk "\r\n"
|
||||
chunk ">>> Ending diagnostic $diag\r\n"
|
||||
|
||||
end_chunked
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
<!--#include virtual="/lib/header.shtml" -->
|
||||
<!--#exec cmd="/mod/webif/include/epg.jim" -->
|
||||
<!--#include virtual="/lib/footer.shtml" -->
|
||||
|
||||
|
Before Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 260 B |
|
Before Width: | Height: | Size: 324 B |
|
Before Width: | Height: | Size: 321 B |
6
var/mongoose/html/js/jquery-1.10.2.min.js
vendored
1
var/mongoose/html/js/jquery.js
vendored
@@ -1 +0,0 @@
|
||||
jquery-1.10.2.min.js
|
||||
@@ -1 +0,0 @@
|
||||
<!--#exec cmd="/mod/webif/html/lib/footer.jim" -->
|
||||
@@ -1 +0,0 @@
|
||||
<!--#exec cmd="/mod/webif/html/lib/header.jim" -->
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* jQuery Plugin : jConfirmAction
|
||||
*
|
||||
* by Hidayat Sagita
|
||||
* http://www.webstuffshare.com
|
||||
* Licensed Under GPL version 2 license.
|
||||
*
|
||||
*/
|
||||
(function($){
|
||||
|
||||
jQuery.fn.jConfirmAction = function (options, callback) {
|
||||
|
||||
// Some jConfirmAction options (limited to customize language) :
|
||||
// question : a text for your question.
|
||||
// yesAnswer : a text for Yes answer.
|
||||
// cancelAnswer : a text for Cancel/No answer.
|
||||
var theOptions = jQuery.extend ({
|
||||
question: "Are You Sure?",
|
||||
yesAnswer: "Yes",
|
||||
cancelAnswer: "Cancel"
|
||||
}, options);
|
||||
|
||||
return this.each (function () {
|
||||
$(this).click(function(e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
var p = $(this);
|
||||
|
||||
if($(this).next('.question').length <= 0)
|
||||
$(this).after('<div class="jcaquestion">'+theOptions.question+'<br/> <span class="jcayes">'+theOptions.yesAnswer+'</span><span class="jcacancel">'+theOptions.cancelAnswer+'</span></div>');
|
||||
|
||||
$(this).next('.jcaquestion').animate({opacity: 1}, 300);
|
||||
|
||||
$('.jcayes').bind('click', function() {
|
||||
callback(p);
|
||||
});
|
||||
|
||||
$('.jcacancel').bind('click', function(){
|
||||
$(this).parents('.jcaquestion').fadeOut(300, function() {
|
||||
$(this).remove();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
})(jQuery);
|
||||
@@ -1,142 +0,0 @@
|
||||
/*!
|
||||
* jQuery contextMenu - Plugin for simple contextMenu handling
|
||||
*
|
||||
* Version: git-master
|
||||
*
|
||||
* Authors: Rodney Rehm, Addy Osmani (patches for FF)
|
||||
* Web: http://medialize.github.com/jQuery-contextMenu/
|
||||
*
|
||||
* Licensed under
|
||||
* MIT License http://www.opensource.org/licenses/mit-license
|
||||
* GPL v3 http://opensource.org/licenses/GPL-3.0
|
||||
*
|
||||
*/
|
||||
|
||||
.context-menu-list {
|
||||
margin:0;
|
||||
padding:0;
|
||||
|
||||
min-width: 120px;
|
||||
max-width: 250px;
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
list-style-type: none;
|
||||
|
||||
border: 1px solid #DDD;
|
||||
background: #EEE;
|
||||
|
||||
-webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
|
||||
-moz-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
|
||||
-ms-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
|
||||
-o-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
|
||||
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.context-menu-item {
|
||||
padding: 2px 2px 2px 24px;
|
||||
background-color: #EEE;
|
||||
position: relative;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: -moz-none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.context-menu-separator {
|
||||
padding-bottom:0;
|
||||
border-bottom: 1px solid #DDD;
|
||||
}
|
||||
|
||||
.context-menu-item > label > input,
|
||||
.context-menu-item > label > textarea {
|
||||
-webkit-user-select: text;
|
||||
-moz-user-select: text;
|
||||
-ms-user-select: text;
|
||||
user-select: text;
|
||||
}
|
||||
|
||||
.context-menu-item.hover {
|
||||
cursor: pointer;
|
||||
background-color: #39F;
|
||||
}
|
||||
|
||||
.context-menu-item.disabled {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.context-menu-input.hover,
|
||||
.context-menu-item.disabled.hover {
|
||||
cursor: default;
|
||||
background-color: #EEE;
|
||||
}
|
||||
|
||||
.context-menu-submenu:after {
|
||||
content: ">";
|
||||
color: #666;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 3px;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
/* icons
|
||||
#protip:
|
||||
In case you want to use sprites for icons (which I would suggest you do) have a look at
|
||||
http://css-tricks.com/13224-pseudo-spriting/ to get an idea of how to implement
|
||||
.context-menu-item.icon:before {}
|
||||
*/
|
||||
.context-menu-item.icon { min-height: 18px; background-repeat: no-repeat; background-position: 4px 2px; }
|
||||
.context-menu-item.icon-edit { background-image: url(images/page_white_edit.png); }
|
||||
.context-menu-item.icon-cut { background-image: url(images/cut.png); }
|
||||
.context-menu-item.icon-copy { background-image: url(images/page_white_copy.png); }
|
||||
.context-menu-item.icon-paste { background-image: url(images/page_white_paste.png); }
|
||||
.context-menu-item.icon-delete { background-image: url(images/page_white_delete.png); }
|
||||
.context-menu-item.icon-add { background-image: url(images/page_white_add.png); }
|
||||
.context-menu-item.icon-quit { background-image: url(images/door.png); }
|
||||
|
||||
/* vertically align inside labels */
|
||||
.context-menu-input > label > * { vertical-align: top; }
|
||||
|
||||
/* position checkboxes and radios as icons */
|
||||
.context-menu-input > label > input[type="checkbox"],
|
||||
.context-menu-input > label > input[type="radio"] {
|
||||
margin-left: -17px;
|
||||
}
|
||||
.context-menu-input > label > span {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.context-menu-input > label,
|
||||
.context-menu-input > label > input[type="text"],
|
||||
.context-menu-input > label > textarea,
|
||||
.context-menu-input > label > select {
|
||||
display: block;
|
||||
width: 100%;
|
||||
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
-ms-box-sizing: border-box;
|
||||
-o-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.context-menu-input > label > textarea {
|
||||
height: 100px;
|
||||
}
|
||||
.context-menu-item > .context-menu-list {
|
||||
display: none;
|
||||
/* re-positioned by js */
|
||||
right: -5px;
|
||||
top: 5px;
|
||||
}
|
||||
|
||||
.context-menu-item.hover > .context-menu-list {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.context-menu-accesskey {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
Before Width: | Height: | Size: 7.6 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
@@ -1,36 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<!-- Need to get a proper redirect hooked up. Blech. -->
|
||||
<meta http-equiv="refresh" content="0;url=demos/">
|
||||
<meta name="robots" content="noindex, follow">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>jQuery Mobile</title>
|
||||
<link rel="stylesheet" href="css/themes/default/jquery.mobile-1.3.2.min.css">
|
||||
<link rel="stylesheet" href="demos/_assets/css/jqm-demos.css">
|
||||
<link rel="shortcut icon" href="demos/_assets/favicon.ico">
|
||||
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,700">
|
||||
<script src="js/jquery.js"></script>
|
||||
<script src="demos/_assets/js/index.js"></script>
|
||||
<script src="js/jquery.mobile-1.3.2.min.js"></script>
|
||||
<script>
|
||||
$( document ).on( "pageshow", function(){
|
||||
$( "p.message" ).hide().delay( 1500 ).show( "fast" );
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div data-role="page" class="jqm-demos">
|
||||
|
||||
<div data-role="content" class="jqm-content">
|
||||
|
||||
<p class="message">Nothing to see here folks. <a href="demos/">View the demo center home page →</a></p>
|
||||
|
||||
</div><!-- /content -->
|
||||
|
||||
</div><!-- /page -->
|
||||
</body>
|
||||
</html>
|
||||
@@ -1 +0,0 @@
|
||||
jquery.mobile-1.3.2.min.css
|
||||
@@ -1 +0,0 @@
|
||||
jquery.mobile-1.3.2.min.js
|
||||
@@ -1,46 +0,0 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
source /mod/webif/lib/setup
|
||||
|
||||
puts {
|
||||
<script type=text/javascript src=/js/packages.js></script>
|
||||
|
||||
<style type=text/css>
|
||||
button.install
|
||||
{
|
||||
display: none;
|
||||
background-image: none;
|
||||
background: #ccff99;
|
||||
}
|
||||
button.remove
|
||||
{
|
||||
display: none;
|
||||
background-image: none;
|
||||
background: #ff6666;
|
||||
}
|
||||
button.upgrade
|
||||
{
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id=pkgtabs>
|
||||
<ul>
|
||||
<li>
|
||||
<a href=/cgi-bin/pkg.jim?type=inst>
|
||||
<span>Installed</span>
|
||||
</a>
|
||||
</li><li>
|
||||
<a href=/cgi-bin/pkg.jim?type=upgr>
|
||||
<span>Upgrades</span>
|
||||
</a>
|
||||
</li><li>
|
||||
<a href=/cgi-bin/pkg.jim?type=avail>
|
||||
<span>Available</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
set services [split [exec /mod/bin/service mlist]]
|
||||
|
||||
foreach service $services {
|
||||
lassign [split $service ":"] name installed auto running
|
||||
|
||||
puts "<tr><td class=even>$name</td>"
|
||||
if (!$installed) {
|
||||
puts "<td colspan=3><i>Not installed</i></td></tr>"
|
||||
continue
|
||||
}
|
||||
|
||||
puts -nonewline "<td><input type=checkbox class=auto name=\"$name\""
|
||||
if ($auto) { puts -nonewline " checked" }
|
||||
puts "></td>"
|
||||
|
||||
puts -nonewline "<td><input type=checkbox class=toggle name=\"$name\""
|
||||
if ($running) { puts -nonewline " checked" }
|
||||
puts "></td>"
|
||||
|
||||
puts "</tr>"
|
||||
}
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
source /mod/webif/lib/setup
|
||||
require system.class ts.class
|
||||
|
||||
proc do_shrink {ts} {
|
||||
if {[$ts flag "Shrunk"]} { return }
|
||||
|
||||
set file [file rootname [$ts get file]]
|
||||
|
||||
if {[$ts inuse]} { return }
|
||||
|
||||
if {[catch {
|
||||
set perc [exec /mod/bin/stripts -aq $file]
|
||||
} msg]} {
|
||||
return
|
||||
}
|
||||
|
||||
if {[string match {*%} $perc]} {
|
||||
set perc [string range $perc 0 end-1]
|
||||
} else {
|
||||
set perc 0
|
||||
}
|
||||
|
||||
if {$perc == 0} {
|
||||
puts " Flagging $file as shrunk..."
|
||||
$ts set_shrunk
|
||||
}
|
||||
}
|
||||
|
||||
proc entries {dir callback} {
|
||||
foreach entry [readdir -nocomplain $dir] {
|
||||
if {![string match {*.ts} $entry} continue
|
||||
if {[catch {set ts [ts fetch "$dir/$entry"]}]} continue
|
||||
if {$ts == 0} continue
|
||||
$callback $ts
|
||||
}
|
||||
}
|
||||
|
||||
proc scan {dir} {
|
||||
puts "Scanning $dir..."
|
||||
file stat "$dir/" st
|
||||
if {$st(dev) != $::rootdev} { return }
|
||||
|
||||
entries $dir do_shrink
|
||||
|
||||
foreach entry [readdir -nocomplain $dir] {
|
||||
if {[file isdirectory "$dir/$entry"]} {
|
||||
scan "$dir/$entry"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
set root [system mediaroot]
|
||||
file stat "$root/" rootstat
|
||||
set rootdev $rootstat(dev)
|
||||
|
||||
scan $root
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
package require binary
|
||||
|
||||
proc hexdump {str} {
|
||||
set s ""
|
||||
set addr 0
|
||||
|
||||
append s "[format "%07x" $addr]: "
|
||||
set t ""
|
||||
for {set i 0} {$i < [string length $str]} {incr i} {
|
||||
if {$i > 0 && [expr $i % 16] == 0} {
|
||||
append s " $t\n"
|
||||
append s "[format "%07x" $addr]: "
|
||||
incr addr 16
|
||||
set t ""
|
||||
} elseif {$i > 0 && [expr $i % 2] == 0} {
|
||||
append s " "
|
||||
}
|
||||
|
||||
set char [string index $str $i]
|
||||
binary scan $char H2 cc
|
||||
append s $cc
|
||||
if {[string is print $char]} {
|
||||
append t $char
|
||||
} else {
|
||||
append t "."
|
||||
}
|
||||
}
|
||||
puts $s
|
||||
}
|
||||
|
||||
@@ -1,277 +0,0 @@
|
||||
|
||||
if {![exists -proc class]} { package require oo }
|
||||
if {![exists -proc sqlite3.open]} { package require sqlite3 }
|
||||
|
||||
class system {}
|
||||
|
||||
proc {system model} {} {
|
||||
if {[catch {set fp [open /etc/model r]}]} {
|
||||
set model {HD[R]}
|
||||
} else {
|
||||
set model [string trim [read $fp]]
|
||||
close $fp
|
||||
}
|
||||
return $model
|
||||
}
|
||||
|
||||
proc {system hostname} {} {
|
||||
if {[catch {set hostname [string trim [exec hostname]]}]} {
|
||||
set hostname "humax"
|
||||
}
|
||||
return $hostname
|
||||
}
|
||||
|
||||
proc {system ip} {} {
|
||||
if {[catch {set fp [open /etc/hosts r]}]} {
|
||||
set ip "127.0.0.1"
|
||||
} else {
|
||||
set ipl [lindex [split [$fp read] "\n"] 1]
|
||||
regsub -- {[[:space:]].*} $ipl "" ip
|
||||
}
|
||||
return $ip
|
||||
}
|
||||
|
||||
proc {system modversion} {{short 0}} {
|
||||
if {[catch {set fp [open /etc/modversion r]}]} {
|
||||
set modver "102"
|
||||
} else {
|
||||
set modver [string trim [read $fp]]
|
||||
close $fp
|
||||
}
|
||||
if {$short} { return $modver }
|
||||
lassign [split $modver ""] a b c
|
||||
return [format "%d.%d%d" $a $b $c]
|
||||
}
|
||||
|
||||
proc {system modbuild} {} {
|
||||
if {[catch {set fp [open /etc/modbuild r]}]} {
|
||||
return 0
|
||||
} else {
|
||||
set modbuild [string trim [read $fp]]
|
||||
close $fp
|
||||
}
|
||||
return $modbuild
|
||||
}
|
||||
|
||||
proc {system fhtcpversion} {} {
|
||||
set file "/etc/fhtcpversion"
|
||||
if {![file exists $file]} { set file "/root/fhtcpversion" }
|
||||
if {[catch {set fp [open $file r]}]} {
|
||||
set ver "?.??.??"
|
||||
} else {
|
||||
set ver [string trim [read $fp]]
|
||||
close $fp
|
||||
}
|
||||
return $ver
|
||||
}
|
||||
|
||||
proc {system pkgver} {{pkg webif}} {
|
||||
return [lrange [split [exec opkg list-installed $pkg] " "] 2 end]
|
||||
}
|
||||
|
||||
proc {system pkginst} {pkg} {{cache {}} {ncache {}}} {
|
||||
if {$pkg in $cache} { return 1 }
|
||||
if {$pkg in $ncache} { return 0 }
|
||||
|
||||
# It may not be possible to get an opkg lock immediately so
|
||||
# try several times and throw an error if not.
|
||||
set status unknown
|
||||
loop i 0 5 {
|
||||
if {[catch {set status [exec opkg list-installed $pkg]}]} {
|
||||
sleep 1
|
||||
} else break
|
||||
}
|
||||
if {$status eq "unknown"} {
|
||||
error "Could not get opkg lock after 5 seconds."
|
||||
}
|
||||
|
||||
if {$status ne ""} {
|
||||
lappend $cache $pkg
|
||||
return 1
|
||||
}
|
||||
lappend $ncache $pkg
|
||||
return 0
|
||||
}
|
||||
|
||||
proc {system mediaroot} {} {
|
||||
switch [system model] {
|
||||
HDR { return "/media/My Video" }
|
||||
HD { return "/media/drive1/Video" }
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
proc {system dustbin} {{short 0}} {
|
||||
set dustbin "\[Deleted Items\]"
|
||||
if {![catch {set fd [open "/mod/boot/dustbin.name" r]}]} {
|
||||
set dustbin [lindex [split [read $fd] "\n"] 0]
|
||||
$fd close
|
||||
}
|
||||
if {$short} { return $dustbin }
|
||||
return "[system mediaroot]/$dustbin"
|
||||
}
|
||||
|
||||
proc {system diskspace} {} {
|
||||
switch [system model] {
|
||||
HDR { set part /mnt/hd2 }
|
||||
HD { set part /media/drive1 }
|
||||
}
|
||||
|
||||
set size 0
|
||||
set used 0
|
||||
set free 0
|
||||
set perc 0
|
||||
set dev 0
|
||||
foreach line [split [exec /mod/bin/busybox/df -h $part 2>>/dev/null] "\n\r"] {
|
||||
if {[string match "/*" $line]} {
|
||||
regsub -all -- {[[:space:]]+} $line " " line
|
||||
set fields [split $line]
|
||||
set dev [lindex $fields 0]
|
||||
set size [lindex $fields 1]
|
||||
set used [lindex $fields 2]
|
||||
set free [lindex $fields 3]
|
||||
set perc [string trimright [lindex $fields 4] "%"]
|
||||
set fperc $(100 - $perc)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return [list $size $used $perc $free $fperc $dev]
|
||||
}
|
||||
|
||||
proc {system disk} {} {
|
||||
return [string range [lindex [system diskspace] 5] 0 end-1]
|
||||
}
|
||||
|
||||
proc {system diskfree} {} {
|
||||
switch [system model] {
|
||||
HDR { set part /mnt/hd2 }
|
||||
HD { set part /media/drive1 }
|
||||
}
|
||||
|
||||
set free 0
|
||||
foreach line [split [exec /mod/bin/busybox/df -k $part 2>>/dev/null] "\n\r"] {
|
||||
if {[string match "/*" $line]} {
|
||||
regsub -all -- {[[:space:]]+} $line " " line
|
||||
set fields [split $line]
|
||||
set free [lindex $fields 3]
|
||||
set free $($free * 1024)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return $free
|
||||
}
|
||||
|
||||
proc {system busy} {} {
|
||||
# Is humaxtv doing anything important?
|
||||
if {[catch {set pid [exec /mod/bin/busybox/pgrep humaxtv]}]} {
|
||||
return 0
|
||||
}
|
||||
set c 0
|
||||
foreach line [split [exec /mod/bin/lsof -p $pid] "\n"] {
|
||||
if {[string match {*Video*.ts} $line]} { incr c }
|
||||
}
|
||||
if {$c > 0} { return 1 }
|
||||
return 0
|
||||
}
|
||||
|
||||
proc {system inuse} {file} {
|
||||
# Is anything using the file?
|
||||
set file [file rootname [file tail $file]]
|
||||
set c 0
|
||||
foreach line [split [exec /mod/bin/lsof] "\n"] {
|
||||
if {[string first $file $line] >= 0} { incr c }
|
||||
}
|
||||
if {$c > 0} { return 1 }
|
||||
return 0
|
||||
}
|
||||
|
||||
proc {system reboot} {} {
|
||||
exec /etc/init.d/S90settop shut
|
||||
exec /sbin/reboot
|
||||
}
|
||||
|
||||
proc {system restartpending} {} {
|
||||
close [open /tmp/.restartpending w]
|
||||
}
|
||||
|
||||
proc {system param} {param {type Value} {tbl MENUCONFIG}} {
|
||||
if {[catch {set db [sqlite3.open /var/lib/humaxtv/setup.db]} msg]} {
|
||||
return 0
|
||||
}
|
||||
set val 0
|
||||
set ret [$db query "
|
||||
select item$type
|
||||
from TBL_$tbl
|
||||
where itemName = '$param'
|
||||
"]
|
||||
if {[llength $ret] == 1} {
|
||||
lassign [lindex $ret 0] x val
|
||||
}
|
||||
$db close
|
||||
return $val
|
||||
}
|
||||
|
||||
proc {system padding} {} {
|
||||
return [list \
|
||||
[system param START_PADDING_TIME] \
|
||||
[system param STOP_PADDING_TIME] \
|
||||
]
|
||||
}
|
||||
|
||||
proc {system instandby} {} {
|
||||
return [system param LAST_STANDBY Value USERCONFIG]
|
||||
}
|
||||
|
||||
proc {system mkdir_p} {dir} {
|
||||
exec /mod/bin/busybox/mkdir -p $dir
|
||||
}
|
||||
|
||||
proc {system rmdir_if_empty} {dir {why 0}} {
|
||||
set fl {}
|
||||
foreach e [readdir -nocomplain $dir] {
|
||||
if {$e eq "." || $e eq ".."} continue
|
||||
if {[file isdirectory "$dir/$e"]} {
|
||||
if {!$why} { return 0 }
|
||||
lappend fl $e
|
||||
} elseif {[string index $e 0] ne "."} {
|
||||
if {!$why} { return 0 }
|
||||
lappend fl $e
|
||||
}
|
||||
}
|
||||
if {!$why} {
|
||||
file delete -force $dir
|
||||
return 1
|
||||
}
|
||||
return $fl
|
||||
}
|
||||
|
||||
proc {system listening} {{mport 0}} {
|
||||
set ret {}
|
||||
foreach line [split [exec /mod/bin/busybox/netstat -lntpw] "\n"] {
|
||||
# Remove repeated spaces
|
||||
regsub -all -- {[[:space:]]+} $line " " line
|
||||
# tcp 0 0 0.0.0.0:9955 0.0.0.0:* LISTEN 169/humaxtv
|
||||
lassign [split $line " "] x x x port x type app
|
||||
if {$type ne "LISTEN"} { continue }
|
||||
lassign [split $port ":"] x port
|
||||
|
||||
if {$mport && $mport != $port} { continue }
|
||||
lappend ret [list $port [split $app "/"]]
|
||||
}
|
||||
return $ret
|
||||
}
|
||||
|
||||
proc {system is_listening} {mport} {
|
||||
return [llength [system listening $mport]]
|
||||
}
|
||||
|
||||
proc {system notify} {msg} {
|
||||
set logfd [open "/mod/tmp/notify.log" "a+"]
|
||||
puts $logfd "[\
|
||||
clock format [clock seconds] -format "%d/%m/%Y %H:%M"\
|
||||
] - $msg"
|
||||
$logfd close
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
|
||||
if {![exists -proc tdelete]} {
|
||||
proc tdelete {path} {
|
||||
if {[file isdirectory $path]} {
|
||||
regsub -all {([\\["$])} $path {\\\1} cpath
|
||||
foreach file [glob -nocomplain "${cpath}/*"] {
|
||||
if {[file isdirectory $file]} {
|
||||
tdelete $file
|
||||
} else {
|
||||
exec /mod/bin/trm $file
|
||||
}
|
||||
}
|
||||
exec /mod/bin/busybox/rm -rf $path
|
||||
} else {
|
||||
exec /mod/bin/trm $path
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require system.class chunked pretty_size
|
||||
require system.class pretty_size
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
@@ -10,16 +10,14 @@ cgi_input
|
||||
set file [cgi_get file "-"]
|
||||
if {$file eq "-"} { exit }
|
||||
|
||||
start_chunked
|
||||
httpheader "text/plain"
|
||||
|
||||
if {![file exists $file]} {
|
||||
chunk ">>> File $file does not exist.\r\n"
|
||||
puts ">>> File $file does not exist.\r\n"
|
||||
} else {
|
||||
chunk ">>> Contents of $file [pretty_size [file size $file]]\r\n"
|
||||
puts ">>> Contents of $file [pretty_size [file size $file]]\r\n"
|
||||
set fp [open $file r]
|
||||
chunk [read $fp]
|
||||
puts [read $fp]
|
||||
close $fp
|
||||
}
|
||||
|
||||
end_chunked
|
||||
|
||||
@@ -29,20 +29,23 @@ puts "
|
||||
<th>Signal Quality</th>
|
||||
<th>Network</th>
|
||||
<th>Mux</th>
|
||||
<th>Type</th>
|
||||
<th>Channels</th>
|
||||
<th>>799</th>
|
||||
</tr>
|
||||
"
|
||||
foreach tw [$db query {
|
||||
select tsIdx, szNetName, usTsID, ulFrequency, ucLevel, ucQuality
|
||||
select tsIdx, szNetName, usTsID, ulFrequency, ucLevel,
|
||||
ucQuality, eTransMode
|
||||
from TBL_TS join TBL_NET using (netIdx)
|
||||
order by ulFrequency
|
||||
}] {
|
||||
lassign $tw \
|
||||
x tsIdx x netName x usTsID x ulFrequency x ucLevel x ucQuality
|
||||
x tsIdx x netName x usTsID x ulFrequency x ucLevel x ucQuality \
|
||||
x eTransMode
|
||||
|
||||
altrow
|
||||
puts "
|
||||
<tr class=odd>
|
||||
<td>[f2c $ulFrequency]</td>
|
||||
<td>[expr $ulFrequency / 1000.0] MHz</td>
|
||||
"
|
||||
@@ -64,17 +67,23 @@ foreach tw [$db query {
|
||||
set name [string range $name 1 end]
|
||||
if {$lcn >= 800} { incr ehs }
|
||||
switch $name {
|
||||
"BBC ONE" { set mux "PSB1/BBC A" }
|
||||
"BBC THREE" { 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)" }
|
||||
"BBC ONE HD" { set mux "PSB3/BBC B" }
|
||||
"ITV3" { set mux "COM4/SDN" }
|
||||
"Dave" { set mux "COM5/ARQ A" }
|
||||
"Film4" { set mux "COM6/ARQ B" }
|
||||
"Film4+1" { set mux "COM6/ARQ B" }
|
||||
"BBC NEWS HD" { set mux "COM7/ARQ C" }
|
||||
"Movies4Men" { set mux "Local" }
|
||||
}
|
||||
}
|
||||
puts "<td>$mux</td>"
|
||||
if {$eTransMode == 2} {
|
||||
puts "<td>DVB-T (SD)</td>"
|
||||
} else {
|
||||
puts "<td class=blood>DVB-T2 (HD)</td>"
|
||||
}
|
||||
|
||||
puts "<td>[llength $channels]
|
||||
<a class=mchan ts=$tsIdx href=#>
|
||||
@@ -82,30 +91,29 @@ foreach tw [$db query {
|
||||
src=/images/421_1_00_CH_Title_2R_Arrow.png>
|
||||
view
|
||||
</a></td>"
|
||||
puts "<td>$ehs</th>"
|
||||
puts "<td>$ehs</td>"
|
||||
puts "</tr>"
|
||||
puts "<tr id=mchan_$tsIdx class=mchan style=\"display: none\">
|
||||
<td colspan=5>"
|
||||
<td colspan=9>"
|
||||
puts "<table style=\"margin-left: 5em\">"
|
||||
puts "<tr>
|
||||
<th colspan=3>Channel</th>
|
||||
<th>Provider</th>
|
||||
<th>Authority</th>
|
||||
</tr>"
|
||||
altrow reset
|
||||
foreach chan $channels {
|
||||
lassign $chan x lcn x name x prv x auth
|
||||
set name [string range $name 1 end]
|
||||
set prv [string range $prv 3 end]
|
||||
altrow
|
||||
puts "<td class=va>"
|
||||
puts "[epg channelicon $name 50]</td>
|
||||
<td>$lcn</td><td>$name</td>"
|
||||
puts "</td><td>"
|
||||
puts $prv
|
||||
puts "</td><td>"
|
||||
puts $auth
|
||||
puts "</td>"
|
||||
puts "</tr>"
|
||||
puts "
|
||||
<td class=va>[epg channelicon $name 50]</td>
|
||||
<td>$lcn</td><td>$name</td>
|
||||
<td>$prv</td>
|
||||
<td>$auth</td>
|
||||
</tr>
|
||||
"
|
||||
}
|
||||
puts "</table>"
|
||||
puts "</td></tr>"
|
||||
@@ -132,3 +140,5 @@ $(document).ready(function() {
|
||||
</script>
|
||||
}
|
||||
|
||||
footer
|
||||
|
||||
@@ -63,7 +63,7 @@ proc db_info {db_file} {
|
||||
if {$fdb == 0} {
|
||||
puts "Please choose database to view:<ul>"
|
||||
foreach db $databases {
|
||||
puts "<li><a href=$::env(REQUEST_URI)?db=[file tail $db]>
|
||||
puts "<li><a href=$::env(SCRIPT_NAME)?db=[file tail $db]>
|
||||
$db</a></li>"
|
||||
}
|
||||
puts "</ul>"
|
||||
9
webif/cgi-bin/env.jim
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
source /mod/webif/lib/setup
|
||||
httpheader
|
||||
|
||||
puts "<pre>"
|
||||
parray env
|
||||
puts "</pre>"
|
||||
|
||||
@@ -13,7 +13,7 @@ set raw [cgi_get raw]
|
||||
puts "<pre>"
|
||||
if { $raw == 0 } {
|
||||
puts [epg exec dump -raw 1 -service $service -event $event]
|
||||
puts "<a href=$env(REQUEST_URI)?$env(QUERY_STRING)&raw=1>
|
||||
puts "<a href=$env(SCRIPT_NAME)?$env(QUERY_STRING)&raw=1>
|
||||
Click here for extended dump</a>"
|
||||
} else {
|
||||
puts [epg exec dumpraw -raw 1 -service $service -event $event]
|
||||
@@ -10,7 +10,7 @@ httpheader
|
||||
|
||||
set service [cgi_get service 0]
|
||||
set event [cgi_get event 0]
|
||||
if {![cgi_exists bare]} header
|
||||
if {![cgi_exists bare]} header else noheader
|
||||
|
||||
set record [lindex [epg fetch dump -service $service -event $event] 0]
|
||||
$record get_channel_info
|
||||
@@ -4,12 +4,11 @@ package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require epg.class spinner.class altrow settings.class
|
||||
|
||||
jqplugin highlight
|
||||
header
|
||||
|
||||
require totop
|
||||
|
||||
puts "<script type=text/javascript src=/js/jquery.highlight.js></script>"
|
||||
|
||||
set ct [cgi_get ct 0]
|
||||
set crid [cgi_get crid ""]
|
||||
set scrid [cgi_get scrid ""]
|
||||
@@ -56,6 +55,12 @@ if {$ct > 0 } {
|
||||
}
|
||||
|
||||
set favlist [epg favlist]
|
||||
set s [settings]
|
||||
if {[$s service_style] eq "standard"} {
|
||||
set surl xservice
|
||||
} else {
|
||||
set surl service
|
||||
}
|
||||
|
||||
if {[llength $records] > 0} {
|
||||
puts {
|
||||
@@ -83,8 +88,10 @@ proc rsort {v1 v2} {
|
||||
set seen {}
|
||||
set i 0
|
||||
foreach record [lsort -command rsort $records] {
|
||||
set ename [$record get name]
|
||||
if {$ename eq ""} continue
|
||||
|
||||
if {$dedup} {
|
||||
set ename [$record get name]
|
||||
if {$ename in $seen} continue
|
||||
lappend seen $ename
|
||||
}
|
||||
@@ -105,7 +112,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=/epg/$surl.jim?service=[$record get service_id]>
|
||||
[$record get channel_name]
|
||||
</a></td>"
|
||||
puts [$record cell]
|
||||
15
webif/cgi-bin/hximages.jim
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
source /mod/webif/lib/setup
|
||||
|
||||
header
|
||||
|
||||
puts "<ul>"
|
||||
|
||||
foreach f [readdir "/opt/share/images/blue"] {
|
||||
if {![string match {*.png} $f]} continue
|
||||
puts "<li><img src=\"/images/$f\">$f</li>"
|
||||
}
|
||||
|
||||
puts "</ul>"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require pkg.class chunked
|
||||
require pkg.class
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
@@ -10,30 +10,28 @@ cgi_input
|
||||
set cmd [cgi_get cmd update]
|
||||
|
||||
proc opkg {cmd} {
|
||||
chunk ">>> opkg $cmd\r\n"
|
||||
puts ">>> opkg $cmd"
|
||||
set bcmd "|/mod/webif/lib/bin/opkg $cmd"
|
||||
set fd [open $bcmd r]
|
||||
while {[gets $fd line] >= 0} {
|
||||
chunk "$line\r\n"
|
||||
#chunk_pad
|
||||
puts "$line"
|
||||
}
|
||||
close $fd
|
||||
chunk "\r\n"
|
||||
puts ""
|
||||
}
|
||||
|
||||
start_chunked
|
||||
httpheader "text/plain"
|
||||
|
||||
if {$cmd eq "upgrade"} { opkg update }
|
||||
opkg $cmd
|
||||
|
||||
if {$cmd eq "update" || $cmd eq "upgrade"} {
|
||||
chunk "Updating package meta information\r\n"
|
||||
puts "Updating package meta information"
|
||||
pkg fetchmeta
|
||||
chunk "Done.\r\n"
|
||||
chunk "Updating diagnostic meta information\r\n"
|
||||
puts "Done."
|
||||
puts ""
|
||||
puts "Updating diagnostic meta information"
|
||||
pkg fetchdiagmeta
|
||||
chunk "Done.\r\n"
|
||||
puts "Done."
|
||||
}
|
||||
|
||||
end_chunked
|
||||
|
||||
@@ -7,7 +7,7 @@ require rsv.class system.class
|
||||
httpheader
|
||||
|
||||
if {[cgi_get act] eq "cancel"} {
|
||||
file delete /tmp/.restartpending
|
||||
system restartpending 0
|
||||
exit
|
||||
}
|
||||
|
||||
@@ -18,7 +18,8 @@ if {[cgi_get now] eq "yes"} {
|
||||
exit
|
||||
}
|
||||
|
||||
file delete /tmp/.restartpending
|
||||
system restartpending 0
|
||||
jqplugin progressbar
|
||||
header
|
||||
|
||||
# Commit pending reservations on older mod versions.
|
||||
@@ -27,8 +28,6 @@ if {![file exists /sbin/rsvsync] && ![file exists /mod/boot/rsvsync]} {
|
||||
}
|
||||
|
||||
puts {
|
||||
<link href=/css/jquery.progressbar.css rel=stylesheet type=text/css />
|
||||
<script type="text/javascript" src="/js/jquery.progressbar.js"></script>
|
||||
|
||||
<script type=text/javascript>
|
||||
var handle = 0;
|
||||
@@ -46,7 +45,7 @@ puts {
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#progressbar').reportprogress(0);
|
||||
handle = setInterval("update()", 350);
|
||||
handle = setInterval("update()", 400);
|
||||
$.get('/cgi-bin/restart.jim?now=yes');
|
||||
});
|
||||
</script>
|
||||
306
webif/cgi-bin/status.jim
Executable file
@@ -0,0 +1,306 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require system.class findhsvc epg.class rsv.class
|
||||
|
||||
set runmode cli
|
||||
if {[string match {*jim} $argv0]} { set runmode cgi }
|
||||
|
||||
set schedtime 1200
|
||||
switch $runmode {
|
||||
cgi {
|
||||
set type [cgi_get type "full"]
|
||||
httpheader
|
||||
}
|
||||
cli {
|
||||
set type "full"
|
||||
if {"-X" in $argv} { set schedtime 7200 }
|
||||
}
|
||||
}
|
||||
|
||||
if {"-d" in $argv} {
|
||||
proc debug {arg} { puts $arg }
|
||||
} else {
|
||||
proc debug {arg} {}
|
||||
}
|
||||
|
||||
if {[catch {set pid [exec pgrep -n humaxtv]}]} {
|
||||
puts "Cannot find humaxtv process."
|
||||
exit
|
||||
}
|
||||
|
||||
set exts {.ts .mkv .avi .mpg .mpeg .wmv .mp3 .mp4 .mov}
|
||||
|
||||
proc get_data {} {
|
||||
global pid exts opfile
|
||||
|
||||
set ret {}
|
||||
if {[catch {set data \
|
||||
[exec /mod/webif/lib/bin/lsof -X -Fns -p $pid]} msg]} {
|
||||
set ret {}
|
||||
} else {
|
||||
set size 0
|
||||
foreach line [split $data "\n"] {
|
||||
set typ [string index $line 0]
|
||||
switch $typ {
|
||||
s {
|
||||
set size [string range $line 1 end]
|
||||
}
|
||||
n {
|
||||
if {[string first Video/ $line] == -1 && \
|
||||
[string first /media/ $line] == -1} {
|
||||
continue
|
||||
}
|
||||
regsub -- { \([^\)]+\)$} $line "" line
|
||||
set ext [file extension $line]
|
||||
if {$ext ni $exts} continue
|
||||
set file [string range $line 1 end]
|
||||
# Handle chase play (same file open twice
|
||||
# and recently written)
|
||||
if {[dict exists $ret $file] && \
|
||||
$ext eq ".ts"} {
|
||||
set age [expr [clock seconds] - \
|
||||
[file mtime $file]]
|
||||
if {$age < 60} {
|
||||
set ret($file) -1
|
||||
}
|
||||
} else {
|
||||
set ret($file) $size
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if {$opfile ne "" && $opfile ni $ret} {
|
||||
set ret($opfile) [file size $opfile]
|
||||
}
|
||||
}
|
||||
return $ret
|
||||
}
|
||||
|
||||
set play 0
|
||||
set rec 0
|
||||
set output {}
|
||||
|
||||
set opfile ""
|
||||
if {[file exists "/mod/tmp/webif_auto/.op"} {
|
||||
set fp [open "/mod/tmp/webif_auto/.op"]
|
||||
lassign [split [string trim [$fp read]] ":"] op opfile
|
||||
$fp close
|
||||
debug "OP: $op - $opfile"
|
||||
}
|
||||
|
||||
set data {}
|
||||
if {$type eq "full"} {
|
||||
set data [get_data]
|
||||
}
|
||||
if {[llength $data]} {
|
||||
debug " DATA: ($data)"
|
||||
if {![file exists /tmp/.rractive]} {
|
||||
sleep 3
|
||||
set ndata [get_data]
|
||||
debug " NDATA: ($ndata)"
|
||||
set rr 0
|
||||
} else {
|
||||
sleep 1
|
||||
set ndata [get_data]
|
||||
debug " NDATA: ($ndata)"
|
||||
foreach k [array names data] {
|
||||
if {![dict exists $ndata $k]} {
|
||||
dict unset data $k
|
||||
}
|
||||
}
|
||||
|
||||
set rr 1
|
||||
set recs {}
|
||||
loop i 0 2 {
|
||||
catch {
|
||||
set fd [open "/tmp/.rec$i" r]
|
||||
lappend recs "[$fd read -nonewline].ts"
|
||||
$fd close
|
||||
}
|
||||
}
|
||||
debug " RECS: $recs"
|
||||
}
|
||||
foreach file [array names data] {
|
||||
set bname [file rootname [file tail $file]]
|
||||
|
||||
if {$file eq $opfile} {
|
||||
set mode $op
|
||||
} elseif {$data($file) == -1} {
|
||||
set mode chase
|
||||
} elseif {$rr} {
|
||||
if {$file in $recs} {
|
||||
set mode rec
|
||||
} else {
|
||||
set mode play
|
||||
}
|
||||
} else {
|
||||
if {![dict exists $ndata $file]} continue
|
||||
if {$ndata($file) > $data($file)} {
|
||||
set mode rec
|
||||
} else {
|
||||
set mode play
|
||||
}
|
||||
}
|
||||
|
||||
switch $mode {
|
||||
chase {
|
||||
incr rec
|
||||
incr play
|
||||
set mode "Chase Playing"
|
||||
set icon "745_1_11_Video_3REC_Live.png"
|
||||
}
|
||||
rec {
|
||||
incr rec
|
||||
set mode "Recording"
|
||||
set icon "745_1_11_Video_1REC.png"
|
||||
}
|
||||
play {
|
||||
incr play
|
||||
set mode "Playing"
|
||||
set icon "745_1_10_Video_2Live.png"
|
||||
}
|
||||
dec {
|
||||
set mode "Decrypting"
|
||||
set icon "/img/decrypt.png "
|
||||
append icon "style=\"padding: 0 0.2em 0 0.5em\""
|
||||
}
|
||||
mpg {
|
||||
set mode "Extracting MPG"
|
||||
set icon "/img/mpg.png "
|
||||
append icon "style=\"padding: 0 0.2em 0 0.5em\""
|
||||
}
|
||||
mp3 {
|
||||
set mode "Extracting MP3"
|
||||
set icon "/img/mp3.png "
|
||||
append icon "style=\"padding: 0 0.2em 0 0.5em\""
|
||||
}
|
||||
shrink {
|
||||
set mode "Shrinking"
|
||||
set icon "/img/compress.png "
|
||||
append icon "style=\"padding: 0 0.2em 0 0.5em\""
|
||||
}
|
||||
}
|
||||
|
||||
if {[string first "/" $icon] == -1} {
|
||||
set icon "/images/$icon"
|
||||
}
|
||||
|
||||
set name [string map {
|
||||
"/mnt/hd2/My Video/" ""
|
||||
"/media/drive1/Video/" ""
|
||||
"/media/" ""
|
||||
".ts" ""
|
||||
} $file]
|
||||
|
||||
if {$runmode eq "cgi"} {
|
||||
lappend output [concat \
|
||||
"<span class=\"va stitem\">\n" \
|
||||
" <img class=va src=$icon>\n" \
|
||||
" <span>$mode <i>$name</i></span>\n" \
|
||||
"</span>\n" \
|
||||
]
|
||||
} else {
|
||||
lappend output "$mode $name"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
######################################################################
|
||||
# Live viewing information
|
||||
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
######################################################################
|
||||
# In standby
|
||||
|
||||
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."
|
||||
}
|
||||
}
|
||||
|
||||
######################################################################
|
||||
# Upcoming recordings
|
||||
|
||||
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}]" \
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
######################################################################
|
||||
# Output
|
||||
|
||||
if {[llength $output]} {
|
||||
if {$runmode eq "cgi"} {
|
||||
puts [join $output "\n<br>\n"]
|
||||
} else {
|
||||
puts [join $output "\n"]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,25 +4,29 @@ package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require settings.class
|
||||
|
||||
jqplugin enadis
|
||||
jscss xepg.js /css/xepg.css
|
||||
header
|
||||
|
||||
require epg.class spinner.class altrow epg_search totop system.class
|
||||
|
||||
set irinst [system pkginst ir]
|
||||
|
||||
puts {
|
||||
<link type="text/css" href="/css/xepg.css" rel="Stylesheet" />
|
||||
<script type=text/javascript src=/js/enadis.js></script>
|
||||
<script type=text/javascript src=xepg.js></script>
|
||||
}
|
||||
set s [settings]
|
||||
|
||||
if {[[settings] chanchangenc]} {
|
||||
if {[$s chanchangenc]} {
|
||||
puts { <script type=text/javascript src=/js/chanchangenc.js></script> }
|
||||
} else {
|
||||
jqplugin confirmAction
|
||||
puts { <script type=text/javascript src=/js/chanchange.js></script> }
|
||||
}
|
||||
|
||||
if {[$s service_style] eq "standard"} {
|
||||
set surl xservice
|
||||
} else {
|
||||
set surl service
|
||||
}
|
||||
|
||||
[spinner new {
|
||||
text "Loading EPG Information..."
|
||||
size "1.2em"
|
||||
@@ -40,7 +44,7 @@ if {$stt <= $now} {
|
||||
set current 0
|
||||
}
|
||||
|
||||
set favgroup [[settings] channel_group]
|
||||
set favgroup [$s channel_group]
|
||||
|
||||
set hours [expr 1.0 * [[settings] xepghours]]
|
||||
if {$hours == 0} { set hours 4.0 }
|
||||
@@ -139,7 +143,7 @@ foreach e $records {
|
||||
puts "[$e channel_icon 30] "
|
||||
if {$irinst} { puts "</a>" }
|
||||
puts "$chnum
|
||||
<a href=\"/cgi-bin/epg/service.jim?service=[$e get service_id]\"
|
||||
<a href=\"/epg/$surl.jim?service=[$e get service_id]\"
|
||||
title=\"[$e get channel_name]\">
|
||||
[$e get channel_name]
|
||||
</a></div>"
|
||||
@@ -245,7 +249,7 @@ $('#xepgnow')
|
||||
}
|
||||
|
||||
puts "
|
||||
<a href=/cgi-bin/settings.jim>
|
||||
<a href=/settings/settings.jim>
|
||||
<img border=0 height=14 src=/images/421_1_00_CH_Title_2R_Arrow.png>
|
||||
Visit settings to change EPG options.
|
||||
</a><br>
|
||||
@@ -1,7 +1,7 @@
|
||||
$(function() {
|
||||
|
||||
$('#epgswitch').button().click(function() {
|
||||
window.location = '/epg.shtml';
|
||||
window.location = '/epg/list.jim';
|
||||
});
|
||||
|
||||
$('button.nav').click(function() {
|
||||
37
webif/html/backup/backup.jim
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
|
||||
require rsv.class
|
||||
|
||||
set dir "/mod/var/backup"
|
||||
|
||||
httpheader
|
||||
|
||||
set now [clock seconds]
|
||||
set file [file tail [cgi_get file \
|
||||
[clock format $now -format "auto-%Y-%b-%d-%H:%M"]]]
|
||||
|
||||
if {[string match {auto-*} $file]} {
|
||||
# Delete any automatic backups over 7 days old.
|
||||
set mt $(15 * 86400)
|
||||
foreach af [glob -nocomplain "$dir/auto-*"] {
|
||||
set aft [file mtime $af]
|
||||
set diff $($now - $aft)
|
||||
if {$diff > $mt} {
|
||||
puts "Removing $af"
|
||||
file delete $af
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
set ffile "$dir/$file.rbk"
|
||||
|
||||
if {[file exists $ffile]} {
|
||||
puts "Backup file <i>$file</i> already exists."
|
||||
exit
|
||||
}
|
||||
|
||||
rsv backup $ffile
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
function refresh_files()
|
||||
{
|
||||
$('#backup_files').load('/cgi-bin/backup/files.jim', function() {
|
||||
$('#backup_files').load('files.jim', function() {
|
||||
$('input.restore').change(function() {
|
||||
$('#restore_button').removeAttr('disabled')
|
||||
.button('option', 'disabled', false);
|
||||
@@ -20,7 +20,7 @@ $(document).ready(function() {
|
||||
|
||||
$('#backup_button').click(function() {
|
||||
$('#backup_working').slideDown();
|
||||
$('#results').load('/cgi-bin/backup/backup.jim?' +
|
||||
$('#results').load('backup.jim?' +
|
||||
$('#backup_name').serialize(), function() {
|
||||
$('#results').slideDown(function() {
|
||||
$('#backup_working').slideUp();
|
||||
@@ -32,7 +32,7 @@ $(document).ready(function() {
|
||||
var backup = $('input.restore:checked').val();
|
||||
if (confirm('Confirm deletion of ' + backup))
|
||||
{
|
||||
$('#results').load('/cgi-bin/backup/delete.jim?' +
|
||||
$('#results').load('delete.jim?' +
|
||||
$('input.restore').serialize(), function() {
|
||||
$('#results').slideDown(function() {
|
||||
refresh_files();
|
||||
@@ -42,7 +42,7 @@ $(document).ready(function() {
|
||||
});
|
||||
$('#view_button').click(function() {
|
||||
var backup = $('input.restore:checked').val();
|
||||
$('#results').load('/cgi-bin/backup/view.jim?' +
|
||||
$('#results').load('view.jim?' +
|
||||
$('input.restore').serialize(), function() {
|
||||
$('#results').slideDown(function() {
|
||||
refresh_files();
|
||||
@@ -54,7 +54,7 @@ $(document).ready(function() {
|
||||
if (confirm('!!!!!!!!!!!!!!!!!!!!!!!!! PLEASE CONFIRM !!!!!!!!!!!!!!!!!!!!!!!!!\n\nAre you sure you wish to erase all scheduled recordings and favourite channels and then restore them from\n' + backup + '?'))
|
||||
{
|
||||
$('#restore_working').slideDown();
|
||||
$('#results').load('/cgi-bin/backup/restore.jim?' +
|
||||
$('#results').load('restore.jim?' +
|
||||
$('input.restore').serialize(), function() {
|
||||
$('#results').slideDown(function() {
|
||||
$('#restore_working').slideUp();
|
||||
@@ -3,8 +3,10 @@
|
||||
source /mod/webif/lib/setup
|
||||
require altrow rsv.class
|
||||
|
||||
jscss backup.js
|
||||
header
|
||||
|
||||
puts {
|
||||
<script type=text/javascript src=/cgi-bin/backup/backup.js></script>
|
||||
<h2>Backup/Restore</h2>
|
||||
|
||||
<div id=restore_warning class="hidden warningbox">
|
||||
@@ -64,3 +66,5 @@ puts {
|
||||
</div>
|
||||
}
|
||||
|
||||
footer
|
||||
|
||||
21
webif/html/backup/restore.jim
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
|
||||
require rsv.class
|
||||
|
||||
set dir "/mod/var/backup"
|
||||
|
||||
httpheader
|
||||
|
||||
set file [file tail [cgi_get restore_file]]
|
||||
if {$file == 0} {
|
||||
puts "No filename supplied."
|
||||
exit
|
||||
}
|
||||
|
||||
set ffile "$dir/$file.rbk"
|
||||
|
||||
rsv restore $ffile
|
||||
|
||||
49
webif/html/browse/aexpiry.jim
Executable file
@@ -0,0 +1,49 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require browse.class
|
||||
|
||||
# dir=%2Fmedia%2FMy+Video%2FWeatherview
|
||||
# aexpiry_days=13
|
||||
|
||||
set dir [cgi_get dir "-"]
|
||||
if {$dir eq "-"} exit
|
||||
|
||||
set act [cgi_get act "update"]
|
||||
|
||||
if {$act eq "fetch"} {
|
||||
httpheader "application/json"
|
||||
set data [{dir expiry} $dir]
|
||||
puts "{"
|
||||
puts " \"days\": \"$data(days)\","
|
||||
puts " \"keep\": \"$data(keep)\","
|
||||
puts " \"type\": \"$data(type)\","
|
||||
puts " \"keepnew\": \"$data(keepnew)\""
|
||||
puts "}"
|
||||
exit
|
||||
}
|
||||
|
||||
if {$act eq "remove"} {
|
||||
httpheader
|
||||
if {[file exists "$dir/.autoexpire"]} {
|
||||
file delete "$dir/.autoexpire"
|
||||
}
|
||||
exit
|
||||
}
|
||||
|
||||
httpheader
|
||||
|
||||
set data(days) [cgi_get aexpiry_days 0]
|
||||
set data(keep) [cgi_get aexpiry_min 0]
|
||||
set data(type) [cgi_get aexpiry_timetype recorded]
|
||||
set data(keepnew) [cgi_get aexpiry_unwatched 0]
|
||||
|
||||
if {![file isdirectory $dir]} {
|
||||
puts "Not a directory."
|
||||
exit
|
||||
}
|
||||
|
||||
{dir expiry} $dir $data
|
||||
puts "Ok."
|
||||
|
||||
@@ -29,6 +29,8 @@ if {[system pkginst ffmpeg]} {
|
||||
|
||||
puts { <li><a href=#vthm>View Thumbnail</a></li> }
|
||||
|
||||
puts { <li class=bookmark><a href=#bmarks>Bookmarks</a></li> }
|
||||
|
||||
if $nicesplice {
|
||||
puts {
|
||||
<li class="cut"><a href=#crop>Crop</a></li>
|
||||
@@ -38,6 +40,16 @@ if $nicesplice {
|
||||
puts {
|
||||
<li class=separator><a href=#lock>Toggle Lock</a></li>
|
||||
<li><a href=#new>Toggle New</a></li>
|
||||
}
|
||||
|
||||
if {[llength $plugins(menu)]} {
|
||||
foreach plugin $plugins(menu) {
|
||||
lassign $plugin tag options
|
||||
puts "<li class=$tag><a href=#$tag>$options(desc)</a></li>"
|
||||
}
|
||||
}
|
||||
|
||||
puts {
|
||||
</ul>
|
||||
|
||||
<ul id=ooptmenu class=contextMenu style="width: 160px">
|
||||
@@ -80,7 +92,7 @@ if $flatten {
|
||||
}
|
||||
|
||||
puts {
|
||||
<li class=clock><a href=#expire>Auto-Expire</a></li>
|
||||
<li class=clock><a href=#expire>Auto-Expire Options</a></li>
|
||||
}
|
||||
|
||||
if {[system pkginst ffmpeg]} {
|
||||
@@ -90,6 +102,13 @@ if {[system pkginst ffmpeg]} {
|
||||
}
|
||||
}
|
||||
|
||||
if {[llength $plugins(dmenu)]} {
|
||||
foreach plugin $plugins(dmenu) {
|
||||
lassign $plugin tag options
|
||||
puts "<li class=$tag><a href=#$tag>$options(desc)</a></li>"
|
||||
}
|
||||
}
|
||||
|
||||
puts {
|
||||
</ul>
|
||||
|
||||
@@ -209,7 +228,10 @@ puts {
|
||||
<div id=savestreamform title="Save streamed content"
|
||||
style="display: none">
|
||||
<div class=pre id=savestream_detail></div>
|
||||
<form id=savestream_form>
|
||||
<div id=savestream_retrieving>
|
||||
<img src=/img/loading.gif> Retrieving details...
|
||||
</div>
|
||||
<form id=savestream_form class=hidden>
|
||||
}
|
||||
puts "<input type=hidden name=dir value=\"$dir\">"
|
||||
puts {
|
||||
@@ -217,7 +239,7 @@ puts {
|
||||
<tr>
|
||||
<th>
|
||||
<label for="savestream_name">
|
||||
<b>Filename</b>
|
||||
<b>Enter Filename</b>
|
||||
</label>
|
||||
</th>
|
||||
<td>
|
||||
@@ -225,7 +247,9 @@ puts {
|
||||
id="savestream_name"
|
||||
value="" size=70 maxlength=255
|
||||
class="text ui-widget-content ui-corner-all">
|
||||
<img id=savestream_spin src=/img/loading.gif>
|
||||
<span id=savestream_spin>
|
||||
<img src=/img/loading.gif> Saving...
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -254,28 +278,76 @@ puts {
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div id=aexpiry title="Auto-Expiry" style="display: none">
|
||||
<div id=aexpiry title="Auto-Expiry Settings"
|
||||
style="display: none; line-height: 1em;">
|
||||
<form id=aexpiry_form>
|
||||
<input type=hidden name="dir" id="aexpiry_ldir" value="">
|
||||
}
|
||||
puts {
|
||||
<table border=0>
|
||||
<tr>
|
||||
<th>
|
||||
|
||||
<tr><th align=right>
|
||||
<label for="aexpiry_days">
|
||||
<b>Expire after</b>
|
||||
<span class=blood>(in days)</span>
|
||||
<b>Remove recordings after</b> (in days)
|
||||
<br><span class=footnote>
|
||||
(Leave blank to skip age check)
|
||||
</span>
|
||||
</label>
|
||||
</th>
|
||||
<td>
|
||||
</th><td>
|
||||
<input name="aexpiry_days" id="aexpiry_days"
|
||||
type=number value=0 size=5 maxlength=3
|
||||
class="text ui-widget-content ui-corner-all">
|
||||
</td>
|
||||
</tr>
|
||||
</td></tr>
|
||||
|
||||
<tr><th>
|
||||
<label for="aexpiry_min">
|
||||
<b>Keep at least</b>
|
||||
(number of recordings)
|
||||
<br>
|
||||
<span class=footnote>(Oldest will be deleted first)
|
||||
</span>
|
||||
</label>
|
||||
</th><td>
|
||||
<input name="aexpiry_min" id="aexpiry_min"
|
||||
type=number value=0 size=5 maxlength=3
|
||||
class="text ui-widget-content ui-corner-all">
|
||||
</td></tr>
|
||||
|
||||
<tr><th>
|
||||
<label for="aexpiry_timetype">
|
||||
<b>For date of recording, use</b>
|
||||
</label>
|
||||
</th><td>
|
||||
<input name="aexpiry_timetype" id="aexpiry_timetype0"
|
||||
type=radio value=0 checked
|
||||
class="text ui-widget-content ui-corner-all">
|
||||
Recording end time
|
||||
<br>
|
||||
<input name="aexpiry_timetype" id="aexpiry_timetype1"
|
||||
type=radio value=1
|
||||
class="text ui-widget-content ui-corner-all">
|
||||
<span>
|
||||
When last watched
|
||||
<span class=bfootnote>(or end time if unwatched)</span>
|
||||
</span>
|
||||
</td></tr>
|
||||
|
||||
<tr><th>
|
||||
<label for="aexpiry_unwatched">
|
||||
<b>Never delete unwatched recordings</b>
|
||||
</label>
|
||||
</th><td>
|
||||
<input name="aexpiry_unwatched" id="aexpiry_unwatched"
|
||||
type=checkbox value=1
|
||||
class="ui-widget-content ui-corner-all">
|
||||
</td></tr>
|
||||
|
||||
</table>
|
||||
<div id=aexpiry_working class=hidden>
|
||||
<img src=/img/loading.gif> Applying auto-expiry...
|
||||
<img src=/img/loading.gif> Applying changes...
|
||||
</div>
|
||||
<div id=aexpiry_loading class=hidden>
|
||||
<img src=/img/loading.gif> Retrieving data...
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -3,19 +3,21 @@
|
||||
package require sqlite3
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require ts.class system.class
|
||||
require ts.class system.class settings.class
|
||||
|
||||
jqplugin progressbar
|
||||
jscss audio.js
|
||||
header
|
||||
|
||||
set s [settings]
|
||||
set type [$s audiomp3descr [$s audiomp3]]
|
||||
|
||||
set rfile [cgi_get file]
|
||||
set ts [ts fetch $rfile]
|
||||
set dir [file dirname $rfile]
|
||||
set len [$ts duration 1]
|
||||
|
||||
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>
|
||||
@@ -31,7 +33,7 @@ puts "
|
||||
></span>
|
||||
|
||||
<div id=audiodiv style=\"padding: 1em\">
|
||||
<button id=audioit>Perform audio extraction</button>
|
||||
<button id=audioit>Perform audio extraction - $type</button>
|
||||
</div>
|
||||
|
||||
<div id=progressdiv class=hidden>
|
||||
@@ -3,7 +3,7 @@
|
||||
package require sqlite3
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require ts.class system.class
|
||||
require ts.class system.class settings.class
|
||||
|
||||
httpheader
|
||||
|
||||
@@ -18,9 +18,15 @@ 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"]
|
||||
set cmd [list ffmpeg -y -benchmark -v 0 -i "$rfile" -f mp3 -vn]
|
||||
|
||||
if {![[settings] audiomp3]} {
|
||||
lappend cmd -acodec copy
|
||||
}
|
||||
lappend cmd "${base}.mp3"
|
||||
|
||||
#puts "$cmd"
|
||||
puts [exec {*}$cmd]
|
||||
|
||||
if {[system pkginst id3v2]} {
|
||||
puts [exec /mod/bin/id3v2 \
|
||||
49
webif/html/browse/bookmarks/index.jim
Executable file
@@ -0,0 +1,49 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require ts.class pretty_size
|
||||
|
||||
jscss script.js style.css
|
||||
jqplugin touchpunch
|
||||
header
|
||||
|
||||
set rfile [cgi_get file]
|
||||
set ts [ts fetch $rfile]
|
||||
set dir [string map {' \\'} [file dirname $rfile]]
|
||||
set erfile [string map {' \\'} $rfile]
|
||||
|
||||
set len [$ts duration 1]
|
||||
|
||||
puts "
|
||||
<script type=text/javascript>
|
||||
var initbookmarks = '[$ts bookmarks]';
|
||||
var len = [$ts duration 1];
|
||||
var file = '$erfile';
|
||||
var dir = '$dir';
|
||||
</script>
|
||||
<fieldset class=cleft>
|
||||
<legend>Manage Bookmarks</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<br><span class=footnote>(enter in seconds)</span></th><td>
|
||||
<input id=bookmarks size=80 maxlength=255 init=\"[$ts bookmarks]\"
|
||||
value=\"\" />
|
||||
<button id=update>Update</button>
|
||||
<br>
|
||||
<span id=bookmarkstime></span>
|
||||
</td></tr><tr><td align=right>
|
||||
<button class=left id=addbmark>Add Bookmark</button>
|
||||
<button class=left id=delbmark>Remove Bookmark</button>
|
||||
</td><td><div id=slider></div></td></tr>
|
||||
</table>
|
||||
<div id=buttons>
|
||||
<button id=save>Save Bookmarks</button>
|
||||
<button id=back>Back to Media Browser</button>
|
||||
</div>
|
||||
<div id=results class=\"hidden blood\"></div>
|
||||
"
|
||||
|
||||
20
webif/html/browse/bookmarks/save.jim
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require ts.class
|
||||
|
||||
httpheader
|
||||
|
||||
set file [cgi_get file]
|
||||
set bookmarks [cgi_get bookmarks ""]
|
||||
|
||||
if {[system inuse $file]} {
|
||||
puts "This file is in use. Cannot process at the moment."
|
||||
exit
|
||||
}
|
||||
|
||||
set ts [ts fetch $file]
|
||||
$ts setbookmarks [split [string trim $bookmarks]]
|
||||
puts "Bookmarks saved successfully."
|
||||
|
||||
132
webif/html/browse/bookmarks/script.js
Normal file
@@ -0,0 +1,132 @@
|
||||
var curval = 0;
|
||||
var $slider;
|
||||
|
||||
function
|
||||
setvals()
|
||||
{
|
||||
values = $.trim($('#bookmarks').val()).split(/ +/);
|
||||
if (!values.length || values[0] == '')
|
||||
{
|
||||
refreshtimes();
|
||||
return;
|
||||
}
|
||||
nvalues = [];
|
||||
$.each(values, function(k, v) {
|
||||
if (v > len)
|
||||
v = len;
|
||||
if (v < 0)
|
||||
v = 0;
|
||||
nvalues.push(v);
|
||||
});
|
||||
values = nvalues;
|
||||
$('#bookmarks').val(values.join(' '));
|
||||
sortmarks();
|
||||
refreshtimes();
|
||||
}
|
||||
|
||||
function
|
||||
draw_slider()
|
||||
{
|
||||
if ($slider)
|
||||
$slider.slider('destroy');
|
||||
else
|
||||
$slider = $('#slider');
|
||||
setvals();
|
||||
values = $.trim($('#bookmarks').val()).split(/ +/);
|
||||
if (!values.length || values[0] == '')
|
||||
{
|
||||
$slider = null;
|
||||
return;
|
||||
}
|
||||
$slider.slider({
|
||||
min: 0,
|
||||
max: len,
|
||||
step: 1,
|
||||
values: values,
|
||||
start: function(event, ui) {
|
||||
curval = ui.value;
|
||||
},
|
||||
stop: function(event, ui) {
|
||||
curval = ui.value;
|
||||
sortmarks();
|
||||
refreshtimes();
|
||||
},
|
||||
slide: function(event, ui) {
|
||||
var marks = '';
|
||||
for (var i = 0; i < ui.values.length; ++i)
|
||||
marks += ui.values[i] + ' ';
|
||||
$('#bookmarks').val($.trim(marks));
|
||||
setvals();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function
|
||||
refreshtimes()
|
||||
{
|
||||
var t = '';
|
||||
values = $.trim($('#bookmarks').val()).split(/ +/);
|
||||
if (!values.length || values[0] == '')
|
||||
{
|
||||
$('#bookmarkstime').text(t);
|
||||
return;
|
||||
}
|
||||
$.each(values, function(k, v) {
|
||||
t += new Date(null, null, null, null, null, v)
|
||||
.toTimeString().match(/\d{2}:\d{2}:\d{2}/)[0] + ' ';
|
||||
});
|
||||
$('#bookmarkstime').text(t);
|
||||
}
|
||||
|
||||
function
|
||||
sortmarks()
|
||||
{
|
||||
var a = $.trim($('#bookmarks').val()).split(/ +/);
|
||||
a.sort(function(a, b){return a-b});
|
||||
$('#bookmarks').val(a.join(" "));
|
||||
}
|
||||
|
||||
$(function() {
|
||||
|
||||
$('#bookmarks').val($('#bookmarks').attr('init'));
|
||||
draw_slider();
|
||||
|
||||
$('#addbmark').button({icons: {primary: "ui-icon-plus"}, text: false})
|
||||
.on('click', function() {
|
||||
$('#bookmarks').val('0 ' + $('#bookmarks').val());
|
||||
draw_slider();
|
||||
});
|
||||
|
||||
$('#delbmark').button({icons: {primary: "ui-icon-minus"}, text: false})
|
||||
.on('click', function() {
|
||||
var cur = $('#bookmarks').val();
|
||||
cur = $.trim(cur.replace(
|
||||
new RegExp('(^| )' + curval + '( |$)', ''), ' '));
|
||||
$('#bookmarks').val(cur);
|
||||
draw_slider();
|
||||
});
|
||||
|
||||
$('#save').button({icons: {primary: "ui-icon-disk"}})
|
||||
.on('click', function() {
|
||||
$.post('save.jim', {
|
||||
file: file,
|
||||
bookmarks: $('#bookmarks').val()
|
||||
}, function(data) {
|
||||
$('#results').html(data)
|
||||
.slideDown('slow').delay(5000).slideUp('slow');
|
||||
});
|
||||
});
|
||||
|
||||
$('#back').button({icons: {primary: "ui-icon-arrowreturnthick-1-w"}})
|
||||
.on('click', function() {
|
||||
window.location = '../index.jim?dir=' + dir;
|
||||
});
|
||||
|
||||
$('#update').button()
|
||||
.on('click', function() {
|
||||
draw_slider();
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
16
webif/html/browse/bookmarks/style.css
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
#slider
|
||||
{
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
#buttons
|
||||
{
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
#buttons2
|
||||
{
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require ts.class pretty_size
|
||||
|
||||
jqplugin progressbar
|
||||
jscss chunk.js chunk.css
|
||||
header
|
||||
|
||||
set rfile [cgi_get file]
|
||||
@@ -19,10 +21,6 @@ set esttime $(int($len * 0.025))
|
||||
if {[$ts get definition] eq "HD"} { set esttime $($esttime * 4) }
|
||||
|
||||
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>
|
||||
@@ -4,20 +4,19 @@ package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require ts.class pretty_size
|
||||
|
||||
jqplugin progressbar
|
||||
jscss crop.js
|
||||
header
|
||||
|
||||
set rfile [cgi_get file]
|
||||
set invert [cgi_get invert 0]
|
||||
set ts [ts fetch $rfile]
|
||||
set dir [file dirname $rfile]
|
||||
|
||||
set len [$ts duration 1]
|
||||
|
||||
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>
|
||||
<fieldset>
|
||||
<legend>Crop recording</legend>
|
||||
|
||||
<table class=keyval cellpadding=5>
|
||||
@@ -26,12 +25,9 @@ puts "
|
||||
<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 [join [lmap i [$ts bookmarks 1] {
|
||||
clock format $i -format "%T"
|
||||
}] ", "]
|
||||
|
||||
puts "</td></tr><tr><th>File</th><td>"
|
||||
|
||||
@@ -43,10 +39,16 @@ proc div {type left right} {
|
||||
$type</div>"
|
||||
}
|
||||
|
||||
set bookmarks {}
|
||||
if {$invert} {
|
||||
append bookmarks "0 "
|
||||
}
|
||||
append bookmarks [$ts bookmarks]
|
||||
|
||||
set keeping 0
|
||||
set last 0
|
||||
set start -1
|
||||
foreach b [$ts bookmarks] {
|
||||
foreach b $bookmarks {
|
||||
if {$start < 0} {
|
||||
set start $b
|
||||
continue
|
||||
@@ -96,6 +98,7 @@ puts "
|
||||
></span>
|
||||
|
||||
<div id=cropdiv style=\"padding: 1em\">
|
||||
<button id=invert invert=$invert>Invert selection</button>
|
||||
<button id=cropit>Perform crop operation</button>
|
||||
</div>
|
||||
|
||||
@@ -103,9 +106,9 @@ puts "
|
||||
Cropping: <div id=progressbar></div>
|
||||
</div>
|
||||
|
||||
<button id=back class=hidden>Back to media list</button>
|
||||
<button id=back>Back to media list</button>
|
||||
|
||||
<div id=output class=pre style=\"margin-top: 10px\"></div>
|
||||
<div id=output class=\"hidden pre\" style=\"margin-top: 10px\"></div>
|
||||
</fieldset>
|
||||
|
||||
"
|
||||
@@ -24,8 +24,9 @@ $('#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'),
|
||||
$('#output').show().text('Please do not interrupt...')
|
||||
.load('execute.jim?file=' + $('#params').attr('file') +
|
||||
'&invert=' + $('#invert').attr('invert'),
|
||||
function() {
|
||||
clearInterval(handle);
|
||||
handle = 0;
|
||||
@@ -34,5 +35,10 @@ $('#cropit').button().click(function() {
|
||||
});
|
||||
});
|
||||
|
||||
$('#invert').button().on('click', function() {
|
||||
window.location = 'crop.jim?file=' + $('#params').attr('file') +
|
||||
'&invert=' + ($(this).attr('invert') == '1' ? '0' : '1');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -7,6 +7,7 @@ require ts.class pretty_size system.class
|
||||
httpheader
|
||||
|
||||
set rfile [cgi_get file]
|
||||
set invert [cgi_get invert]
|
||||
|
||||
if {[system inuse $rfile]} {
|
||||
puts "This file is in use. Cannot process at the moment."
|
||||
@@ -25,7 +26,7 @@ set origdir "$dir/_original"
|
||||
if {![file exists $origdir]} { file mkdir $origdir }
|
||||
|
||||
set shname [file tail $base]
|
||||
puts "Processing $shname"
|
||||
puts "Processing $shname (inverted: $invert)"
|
||||
|
||||
if {[file exists "$origdir/$shname.ts"]} {
|
||||
puts "This recording already exists within _original"
|
||||
@@ -33,24 +34,47 @@ if {[file exists "$origdir/$shname.ts"]} {
|
||||
exit
|
||||
}
|
||||
|
||||
set bookmarks [$ts bookmarks]
|
||||
|
||||
puts "Moving recording to $origdir"
|
||||
foreach f [glob -nocomplain "${base}.*"] {
|
||||
set tail [file tail $f]
|
||||
puts " $tail"
|
||||
file rename $f "$origdir/$tail"
|
||||
|
||||
set tail [file tail $base]
|
||||
foreach ext $tsgroup {
|
||||
if {![file exists "$base.$ext"]} continue
|
||||
puts " $tail.$ext"
|
||||
file rename "$base.$ext" "${origdir}/$tail.$ext"
|
||||
}
|
||||
|
||||
puts [exec /mod/bin/nicesplice \
|
||||
-in "$origdir/$shname" \
|
||||
-out "$dir/$shname" \
|
||||
-cutBookMarks]
|
||||
set cmd [list /mod/bin/nicesplice \
|
||||
-in "$origdir/$shname" \
|
||||
-out "$dir/$shname"]
|
||||
|
||||
if {$invert} {
|
||||
if {[expr [llength $bookmarks] % 2] != 0} {
|
||||
lappend bookmarks [$ts duration 1]
|
||||
}
|
||||
foreach k [array names bookmarks] {
|
||||
lappend cmd -cut $($k * 10) $($bookmarks($k) * 10)
|
||||
}
|
||||
} else {
|
||||
lappend cmd "-cutBookMarks"
|
||||
}
|
||||
|
||||
puts "CMD: $cmd"
|
||||
|
||||
puts [exec {*}$cmd]
|
||||
#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"
|
||||
# New nicesplice shrinks whilst cropping.
|
||||
exec /mod/bin/hmt "+shrunk" "$dir/$newname.hmt"
|
||||
# No longer required - nicesplice now sets this flag.
|
||||
#exec /mod/bin/hmt "+shrunk" "$dir/$newname.hmt"
|
||||
|
||||
set croptime [expr [expr [clock milliseconds] - $cropstart] / 1000.0]
|
||||
puts "Time taken: $croptime"
|
||||
@@ -7,7 +7,7 @@ require ts.class
|
||||
httpheader
|
||||
|
||||
set perc [cgi_get perc 100]
|
||||
set tsfile [file normalize [cgi_get file]]
|
||||
set tsfile [cgi_get file]
|
||||
|
||||
set origfile "[file dirname $tsfile]/_original/[file tail $tsfile]"
|
||||
set newfile [file rootname $tsfile]
|
||||
@@ -5,6 +5,8 @@ package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require ts.class
|
||||
|
||||
jqplugin progressbar
|
||||
jscss decrypt.js
|
||||
header
|
||||
|
||||
set rfile [cgi_get file]
|
||||
@@ -14,9 +16,6 @@ set len [$ts duration 1]
|
||||
lassign [$ts dlnaloc "127.0.0.1"] url
|
||||
|
||||
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>
|
||||
@@ -42,20 +42,22 @@ 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"
|
||||
set tail [file tail $base]
|
||||
foreach ext $tsgroup {
|
||||
if {![file exists "$base.$ext"]} continue
|
||||
puts " $tail.$ext"
|
||||
file rename "$base.$ext" "${origdir}/$tail.$ext"
|
||||
}
|
||||
|
||||
file rename "$rfile.decrypting" $rfile
|
||||
file touch $rfile "$origdir/$tail.ts"
|
||||
|
||||
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"
|
||||
file touch "$dir/$sidecar" "$origdir/$tail.ts"
|
||||
}
|
||||
}
|
||||
|
||||