Compare commits

...

64 Commits

Author SHA1 Message Date
hummypkg
95bef6f458 add network name
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@678 2a923420-c742-0410-a762-8d5b09965624
2012-01-18 22:15:20 +00:00
hummypkg
44038eb7a1 fix another size issue
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@677 2a923420-c742-0410-a762-8d5b09965624
2012-01-18 00:07:25 +00:00
hummypkg
ae607a6071 hover over synopsis, fix sizes, fix delete
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@676 2a923420-c742-0410-a762-8d5b09965624
2012-01-18 00:02:55 +00:00
hummypkg
c5de79b214 Streamline deletion. Touch files into dustbin.
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@674 2a923420-c742-0410-a762-8d5b09965624
2012-01-16 22:28:20 +00:00
hummypkg
fa839705fc rename default bin
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@672 2a923420-c742-0410-a762-8d5b09965624
2012-01-14 23:08:54 +00:00
hummypkg
3d75b93f1a allow deletions from inside dustbin
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@666 2a923420-c742-0410-a762-8d5b09965624
2012-01-14 00:29:44 +00:00
hummypkg
602f96e1ac support variable dustbin name
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@663 2a923420-c742-0410-a762-8d5b09965624
2012-01-14 00:12:07 +00:00
hummypkg
3312a76cc6 dynamic dustbin
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@661 2a923420-c742-0410-a762-8d5b09965624
2012-01-13 23:28:48 +00:00
hummypkg
88026872d9 add dustbin folder image
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@658 2a923420-c742-0410-a762-8d5b09965624
2012-01-13 21:34:24 +00:00
hummypkg
ce2dfa8338 update delete system
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@657 2a923420-c742-0410-a762-8d5b09965624
2012-01-13 21:23:03 +00:00
hummypkg
6e2a0f3e2b dustbin support + bugfix
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@648 2a923420-c742-0410-a762-8d5b09965624
2012-01-10 19:51:45 +00:00
hummypkg
ccb513be49 0.8.11
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@639 2a923420-c742-0410-a762-8d5b09965624
2012-01-08 21:10:38 +00:00
hummypkg
84b5cb9506 reinstate delete, add failed recordings
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@638 2a923420-c742-0410-a762-8d5b09965624
2012-01-08 20:54:07 +00:00
hummypkg
337a2add7a verson 0.8.10
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@636 2a923420-c742-0410-a762-8d5b09965624
2012-01-07 22:30:41 +00:00
hummypkg
4706fe6bcd disable delete
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@635 2a923420-c742-0410-a762-8d5b09965624
2012-01-07 22:30:19 +00:00
hummypkg
88d78a7d42 more verbose message
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@634 2a923420-c742-0410-a762-8d5b09965624
2012-01-06 23:57:31 +00:00
hummypkg
b442fef333 upgradable packages come first
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@632 2a923420-c742-0410-a762-8d5b09965624
2012-01-06 23:44:55 +00:00
hummypkg
f771f55017 fix pkg upgrade tab
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@631 2a923420-c742-0410-a762-8d5b09965624
2012-01-06 23:39:15 +00:00
hummypkg
267ba4fade fix avail
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@630 2a923420-c742-0410-a762-8d5b09965624
2012-01-06 23:27:35 +00:00
hummypkg
c2ec779465 allow restart cancel, improve logfile list
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@629 2a923420-c742-0410-a762-8d5b09965624
2012-01-05 22:42:45 +00:00
hummypkg
75b31696c5 dynamic databases
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@600 2a923420-c742-0410-a762-8d5b09965624
2012-01-03 12:12:07 +00:00
hummypkg
f54d162298 update to 0.8.9
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@594 2a923420-c742-0410-a762-8d5b09965624
2011-12-29 01:17:55 +00:00
hummypkg
2a0bcbc81e minor tweaks for IE9
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@593 2a923420-c742-0410-a762-8d5b09965624
2011-12-29 01:17:32 +00:00
hummypkg
4d3183ea61 working copy/paste
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@592 2a923420-c742-0410-a762-8d5b09965624
2011-12-29 00:57:18 +00:00
hummypkg
7c038a1776 checkpoint
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@588 2a923420-c742-0410-a762-8d5b09965624
2011-12-28 21:36:35 +00:00
hummypkg
822de81971 checkpoint - working on clipboard
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@587 2a923420-c742-0410-a762-8d5b09965624
2011-12-28 14:11:10 +00:00
hummypkg
09e71400a2 updates
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@585 2a923420-c742-0410-a762-8d5b09965624
2011-12-27 18:43:40 +00:00
hummypkg
18cafc8c39 handle ar/pad icons
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@576 2a923420-c742-0410-a762-8d5b09965624
2011-12-19 22:52:17 +00:00
hummypkg
593b7dbb89 fix bugs, show AR/Pad status
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@572 2a923420-c742-0410-a762-8d5b09965624
2011-12-19 15:57:03 +00:00
hummypkg
de47e46fe7 fix scheduling problem
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@566 2a923420-c742-0410-a762-8d5b09965624
2011-12-18 21:17:03 +00:00
hummypkg
509c98ee74 update
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@564 2a923420-c742-0410-a762-8d5b09965624
2011-12-14 13:55:58 +00:00
hummypkg
ddb63e68b7 7 days, not 7 hours
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@562 2a923420-c742-0410-a762-8d5b09965624
2011-12-13 22:55:42 +00:00
hummypkg
5de2ba1c37 fix bug
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@561 2a923420-c742-0410-a762-8d5b09965624
2011-12-13 21:00:27 +00:00
hummypkg
43f6281410 add flatten support
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@560 2a923420-c742-0410-a762-8d5b09965624
2011-12-12 23:45:58 +00:00
hummypkg
8166af0f1b fix IE error, fix typo in anacrontab
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@559 2a923420-c742-0410-a762-8d5b09965624
2011-12-12 21:11:08 +00:00
hummypkg
25344c5ff4 add audio extraction
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@554 2a923420-c742-0410-a762-8d5b09965624
2011-12-09 20:33:57 +00:00
hummypkg
b6ce0e3b16 fix sorting of backups
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@553 2a923420-c742-0410-a762-8d5b09965624
2011-12-09 10:57:13 +00:00
hummypkg
a189b524ab automatic daily schedule backups
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@551 2a923420-c742-0410-a762-8d5b09965624
2011-12-09 10:35:21 +00:00
hummypkg
84b00010a8 update icons
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@550 2a923420-c742-0410-a762-8d5b09965624
2011-12-09 10:12:02 +00:00
hummypkg
993958d346 update icons
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@549 2a923420-c742-0410-a762-8d5b09965624
2011-12-09 10:11:41 +00:00
hummypkg
1045587fbd fix error on default browse directory
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@545 2a923420-c742-0410-a762-8d5b09965624
2011-12-06 00:13:41 +00:00
hummypkg
659fd40fe9 update to 0.8.3
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@543 2a923420-c742-0410-a762-8d5b09965624
2011-12-05 21:45:24 +00:00
hummypkg
fcb4615c82 bug fixes
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@542 2a923420-c742-0410-a762-8d5b09965624
2011-12-05 21:44:30 +00:00
hummypkg
8146627f18 join is working, more webif functions
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@538 2a923420-c742-0410-a762-8d5b09965624
2011-11-28 15:24:38 +00:00
hummypkg
99dde5a4a5 update
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@534 2a923420-c742-0410-a762-8d5b09965624
2011-11-27 23:29:14 +00:00
hummypkg
d04d3bdb15 fix autocapitalisation
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@531 2a923420-c742-0410-a762-8d5b09965624
2011-11-24 22:25:28 +00:00
hummypkg
78d49d419a require updated busybox
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@529 2a923420-c742-0410-a762-8d5b09965624
2011-11-19 01:12:36 +00:00
hummypkg
df67594f29 updates for HD cropping
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@514 2a923420-c742-0410-a762-8d5b09965624
2011-11-16 22:55:06 +00:00
hummypkg
8cc2ef3d3f add logfiles/cat and improved images
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@512 2a923420-c742-0410-a762-8d5b09965624
2011-11-16 21:40:53 +00:00
hummypkg
ac93144789 add access control and diagnostics
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@511 2a923420-c742-0410-a762-8d5b09965624
2011-11-12 23:57:19 +00:00
hummypkg
93ebdce4e1 update decrypt
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@510 2a923420-c742-0410-a762-8d5b09965624
2011-11-12 11:12:07 +00:00
hummypkg
9ba7c3dba8 download already decrypted files in the clear
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@509 2a923420-c742-0410-a762-8d5b09965624
2011-11-06 16:34:30 +00:00
hummypkg
436db53de3 fix bugs in crop, improve screen
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@507 2a923420-c742-0410-a762-8d5b09965624
2011-11-04 20:47:27 +00:00
hummypkg
ebe6a0f64c fix bug with duplicate files
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@506 2a923420-c742-0410-a762-8d5b09965624
2011-11-04 13:54:54 +00:00
hummypkg
20b2a7e2dc fix crop progress?
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@505 2a923420-c742-0410-a762-8d5b09965624
2011-11-04 13:38:48 +00:00
hummypkg
258c3b76af updates
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@504 2a923420-c742-0410-a762-8d5b09965624
2011-11-04 13:19:56 +00:00
hummypkg
e87cc8586e add dec icon
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@503 2a923420-c742-0410-a762-8d5b09965624
2011-11-04 01:16:07 +00:00
hummypkg
eace5c5260 add decryption
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@502 2a923420-c742-0410-a762-8d5b09965624
2011-11-04 00:55:13 +00:00
hummypkg
15e33ab751 add crop
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@501 2a923420-c742-0410-a762-8d5b09965624
2011-11-03 23:43:17 +00:00
hummypkg
fa5561d200 updates
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@492 2a923420-c742-0410-a762-8d5b09965624
2011-10-31 13:47:47 +00:00
hummypkg
64da76ed64 css update
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@469 2a923420-c742-0410-a762-8d5b09965624
2011-10-25 21:25:11 +00:00
hummypkg
86424d065c remove portal code
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@464 2a923420-c742-0410-a762-8d5b09965624
2011-10-22 19:17:16 +00:00
hummypkg
2128aded40 update epg extraction
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@462 2a923420-c742-0410-a762-8d5b09965624
2011-10-20 23:24:25 +00:00
hummypkg
218ff8edfb add epg previous method
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@455 2a923420-c742-0410-a762-8d5b09965624
2011-10-13 23:32:46 +00:00
98 changed files with 2736 additions and 297 deletions

View File

@@ -1,11 +1,9 @@
Package: webif
Priority: optional
Section: web
Version: 0.7.6
Version: 0.8.12-3
Architecture: mipsel
Maintainer: af123@hummypkg.org.uk
Depends: mongoose(>=3.0-2),jim(>=0.71-1),jim-sqlite3(>=0.71-1),jim-cgi(>=0.4),jim-oo,jim-pack,service-control,busybox(>=1.18.3-1),lsof,epg(>=1.0.5),hmt(>=1.0.6),ssmtp
Replaces: af123-webif
Conflicts: af123-webif
Suggests: ffmpeg,webif-iphone
Depends: mongoose(>=3.0-2),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
Suggests: ffmpeg,webif-iphone,nicesplice,id3v2
Description: An evolving web interface for the Humax.

17
CONTROL/postinst Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/sh
export tmpf=/tmp/cronf.$$
# Add anacron jobs
ana=$PKG_ROOT/etc/anacrontab
grep -v 'backup/backup.jim' $ana > $tmpf
(
cat $tmpf
echo "1 8 sched_backup /mod/var/mongoose/cgi-bin/backup/backup.jim"
) > $ana
$PKG_ROOT/etc/init.d/S02anacron start < /dev/null > /dev/null 2>&1 &
exit 0

10
CONTROL/prerm Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/sh
export tmpf=/tmp/cronf.$$
ana=/mod/etc/anacrontab
grep -v 'backup/backup.jim' $ana > $tmpf
cp $tmpf $ana
exit 0

View File

@@ -1,9 +1,5 @@
#!/bin/sh
export PATH=/mod/bin:/mod/usr/bin:/mod/bin/busybox:/bin:/sbin
export LD_LIBRARY_PATH=/mod/lib:/lib:/usr/lib
export TZ=GMT+0BST,M3.5.0/1,M10.5.0/2
if [ -f /mnt/hd1/dvbepg/epg.dat ]; then
epg=/mnt/hd1/dvbepg/epg.dat
epgdb=/mnt/hd1/epg.db
@@ -14,30 +10,15 @@ fi
case "$1" in
start)
(
while [ 1 ]; do
if [ -f $epgdb ]; then
touch $epgdb.stamp
now=`stat -c %Z $epgdb.stamp`
dbstamp=`stat -c %Z $epgdb`
age=`expr $now - $dbstamp`
else
age=99999
fi
echo "EPG Database age: $age"
if [ $age -gt 28800 ]; then
sleep 120
echo "Generating EPG database..."
/mod/bin/epg -f $epg sqlitedump $epgdb
fi
sleep 3712
done
) &
/mod/bin/epg -f $epg sqlitedumpd $epgdb > /tmp/epgd.log &
;;
stop)
killall -q epg
;;
*)
exit 1
;;
esac
exit 0

View File

@@ -13,12 +13,23 @@ puts ""
cgi_input
#cgi_dump
if {![dict exists $_cgi file]} {
puts "No filename supplied."
exit
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 $(7 * 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 file [file tail [dict get $_cgi file]]
set ffile "/$dir/$file.rbk"
if {[file exists $ffile]} {

View File

@@ -20,7 +20,18 @@ if {![file isdirectory $dir]} {
exit
}
set backups [glob -nocomplain "$dir/*.rbk"]
proc s_time {a b} {
file stat $a l
set at $l(ctime)
file stat $b l
set bt $l(ctime)
if {$at < $bt} { return -1 }
if {$at > $bt} { return 1 }
return 0
}
set backups [lsort -command s_time [glob -nocomplain "$dir/*.rbk"]]
if {![llength $backups]} {
empty

View File

@@ -106,7 +106,7 @@ foreach line $data {
puts " $chan"
if {!$hsvc} {
if {$hsvc eq ""} {
puts " Cannot map channel name to service."
continue
}

View File

@@ -2,28 +2,77 @@
package require cgi
source /mod/var/mongoose/lib/setup
require ts.class pretty_size
require ts.class pretty_size system.class settings.class escape
puts "Content-Type: text/html"
puts ""
set ignore {.nts .thm .hmt .hmi}
set include {.ts .avi .mpg .mpeg .wmv .mkv .mp3 .mp4 .mov}
set nicesplice [system pkginst nicesplice]
set flatten [system pkginst flatten]
set ignore {.nts .thm .hmi}
set include {.ts .avi .mpg .mpeg .wmv .mkv .mp3 .mp4 .mov .hmt}
cgi_input
#cgi_dump
#set env(REQUEST_URI) ''
#set _cgi(dir) "/media/My Video/Chuggington"
if {![dict exists $env REQUEST_URI]} {
set env(REQUEST_URI) ""
set _cgi(dir) "/media/My Video/"
}
if {![dict exists $env QUERY_STRING]} { set env(QUERY_STRING) "root" }
set order [cgi_get order -]
if {$order eq "-"} {
set order [[settings new] sortorder]
} else {
[settings new] sortorder $order
}
set dustbin [system dustbin 1]
proc directory {file bfile} {
global flatten
regsub -all " +" $bfile "" tbfile
puts "<div class=va>"
puts "<a href=$::env(REQUEST_URI)?dir=[cgi_quote_url $file]>"
puts "<img border=0 class=va id=\"img$tbfile\"
src=/images/711_1_09_Media_Folder.png>"
set img "/images/711_1_09_Media_Folder.png"
if {$bfile eq $::dustbin} { set img "/img/Dustbin_Folder.png" }
puts "<img border=0 class=va id=\"img$tbfile\" src=$img>"
puts "<input class=\"fs fsdir\" type=checkbox>"
puts "<a class=dbf
href=\"$::env(REQUEST_URI)?dir=[cgi_quote_url $file]\"
file=\"[cgi_quote_url $file]\">"
puts "$bfile</a><span class=filesize id=\"$tbfile\">
</span></div>"
</span>"
set noflat 0
if $flatten {
if {[string match {\[*\]} [file tail $file]]} { set noflat 1 }
if {[file exists "$file/.noflatten"]} {
set noflat 1
}
if $noflat {
puts "<img alt=\"No-flatten\" title=\"No-flatten\"
class=va src=/img/flat-tyre.png height=21>"
}
}
puts -nonewline "
<a href=#>
<img class=\"dopt va\" border=0 width=45 "
if $flatten { puts -nonewline "noflat=$noflat " }
puts "
src=/images/181_1_00_Help5_OPT_Plus.png>
</a>
"
puts "
<div class=\"results blood\" style=\"margin: 0 0 0 5em\"></div>
"
puts "</div>"
}
proc entry {file} {{i 0}} {
@@ -47,31 +96,42 @@ proc entry {file} {{i 0}} {
set type ts
set ts [ts fetch $file 1]
set img Video_TS
} 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
} else {
set type gen
set ts 0
set img Video_Other
}
puts "
<div class=\"va bf\" id=[incr i]>
<a class=bf file=\"$file\" type=$type href=#>
"
set new 0
if {$type eq "ts"} {
if {[$ts flag "New"] > 0} { set new 1 }
} else {
if {![file exists "[file rootname $file].hmi"]} { set new 1 }
} elseif {$type eq "gen"} {
if {![file exists "${base}.hmi"]} { set new 1 }
}
if {$new} { append img _New }
puts "<img class=va border=0 src=/img/$img.png>"
set fscl "fs"
set synopsis ""
if {$type eq "ts"} {
set fscl "fs fsts"
set synopsis [cgi_quote_html [$ts get synopsis]]
}
puts "
$bfile
</a>
<div class=\"va bf\" id=[incr i]>
<img class=va border=0 src=/img/$img.png>
<input class=\"$fscl\" type=checkbox>
<a class=bf title=\"$synopsis\"
file=\"[cgi_quote_url $file]\" type=$type href=#>
$bfile
</a>
"
# Size
@@ -81,7 +141,9 @@ proc entry {file} {{i 0}} {
set locked 0
set encd 0
set odencd 1
set def unknown
set bx 0
if {$type eq "ts"} {
# HD / SD
if {[$ts get definition] eq "HD"} {
@@ -107,6 +169,10 @@ proc entry {file} {{i 0}} {
src=/images/749_1_26_Video_Encryption.png
height=21>"
}
if {![$ts flag "ODEncrypted"]} {
puts "<img class=va src=/img/Decrypted.png height=21>"
set odencd 0
}
# Guidance
if {[$ts flag "Guidance"] > 0} {
@@ -114,6 +180,8 @@ proc entry {file} {{i 0}} {
src=/images/174_1_26_GuidancePolicy.png
height=21>"
}
set bx [$ts get bookmarks]
}
# Opt+ button
@@ -121,7 +189,8 @@ proc entry {file} {{i 0}} {
puts "
<a href=#>
<img class=\"opt va\" border=0 width=45 type=$type did=$i
locked=$locked encd=$encd def=$def new=$new
locked=$locked encd=$encd def=$def new=$new bx=$bx
odencd=$odencd
src=/images/181_1_00_Help5_OPT_Plus.png>
</a>
<div class=\"results blood\" style=\"margin: 0 0 0 5em\"></div>
@@ -129,11 +198,7 @@ proc entry {file} {{i 0}} {
puts "</div>"
}
if {[dict exists $_cgi dir]} {
set dir [dict get $_cgi dir]
} else {
set dir "/media/My Video"
}
set dir [cgi_get dir [system mediaroot]]
######################################################################
# Render web page
@@ -143,91 +208,21 @@ header
puts {
<link href=/css/jquery.contextMenu.css rel=stylesheet type=text/css />
<script type="text/javascript" src="/js/jquery.contextMenu.js"></script>
<ul id=optmenu class=contextMenu>
<li><a href=#delete>Delete</a></li>
<li><a href=#lock>Toggle Lock</a></li>
<li><a href=#enc>Toggle Enc</a></li>
<li><a href=#new>Toggle New</a></li>
<li><a href=#rename>Rename</a></li>
<li><a href=#download>Download</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="">
<table border=0>
<tr>
<th>
<label for="rename">
<b>New Filename</b>
</label>
</th>
<td>
<input type=text name="rename" id="rename"
value="" size=70 maxlength=255
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">
<b>New EPG Title</b>
</label>
</th>
<td>
<input type=text name="renametitle" id="renametitle"
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>
</tr>
</table>
</form>
</div>
<div id=savestreamform title="Save streamed content"
style="display: none">
<div class=pre id=savestream_detail></div>
<form id=savestream_form>
}
puts "<input type=hidden name=dir value=\"$dir\">"
puts {
<table border=0>
<tr>
<th>
<label for="savestream_name">
<b>Filename</b>
</label>
</th>
<td>
<input type=text name="savestream_name"
id="savestream_name"
value="" size=70 maxlength=255
class="text ui-widget-content ui-corner-all">
<img id=savestream_spin src=/img/loading.gif>
</td>
</tr>
</table>
</form>
</div>
<div id=dialogue></div>
<div id=confirm title="Confirmation Required"></div>
<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=/cgi-bin/browse/browse.js></script>
<link type=text/css rel=stylesheet href=/cgi-bin/browse/style.css />
}
puts "<span style=\"display:none\" id=dir>$dir</span>"
source /mod/var/mongoose/cgi-bin/browse/assets.jim
# Breadcrumb path
puts "
<fieldset style=\"margin: 1em\">
<span style=\"display:none\" id=dir>$dir</span>
<fieldset class=cleft style=\"margin: 0 1em 1em 1em\">
<legend style=\"font-size: 1.5em; padding: 0 0.5em 0.5em 0.5em;\">
"
# Breadcrumb path
set stub ""
foreach part [split $dir /] {
if {$stub eq "/"} { set name $part } else { set name "/$part" }
@@ -252,27 +247,112 @@ if {$parent ne ""} {
# Strip double slashes
regsub -all -- {\/+} "$dir/*" "/" dir
foreach file [lsort [glob -nocomplain "$dir"]] {
entry $file
# Escape square brackets (for glob)
regsub -all {([\\[])} $dir {\\\1} dir
proc s_time {a b} {
set ad [file isdirectory $a]
set bd [file isdirectory $b]
if {$ad && !$bd} { return -1 }
if {$bd && !$ad} { return 1 }
if {$ad && $bd} {
if {$a < $b} { return -1 }
if {$a > $b} { return 1 }
return 0
}
file stat $a l
set at $l(ctime)
file stat $b l
set bt $l(ctime)
if {$at < $bt} { return -1 }
if {$at > $bt} { return 1 }
return 0
}
set files [glob -nocomplain $dir]
switch $order {
1 { set files [lsort -command s_time $files] }
default { set files [lsort $files] }
}
foreach file $files { entry $file }
puts "<a href=# id=selectall>Select all</a> | <a href=# id=deselectall>none</a>"
# Sort icons
puts "<div id=sortdiv>"
set sortlist {{0 sort_name name} {1 sort_date date}}
foreach sl $sortlist {
lassign $sl index img descr
if {$index} { puts " | " }
set tag "Currently sorting"
if {$order != $index} {
puts "
<a href=$env(REQUEST_URI)?$env(QUERY_STRING)&order=$index>"
set tag "Sort"
}
puts "<img class=va border=0 src=/img/$img.gif> $tag by $descr"
if {$order != $index} {
puts "</a>"
}
}
puts "</div>"
puts "</fieldset>"
puts {
<fieldset class=left style="margin: 0 1em 1em 1em">
<legend style="font-size: 1.5em; padding: 0 0.5em 0.5em 0.5em; color: #1e5bbd;">
File Clipboard
</legend>
<div id=clipboard>
<img src=/img/loading.gif> <i>Loading...</i>
</div>
</fieldset>
}
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">
<img src=/img/loading.gif>Deleting may take some time, please be patient...
</div>
}
# Join
if $nicesplice {
puts { <button id=join>Join</button> }
}
puts "</div><div class=brow style=\"margin-top: 3px\">"
# De-duplicate
puts {
<small><button id=dedup>De-duplicate/tidy this folder</button></small>
<button id=dedup>De-duplicate/tidy this folder</button>
}
# Streamer file
if {[file exists /mnt/hd3/Streamer_down_file]} {
puts {
<small><button id=save_stream file=/mnt/hd3/Streamer_down_file>
Save last streamed content (e.g. iPlayer/YouTube)
</button></small>
}
puts {
<button id=save_stream file=/mnt/hd3/Streamer_down_file>
Save last streamed content (e.g. iPlayer/YouTube)
</button>
}
}
puts "</div>"
footer

View File

@@ -0,0 +1,161 @@
#!/mod/bin/jimsh
puts {
<div id=jbar></div>
<ul id=optmenu class=contextMenu style="width: 160px">
<li class=delete><a href=#delete>Delete</a></li>
<li class=cut><a href=#cut>Cut to clipboard</a></li>
<li class=pwcopy><a href=#copy>Copy to clipboard</a></li>
<li class=separator><a href=#rename>Rename</a></li>
<li><a href=#download>Download</a></li>
}
if {[system model] eq "HDR"} {
puts { <li class="separator"><a href=#decrypt>Decrypt</a></li> }
}
if {[system pkginst ffmpeg]} {
puts { <li><a href=#audio>Extract Audio</a></li> }
}
if $nicesplice {
puts { <li class="cut"><a href=#crop>Crop</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">
<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>
}
if $flatten {
puts { <li class="separator"><a href=#flat>No-Flatten</a></li> }
}
puts {
</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="">
<table border=0>
<tr>
<th>
<label for="rename">
<b>New Filename</b>
</label>
</th>
<td>
<input type=text name="rename" id="rename"
value="" size=70 maxlength=255
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">
<b>New Medialist Title</b>
</label>
</th>
<td>
<input type=text name="renametitle" id="renametitle"
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>
</tr>
</table>
</form>
</div>
<div id=drenameform title="Rename directory" style="display: none">
<form id=drenameform_form>
<input type=hidden name="renameorig" id="drenameorig" value="">
<table border=0>
<tr>
<th>
<label for="drename">
<b>New Directory Name</b>
</label>
</th>
<td>
<input type=text name="rename" id="drename"
value="" size=70 maxlength=255
class="text ui-widget-content ui-corner-all">
</td>
</tr>
</table>
</form>
</div>
<div id=savestreamform title="Save streamed content"
style="display: none">
<div class=pre id=savestream_detail></div>
<form id=savestream_form>
}
puts "<input type=hidden name=dir value=\"$dir\">"
puts {
<table border=0>
<tr>
<th>
<label for="savestream_name">
<b>Filename</b>
</label>
</th>
<td>
<input type=text name="savestream_name"
id="savestream_name"
value="" size=70 maxlength=255
class="text ui-widget-content ui-corner-all">
<img id=savestream_spin src=/img/loading.gif>
</td>
</tr>
</table>
</form>
</div>
<div id=newdirform title="New Folder" style="display: none">
<form id=newdirform_form>
}
puts "<input type=hidden name=dir value=\"$dir\">"
puts {
<table border=0>
<tr>
<th>
<label for="newdirname">
<b>New Folder Name</b>
</label>
</th>
<td>
<input type=text name="newdirname" id="newdirname"
value="" size=70 maxlength=255
class="text ui-widget-content ui-corner-all">
</td>
</tr>
</table>
</form>
</div>
<div id=dialogue></div>
<div id=confirm title="Confirmation Required"></div>
<div id=pwdialogue style="display: none">
<center>
<img src=/img/loading.gif>
<br><br>
Please wait...
<div id=pwfeedback></div>
</center>
</div>
}

View File

@@ -0,0 +1,109 @@
#!/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>
}

View File

@@ -0,0 +1,26 @@
#!/mod/bin/jimsh
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 tsfile [cgi_get file]
set rfile [file normalize $tsfile]
set bfile [file rootname $rfile]
if {![file exists "${bfile}.mp3"]} {
puts "0"
} else {
set sz [file size $rfile]
set nsz [expr [file size "${bfile}.mp3"] / 0.3]
set perc [expr $nsz * 100 / $sz]
if {$perc > 100} { set perc 100 }
puts $perc
}

View File

@@ -1,3 +1,60 @@
(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);
function disableall()
{
$('button,a,input').disable();
}
function reloadclipboard()
{
$('#clipboard')
.empty()
.html('<img src=/img/loading.gif> <i>Loading...</i>')
.load('/cgi-bin/browse/clipboard.jim', function() {
// Start Clipboard post-load actions
if ($('#clipclear').length)
$('#paste').enable();
else
$('#paste').disable();
$('#clipclear').button().click(function() {
$.get('/cgi-bin/browse/clipboard.jim?act=clear', function() {
reloadclipboard();
});
});
$('a.clipdel').click(function() {
$.get('/cgi-bin/browse/clipboard.jim?act=remove&path=' +
$(this).attr('path'), function() {
reloadclipboard();
});
});
// End Clipboard post-load actions
});
}
function epginfo_callback(data, status, xhr)
{
@@ -50,13 +107,17 @@ function new_folder_callback(data, status, xhr)
$.each(data, set_folder_new);
}
function delete_callback(file, type, id)
function delete_callback(file, dir, id)
{
var el = 'div.bf#' + id;
var results = el + ' .results';
var url = '/cgi-bin/browse/delete.jim?file=' +
encodeURIComponent(file) + '&type=' + type;
$(results).load(url, function() {
$(results)
.html('<img src=/img/loading.gif>Deleting, please wait...')
.slideDown('slow')
.load('/cgi-bin/browse/delete.jim', {
'dir': dir,
'files': [decodeURIComponent(file)]
}, function() {
$(el).delay(3000).slideUp(300, function() {
$(el).remove();
});
@@ -65,19 +126,19 @@ function delete_callback(file, type, id)
function lock_callback(file, type, id)
{
var url = '/cgi-bin/browse/lock.jim?file=' + encodeURIComponent(file);
var url = '/cgi-bin/browse/lock.jim?file=' + file;
$.get(url, function() { window.location.reload(true); });
}
function enc_callback(file, type, id)
{
var url = '/cgi-bin/browse/enc.jim?file=' + encodeURIComponent(file);
var url = '/cgi-bin/browse/enc.jim?file=' + file;
$.get(url, function() { window.location.reload(true); });
}
function new_callback(file, type, id)
{
var url = '/cgi-bin/browse/new.jim?file=' + encodeURIComponent(file);
var url = '/cgi-bin/browse/new.jim?file=' + file;
$.get(url, function() { window.location.reload(true); });
}
@@ -88,6 +149,20 @@ function rename_submit()
function() { window.location.reload(true); });
}
function drename_submit()
{
var s = $('#drenameform_form').serialize();
$.get('/cgi-bin/browse/rename.jim?' + s,
function() { window.location.reload(true); });
}
function newdir_submit()
{
var s = $('#newdirform_form').serialize();
$.get('/cgi-bin/browse/mknewdir.jim?' + s,
function() { window.location.reload(true); });
}
function savestream_submit()
{
var s = $('#savestream_form').serialize();
@@ -113,7 +188,7 @@ function confirm_action(action, callback, file, type, id)
});
$('#confirm').empty().html(
'Are you sure you wish to ' + action + '<br>' +
'<i>' + bfile + '</i> ?'
'<i>' + decodeURIComponent(bfile) + '</i> ?'
);
$confirm.dialog('open');
}
@@ -124,49 +199,80 @@ function preparemenu(el, menu)
{
if (el.attr('def') == 'HD')
{
$('#optmenu').enableContextMenuItems('#enc');
$(menu).enableContextMenuItems('#enc');
if (el.attr('encd') == 1)
$(menu).changeContextMenuItem('#enc',
'Remove ENC');
'Remove Enc');
else
$(menu).changeContextMenuItem('#enc',
'Set ENC');
'Set Enc');
}
else
$('#optmenu').disableContextMenuItems('#enc');
$('#optmenu').enableContextMenuItems('#new');
if (el.attr('bx') > 0)
$(menu).enableContextMenuItems('#crop');
else
$(menu).disableContextMenuItems('#crop');
$(menu).enableContextMenuItems('#new');
if (el.attr('new') == 1)
$(menu).changeContextMenuItem('#new', 'Mark watched');
else
$(menu).changeContextMenuItem('#new', 'Mark new');
$('#optmenu').enableContextMenuItems('#lock');
$(menu).enableContextMenuItems('#lock');
if (el.attr('locked') == 1)
{
$(menu).changeContextMenuItem('#lock', 'Unlock');
$('#optmenu').disableContextMenuItems('#delete');
$(menu).disableContextMenuItems('#delete');
}
else
{
$(menu).changeContextMenuItem('#lock', 'Lock');
$('#optmenu').enableContextMenuItems('#delete');
$(menu).enableContextMenuItems('#delete');
}
if (el.attr('odencd') == 1)
{
$(menu).enableContextMenuItems('#decrypt');
$(menu).disableContextMenuItems('#audio');
}
else
{
$(menu).disableContextMenuItems('#decrypt');
$(menu).enableContextMenuItems('#audio');
}
}
else
{
$('#optmenu').enableContextMenuItems('#delete');
$('#optmenu').disableContextMenuItems('#lock');
$('#optmenu').disableContextMenuItems('#enc');
$('#optmenu').disableContextMenuItems('#new');
$(menu).enableContextMenuItems('#delete');
$(menu).disableContextMenuItems('#lock');
$(menu).disableContextMenuItems('#enc');
$(menu).disableContextMenuItems('#new');
$(menu).disableContextMenuItems('#decrypt');
$(menu).disableContextMenuItems('#audio');
$(menu).disableContextMenuItems('#crop');
}
}
function preparedmenu(el, menu)
{
if (el.attr('noflat') != undefined)
{
if (el.attr('noflat') > 0)
$(menu).changeContextMenuItem('#flat', 'Allow Flatten');
else
$(menu).changeContextMenuItem('#flat',
'Prevent Flatten');
}
}
$(document).ready(function() {
var dir = $('#dir').text();
var menuclick = function(action, el, pos)
{
var file = $(el).parent().prevAll('a.bf').last().attr('file');
@@ -178,7 +284,18 @@ var menuclick = function(action, el, pos)
{
case 'delete':
confirm_action('delete', delete_callback, file,
type, id);
dir, id);
break;
case 'copy':
if (!confirm('Are you sure? Copying recordings takes a long time!'))
break;
// Fallthrough
case 'cut':
$.get('/cgi-bin/browse/clipboard.jim?act=add&mode=' + action +
'&path=' + file, function() {
reloadclipboard();
});
break;
case 'lock':
@@ -197,8 +314,8 @@ var menuclick = function(action, el, pos)
break;
case 'rename':
$('#rename').val(bfile);
$('#renameorig').val(file);
$('#rename').val(decodeURIComponent(bfile));
$('#renameorig').val(decodeURIComponent(file));
$('#titleorig').val('');
$('#renametitle').val('');
@@ -208,7 +325,7 @@ var menuclick = function(action, el, pos)
if (type == 'ts')
{
$.getJSON('/cgi-bin/browse/epgtitle.jim?file=' +
encodeURIComponent(file), epginfo_callback);
file, epginfo_callback);
}
$('#renameform').dialog('open');
@@ -216,7 +333,81 @@ var menuclick = function(action, el, pos)
case 'download':
window.location.href = '/cgi-bin/browse/download.jim?file=' +
encodeURIComponent(file);
file;
break;
case 'crop':
window.location.href = '/cgi-bin/browse/crop.jim?file=' +
file;
break;
case 'decrypt':
window.location.href = '/cgi-bin/browse/decrypt.jim?file=' +
file;
break;
case 'audio':
window.location.href = '/cgi-bin/browse/audio.jim?file=' +
file;
break;
default:
alert('Unhandled action: ' + action);
break;
}
};
var dmenuclick = function(action, el, pos)
{
var direl = $(el).parent().parent();
var file = $(el).parent().prevAll('a.dbf').last().attr('file');
var bfile = file.replace(/.*\//g, '');
bfile = bfile.replace(/[\x00-\x1f]+/g, '');
var results = $(el).parent().next('div.results');
switch (action)
{
case 'delete':
if (confirm('Are you sure you wish to delete "' +
decodeURIComponent(file) +
'" and all files within it?'))
{
$(results)
.html('<img src=/img/loading.gif>' +
'Deleting, please wait...')
.slideDown('slow')
.load('/cgi-bin/browse/delete.jim', {
'dir': dir,
'files': [decodeURIComponent(file)]
}, function() {
$(direl).delay(3000).slideUp(300, function() {
$(direl).remove();
});
});
}
break;
case 'copy':
if (!confirm('Are you sure? Copying directories can take a very long time!'))
break;
// Fallthrough
case 'cut':
$.get('/cgi-bin/browse/clipboard.jim?act=add&mode=' + action +
'&path=' + file, function() {
reloadclipboard();
});
break;
case 'rename':
$('#drename').val(decodeURIComponent(bfile));
$('#drenameorig').val(decodeURIComponent(file));
$('#drenameform').dialog('open');
break;
case 'flat':
var url = '/cgi-bin/browse/flat.jim?file=' + file;
$.get(url, function() { window.location.reload(true); });
break;
default:
@@ -235,6 +426,15 @@ var menuclick = function(action, el, pos)
menuclick
);
$('img.dopt').contextMenu(
{
menu: 'doptmenu',
leftButton: true,
beforeShow: preparedmenu
},
dmenuclick
);
// Disable items which are not yet implemented.
$('#optmenu').disableContextMenuItems('#title');
@@ -259,8 +459,8 @@ var menuclick = function(action, el, pos)
e.preventDefault();
var file = $(this).attr('file');
var type = $(this).attr('type');
var url = '/cgi-bin/browse/file.jim?file=' +
encodeURIComponent(file) + '&type=' + type;
var url = '/cgi-bin/browse/file.jim?file=' + file
+ '&type=' + type;
$('#dialogue').load(url);
$dialog.dialog('open');
});
@@ -278,6 +478,19 @@ var menuclick = function(action, el, pos)
close: function() { $('#rename').val(''); }
});
$('#drenameform').dialog({
autoOpen: false,
height: 'auto', width: 'auto',
modal: true,
buttons: {
"Update": drename_submit,
"Close": function() {
$(this).dialog('close');
}
},
close: function() { $('#drename').val(''); }
});
$('#savestreamform').dialog({
autoOpen: false,
height: 'auto', width: 'auto',
@@ -298,8 +511,6 @@ var menuclick = function(action, el, pos)
show: 'fade', hide: 'fade',
draggable: false, resizable: false
});
var dir = $('#dir').text();
// Load folder sizes
$.getJSON('/cgi-bin/browse/sizes.jim?dir=' + encodeURIComponent(dir),
@@ -309,6 +520,14 @@ var menuclick = function(action, el, pos)
$.getJSON('/cgi-bin/browse/newdir.jim?dir=' + encodeURIComponent(dir),
new_folder_callback);
// Load clipboard
reloadclipboard();
// Uncheck everything
$('input.fs:checked').attr('checked', false);
// Buttons
$('#dedup').button().click(function() {
window.location = '/cgi-bin/dedup.jim?dir='
+ encodeURIComponent(dir);
@@ -321,5 +540,139 @@ var menuclick = function(action, el, pos)
'/cgi-bin/browse/ffmpeg.jim?file=' +
encodeURIComponent($('#save_stream').attr('file')));
});
$('#selectall').click(function(e) {
e.preventDefault();
$('input.fs').attr('checked', true).trigger('change');
});
$('#deselectall').click(function(e) {
e.preventDefault();
$('input.fs:checked').attr('checked', false).trigger('change');
});
$('#join').button().disable()
.click(function() {
var files = new Array();
var els = $('input.fsts:checked + a').each(function() {
files.push($(this).attr('file'));
});
//console.log("%o", files);
window.location.href = '/cgi-bin/browse/join.jim?files=' +
files.join();
});
$('#delete').button().disable()
.click(function() {
var files = new Array();
var els = $('input.fs:checked + a').each(function() {
files.push(decodeURIComponent($(this).attr('file')));
});
//console.log("%o", files);
var str = 'Are you sure you want to delete ' + files.length +
' file';
if (files.length != 1) str += 's';
str += '?';
if (confirm(str))
{
disableall();
$('#deletewait').slideDown('slow');
$('#pwdialogue').dialog({
title: "Deleting",
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/delete.jim', {
'dir': dir,
'files': files
}, function() {
$('#pwdialogue').dialog('close');
window.location.reload(true);
});
}
});
$('#copy,#cut').button().disable()
.click(function() {
var files = new Array();
var els = $('input.fs:checked + a').each(function() {
files.push(decodeURIComponent($(this).attr('file')));
});
//console.log("%o", files);
var action = $(this).attr('id');
if (action == 'copy' && !confirm('Are you sure? ' +
'Copying recordings can take a very long time!'))
return;
$.post('/cgi-bin/browse/clipboard.jim', {
'act': 'add',
'dir': dir,
'mode': action,
'path': files
}, function() {
reloadclipboard();
$('input.fs:checked').attr('checked', false);
});
});
$('#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,
height: 'auto', width: 'auto',
modal: true,
buttons: {
"Create": newdir_submit,
"Cancel": function() {
$(this).dialog('close');
}
},
close: function() { $('#newdirname').val(''); }
});
});
$('input.fs').change(function() {
var num = $('input.fs:checked').size();
if (num > 0)
$('#delete,#cut,#copy').enable();
else
$('#delete,#cut,#copy').disable();
var num = $('input.fsts:checked').size();
if (num > 1)
$('#join').enable();
else
$('#join').disable();
});
});

View File

@@ -0,0 +1,116 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
require clipboard.class ts.class
puts "Content-Type: text/html; no-cache"
puts "Expires: Thu, 01 Jan 1970 00:00:00 GMT"
puts "Pragma: nocache"
puts ""
cgi_input 1
#cgi_dump
set cb [[clipboard new {path "/tmp/webif-browse.cb"}] load]
set action [cgi_get act list]
switch $action {
list {
if {![$cb size]} {
puts "<i>Clipboard is empty</i>"
break
}
puts "<div class=cliplist>"
foreach file [$cb get items] {
set img "page_white_copy"
if {[$file get action] eq "cut"} {
set img "cut"
}
set path [$file get path]
set xpath [cgi_quote_html $path]
puts "<span title=\"$xpath\" alt=\"$xpath\">"
puts "<img src=/img/context/$img.png>"
set dfile [file tail $path]
if {[string length $dfile] > 25} {
set dfile "[string range $dfile 0 22]..."
}
if {[file isdirectory $path]} {
puts "<img height=16
src=/images/711_1_09_Media_Folder.png>"
}
puts [cgi_quote_html $dfile]
puts "<a class=clipdel href=# alt=\"Remove\" title=\"Remove\"
path=\"[cgi_quote_url $path]\">
<img border=0 src=/img/close.png height=16></a>"
puts "</span>"
}
puts "</div>"
puts "<button id=clipclear>Empty clipboard</button>"
}
add {
if {[set path [cgi_get path]] eq "0"} {
puts "No path."
exit
}
set dir [cgi_unquote_input [cgi_get dir]]
set mode [cgi_get mode copy]
foreach p $path {
set p [cgi_unquote_input $p]
if {$dir ne "0" && ![string match "$dir/*" $p]} {
puts "$p not in directory<br>"
continue
}
if {![$cb present $p]} {
$cb add $mode $p
puts "Added $p for $mode<br>"
}
}
$cb save
}
remove {
$cb remove [cgi_unquote_input [cgi_get path]]
$cb save
}
clear {
$cb clear
$cb save
}
paste {
set dir [cgi_unquote_input [cgi_get dir]]
foreach item [$cb get items] {
set path [$item get path]
set file [file tail $path]
set mode [$item get action]
puts "Pasting $file"
if {[file isdirectory $path]} {
# Directory
if {$mode eq "cut"} {
catch {file rename $path "$dir/$file"}
} else {
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]"}
}
}
}
}
$cb clear
$cb save
}
}

View File

@@ -0,0 +1,191 @@
#!/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>
}

View File

@@ -0,0 +1,29 @@
#!/mod/bin/jimsh
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 perc [cgi_get perc 100]
set tsfile [file normalize [cgi_get file]]
set origfile "[file dirname $tsfile]/_original/[file tail $tsfile]"
set newfile [file rootname $tsfile]
if {![file exists $newfile]} {
puts "0"
} else {
set sz [file size $origfile]
set expected $($sz / 100 * $perc)
set nsz [file size $newfile]
set perc [expr $nsz * 100 / $expected]
if {$perc > 100} { set perc 100 }
puts $perc
}

View File

@@ -0,0 +1,133 @@
#!/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>
}

View File

@@ -0,0 +1,23 @@
#!/mod/bin/jimsh
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 tsfile [cgi_get file]
set rfile [file normalize $tsfile]
if {![file exists "$rfile.decrypting"]} {
puts "0"
} else {
set sz [file size $rfile]
set nsz [file size "$rfile.decrypting"]
puts [expr $nsz * 100 / $sz]
}

View File

@@ -1,27 +1,97 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/ts.class
source /mod/var/mongoose/lib/setup
require ts.class pretty_size system.class tdelete
puts "Content-Type: text/html"
puts ""
puts "Content-Type: text/html\r\n"
cgi_input
#cgi_dump
set file [dict get $_cgi file]
set type [dict get $_cgi type]
set dir [cgi_get dir]
if {$type eq "ts"} {
set ts [ts fetch $file]
if {[$ts delete]} {
puts "Successfully deleted $file."
} else {
puts "Problem deleting $file, [$ts get error]"
}
exit
#puts "DIR: ($dir)"
if {[system pkginst undelete]} {
set dustbin [system dustbin]
} else {
set dustbin ""
}
file delete $file
puts "Successfully deleted $file."
proc bindir {file} {
global dustbin
set dir [file dirname $file]
regsub "^[system mediaroot]" $dir $dustbin dir
system mkdir_p $dir
return $dir
}
proc touch {file} {
exec /mod/bin/busybox/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]} {
puts "Error - outside directory."
continue
}
if {[string first $dustbin $file] > -1} {
set ldustbin ""
} else {
set ldustbin $dustbin
}
set done 0
if {[file isdirectory $file]} {
puts -nonewline "Directory..."
if {$ldustbin ne ""} {
set ndir "[bindir $file]/[file tail $file]"
while {[file isdirectory $ndir]} { append ndir "_" }
file rename $file $ndir
touch $ndir
} else {
tdelete $file
}
puts -nonewline "Done..."
set done 1
} elseif {[string match {*.ts} $file]} {
set ts [ts fetch $file]
# Check TS validity
if {![catch {$ts get file}]} {
if {$ldustbin ne ""} {
$ts move [bindir $file] 1
} else {
if {[$ts delete]} {
puts "Successfully deleted $file."
} else {
puts "Problem deleting $file, [$ts get error]"
}
}
set done 1
}
# else treat as normal file.
}
if {!$done} {
if {$ldustbin ne ""} {
set nfile "[bindir $file]/[file tail $file]"
file rename $file $nfile
touch $nfile
} else {
tdelete $file
}
catch {file delete "[file rootname $file].hmi"}
puts -nonewline "Done..."
}
puts "</li>"
}
puts "</ul>"

View File

@@ -10,19 +10,25 @@ require ts.class
cgi_input
#cgi_dump
set file [cgi_get file "/media/My Video/Chuggington/Hodge_and_the_Chugnav.ts"]
set rfile [file normalize $file]
set ts [ts fetch $file]
set file [cgi_get file]
# Default to just downloading the raw file.
set url $file
set mime "video/ts"
# Unless the DLNA option is available.
set dlna [$ts dlnaloc]
if {[llength $dlna]} { lassign $dlna url mime }
if {[string match {*.ts} $file]} {
if {![catch {set ts [ts fetch $file]}]} {
puts "DLNA: $dlna"
# 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]
if {[llength $dlna]} { lassign $dlna url mime }
#puts "DLNA: $dlna"
}
}
}
puts "Content-Type: text/plain"
puts "Refresh: 0; url=$url"

View File

@@ -65,30 +65,43 @@ if {$type eq "ts"} {
<th>Start Time</th>
<td>"
puts [clock format [$ts get start] -format "%c %Z"]
puts "<font class=also>(Scheduled: [
clock format [$ts get schedstart] -format "%c %Z"])</font>"
puts "</td>
</tr><tr>
<th>End Time</th>
<td>"
puts [clock format [$ts get end] -format "%c %Z"]
puts "<font class=also>(Scheduled: [clock format \
[expr [$ts get schedstart] + [$ts get scheddur]] \
-format "%c %Z"])</font>"
puts "</td>
</tr><tr>
<th>Duration</th>
<td>[$ts duration] minute(s).</td>
<td>[$ts duration] minute(s).
<font class=also>(Scheduled: [expr [$ts get scheddur] / 60])
</font></td>
</tr><tr>
<th>Size</th>
<td>$sz</td>
"
set dlna [$ts dlnaloc]
lassign $dlna url
if {[llength $dlna]} {
puts "</tr><tr><th>DLNA&nbsp;URL</th><td>[lindex $dlna 0]</td>"
puts "</tr><tr><th>DLNA&nbsp;URL</th>
<td><a href=\"$url\">$url</a></td>"
}
puts "
</tr><tr>
<th>Flags</th>
<td>[$ts get flags]</td>
</tr>
</table>
"
<td>[$ts get flags]
"
if {[$ts get bookmarks]} {
puts " \[Bookmarks: [$ts get bookmarks]\]"
}
puts "</tr>"
puts "</table>"
exit
}

View File

@@ -0,0 +1,28 @@
#!/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."
}

View File

@@ -0,0 +1,137 @@
#!/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

View File

@@ -0,0 +1,32 @@
#!/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 1
#cgi_dump
set joinstart [clock milliseconds]
set cmd {/mod/bin/nicesplice}
set dst [file rootname [cgi_get dest "joined"]]
foreach file [split [cgi_get files] ","] {
set file [cgi_unquote_input $file]
lappend cmd "-in" [file rootname $file]
set dir [file dirname $file]
}
lappend cmd "-out" "$dir/$dst"
puts "($cmd)"
puts [exec {*}$cmd]
set ts [ts fetch "$dir/$dst.ts"]
$ts settitle $dst
set jointime [expr [expr [clock milliseconds] - $joinstart] / 1000.0]
puts "Time taken: $jointime"

View File

@@ -0,0 +1,23 @@
#!/mod/bin/jimsh
package require cgi
#source /mod/var/mongoose/lib/setup
puts "Content-Type: text/html\r\n\r\n"
cgi_input
#cgi_dump
set expected [cgi_get esize 1]
set file [file normalize [cgi_get file]]
if {![file exists $file]} {
puts "0"
} else {
set sz [file size $file]
set perc [expr $sz * 100 / $expected]
if {$perc > 100} { set perc 100 }
puts $perc
}

View File

@@ -0,0 +1,15 @@
#!/mod/bin/jimsh
package require cgi
puts "Content-Type: text/html"
puts ""
cgi_input
#cgi_dump
set dir [cgi_get dir -]
set name [cgi_get newdirname "New Folder"]
file mkdir "$dir/$name"

View File

@@ -16,11 +16,10 @@ set dir [dict get $_cgi dir]
#9.4G /media/My Video/Archive
#1.4G /media/My Video/CSI_ Crime Scene Investigation
puts "{"
foreach line [split [exec /mod/bin/busybox/du -h "$dir/"] "\n"] {
set fields [split $line "\t"]
set size [lindex $fields 0]
set node [file tail [lindex $fields 1]]
# set node [lindex [split [lindex $fields 1] /] end]
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
puts "\"$node\" : \"$size\","
}

View File

@@ -0,0 +1,17 @@
div.brow
{
float: left;
clear: left;
}
div.cliplist span
{
display: block;
}
#clipclear
{
margin-top: 1em;
}

25
var/mongoose/cgi-bin/cat.jim Executable file
View File

@@ -0,0 +1,25 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
require system.class chunked pretty_size
cgi_input
#cgi_dump
set file [cgi_get file "-"]
if {$file eq "-"} { exit }
start_chunked
if {![file exists $file]} {
chunk ">>> File $file does not exist.\r\n"
} else {
chunk ">>> Contents of $file [pretty_size [file size $file]]\r\n"
set fp [open $file r]
chunk [read $fp]
close $fp
}
end_chunked

View File

@@ -32,17 +32,19 @@ puts "
<th>Frequency</th>
<th>Signal Strength</th>
<th>Signal Quality</th>
<th>Network</th>
<th>Mux</th>
<th>Channels</th>
<th>&gt;799</th>
</tr>
"
foreach tw [$db query {
select tsIdx, usTsID, ulFrequency, ucLevel, ucQuality
from TBL_TS
select tsIdx, szNetName, usTsID, ulFrequency, ucLevel, ucQuality
from TBL_TS join TBL_NET using (netIdx)
order by ulFrequency
}] {
lassign $tw x tsIdx x usTsID x ulFrequency x ucLevel x ucQuality
lassign $tw \
x tsIdx x netName x usTsID x ulFrequency x ucLevel x ucQuality
altrow
puts "
@@ -51,6 +53,7 @@ foreach tw [$db query {
"
puts "<td>[progressbar $ucLevel]</td>"
puts "<td>[progressbar $ucQuality]</td>"
puts "<td>[string range $netName 3 end]</td>"
set channels [$db query {
select usLcn, szSvcName, szPrvName, aucDefaultAuthority
@@ -59,7 +62,7 @@ foreach tw [$db query {
order by usLcn
} $tsIdx]
set mux "???"
set mux "Local"
set ehs 0
foreach chan $channels {
lassign $chan x lcn x name
@@ -72,6 +75,7 @@ foreach tw [$db query {
"ITV3" { set mux "COM4/SDN" }
"Dave" { set mux "COM5/ARQ A" }
"Film4" { set mux "COM6/ARQ B" }
"Movies4Men" { set mux "Local" }
}
}
puts "<td>$mux</td>"

View File

@@ -8,13 +8,8 @@ require altrow
puts "Content-Type: text/html"
puts ""
set databases {
/var/lib/humaxtv/rsvp.db
/var/lib/humaxtv/rsv.db
/var/lib/humaxtv/setup.db
/var/lib/humaxtv/channel.db
/mnt/hd2/dms_cds.db
}
set databases [glob /var/lib/humaxtv/*.db]
lappend databases "/mnt/hd2/dms_cds.db"
header

View File

@@ -40,6 +40,7 @@ foreach file [lsort [glob -nocomplain "$sdir"]] {
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
@@ -74,6 +75,8 @@ foreach file [lsort [glob -nocomplain "$sdir"]] {
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

33
var/mongoose/cgi-bin/diag.jim Executable file
View File

@@ -0,0 +1,33 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/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

View File

@@ -18,18 +18,6 @@ set record [lindex [epg fetch dump -service $service -event $event] 0]
$record get_channel_info
set others [$record othertimes]
puts {
<style type=text/css>
font.also
{
font-size: 0.9em;
font-style: italic;
color: #333;
background: transparent;
}
</style>
}
puts "
<table class=keyval>
<tr>

View File

@@ -79,7 +79,8 @@ if {[llength $pkgs] > 0} {
"
foreach pkg $pkgs {
if {$filter && ![dict exists $::pkgmeta $pkg]} { continue }
if {$type ne "upgr" && $filter && \
![dict exists $::pkgmeta $pkg]} { continue }
pkgrow [pkg load $pkg]
}
puts "</table>"
@@ -90,7 +91,7 @@ if {[llength $pkgs] > 0} {
puts "<i>No packages "
switch $type {
inst { puts "are installed." }
upgr { puts "are available for upgrade." }
upgr { puts "are available for upgrade; try updating the package list from the Internet using the button above." }
avail { puts "are available for installation." }
}
puts "</i>"

View File

@@ -8,6 +8,12 @@ puts "Content-Type: text/html"
puts ""
cgi_input
if {[cgi_get act] eq "cancel"} {
file delete /tmp/.restartpending
exit
}
if {[cgi_get now] eq "yes"} {
# - Busybox reboot does sync the disk but may still not be clean enough.
puts "Restarting."

View File

@@ -17,12 +17,23 @@ set event [rsv slot $table $slot]
set rsvicon [$event icon]
if {$rsvicon ne ""} {
set rsvicon "<img src='images/$rsvicon' height=20>
set rsvicon "<img src='images/$rsvicon' height=20>"
if {[$event get ersvtype] == 3} {
if {[$event padded]} {
set padding "<- [expr [$event get ulPreOffset] / 60], [expr [$event get ulPostOffset] / 60] ->"
append rsvicon \
"<img src=/img/pad.png height=20
title=\"$padding\" alt=\"$padding\">"
} else {
append rsvicon \
"<img src=/img/ar.png height=20>"
}
}
}
set RKIcon [$event RKIcon]
if {$RKIcon ne ""} {
set RKIcon "<img src='images/$RKIcon' height=20>
set RKIcon "<img src='images/$RKIcon' height=20>"
}
if {[$event get ucRecKind] == 4} {
@@ -115,7 +126,7 @@ foreach ev [split [$event get szEventToRecord] "|"] {
}
puts "</td></tr>"
puts "<tr><th>Accepted</th><td>"
if {[$event get aulEventToRecordInfo] != ""} {
if {[$event get aulEventToRecordInfo] ne ""} {
puts "Yes"
}
puts "</td></tr>"

View File

@@ -58,6 +58,34 @@ if {[dict exists $_cgi pkgdevoff] && ![dict exists $_cgi pkgdev]} {
}
handle_int_update pkgdev $pkgdev "Development Package Display"
set acluser [cgi_get acluser "-"]
set aclpass [cgi_get aclpass "-"]
set aclpassc [cgi_get aclpassc "-"]
if {$acluser ne "-" && $aclpass ne "-"} {
if {![string length $acluser]} {
puts "No username provided."
exit
}
if {$aclpass ne $aclpassc} {
puts "Passwords do not match."
exit
}
if {[string length $aclpass] < 4} {
puts "Password is too short (< 4 characters)"
exit
}
puts [$settings addacluser $acluser $aclpass]
exit
}
set aclact [cgi_get aclact "-"]
if {$aclact ne "-" && $acluser ne "-"} {
switch $aclact {
"del" { puts [$settings delacluser $acluser] }
}
exit
}
header
puts {
@@ -194,6 +222,100 @@ puts "
puts "
</table>
</fieldset>
"
puts "
<br><br>
<fieldset style=\"display: inline\">
<legend> Web Interface User Access Control </legend>
<table>
"
set aclusers [$settings aclusers]
if {[llength $aclusers]} {
puts "<tr><th colspan=5 class=odd>Existing Users</th></tr>"
foreach user [$settings aclusers] {
lassign $user user
puts "<tr><td align=center style=\"font-weight: bold\">
$user</td>"
puts "<th class=key>New password:
<input
class=\"aclpass text ui-widget-content ui-corner-all\"
type=password size=20 maxlength=50><br>"
puts "Again:
<input
class=\"aclpassc text ui-widget-content ui-corner-all\"
type=password size=20 maxlength=50></td>"
puts "<th class=key><button class=pwchange>
Change</button></td>"
puts "<th class=key><button class=userdel>
Delete User</button></td>"
puts "</tr>"
}
puts "<tr><td colspan=5 id=aclusermod_output>&nbsp;</td></tr>"
puts "<tr><td colspan=5>&nbsp;</td></tr>"
} else {
puts "<tr><td colspan=5 class=blood><b>
Add a user to enable authentication.</b></td></tr>"
}
puts "<tr><th colspan=5 class=odd>Add New User</th></tr>"
puts "
<form id=aclnewuser method=get action=$env(REQUEST_URI)>
<tr><th class=key>New User:</th><td>
<input
class=\"text ui-widget-content ui-corner-all\"
id=acluser name=acluser size=20 maxlength=50></td></tr>
<tr><th class=key>Password:</th><td>
<input type=password
class=\"text ui-widget-content ui-corner-all\"
id=aclpass name=aclpass size=20 maxlength=50></td></tr>
<tr><th class=key>Password (confirm):</th><td>
<input type=password
class=\"text ui-widget-content ui-corner-all\"
id=aclpassc name=aclpassc size=20 maxlength=50></td></tr>
<tr><td><input id=aclnewuser_submit value=\"Add User\" type=submit>
</td></tr>
</form>
</table>
<div id=aclnewuser_output></div>
</fieldset>
"
puts {
<script type=text/javascript>
$('#aclnewuser').ajaxForm({
target: '#aclnewuser_output',
success: function(txt) {
if (txt.indexOf('Success') >= 0)
window.location.reload(true);
}
});
$('button.userdel').click(function(el) {
var user = $('td:first', $(this).parents('tr')).text().trim();
$('#aclusermod_output').load(
'/cgi-bin/settings.jim?aclact=del&acluser=' +
encodeURIComponent(user), function(txt) {
if (txt.indexOf('Success') >= 0)
window.location.reload(true);
});
});
$('button.pwchange').click(function(el) {
var tr = $(this).parents('tr');
var user = $('td:first', $(tr)).text().trim();
var pass = $(tr).find('input.aclpass').val();
var passc = $(tr).find('input.aclpassc').val();
$('#aclusermod_output').load('/cgi-bin/settings.jim?' +
'acluser=' + encodeURIComponent(user) + '&' +
'aclpass=' + encodeURIComponent(pass) + '&' +
'aclpassc=' + encodeURIComponent(passc));
});
</script>
}
puts "
<br><br>
<fieldset style=\"display: inline\">
<legend> Advanced Settings </legend>

View File

@@ -0,0 +1,48 @@
.jbar{
height:50px;
width:100%;
background-color: #ffffcc;
color: #ff4000;
position:fixed;
filter:progid:DXImageTransform.Microsoft.Alpha(opacity=95);
opacity: 0.95;
-moz-opacity: 0.95;
text-align:center;
left:0px;
z-index:9999999;
margin:0px;
padding:0px;
}
.jbar-top{
top:0px;
border-top:2px solid #fff;
border-bottom: 1px solid #ebebeb;
}
.jbar-bottom{
bottom:0px;
border-bottom:2px solid #fff;
border-top: 1px solid #ebebeb;
color:#777;
}
.jbar-content{
line-height:46px;
font-size: 18px;
font-family:'Lucida Grande',sans-serif;
}
a.jbar-cross{
position:absolute;
width:31px;
height:31px;
background:transparent url(/images/cross.png) no-repeat top left;
cursor:pointer;
right:10px;
}
a.jbar-cross:hover{
background-image: url(/images/cross_hover.png)
}
.jbar-top a.jbar-cross{
top:8px;
}
.jbar-bottom a.jbar-cross{
bottom:8px;
}

View File

@@ -54,9 +54,15 @@
classes to the respective LI element(s)
*/
.contextMenu LI.edit A { background-image: url(images/page_white_edit.png); }
.contextMenu LI.cut A { background-image: url(images/cut.png); }
.contextMenu LI.copy A { background-image: url(images/page_white_copy.png); }
.contextMenu LI.paste A { background-image: url(images/page_white_paste.png); }
.contextMenu LI.delete A { background-image: url(images/page_white_delete.png); }
.contextMenu LI.quit A { background-image: url(images/door.png); }
.contextMenu LI.pwedit A { background-image: url(/img/context/page_white_edit.png); }
.contextMenu LI.pwcopy A { background-image: url(/img/context/page_white_copy.png); }
.contextMenu LI.pwpaste A { background-image: url(/img/context/page_white_paste.png); }
.contextMenu LI.pwdelete A { background-image: url(/img/context/page_white_delete.png); }
.contextMenu LI.edit A { background-image: url(/img/context/edit.png); }
.contextMenu LI.copy A { background-image: url(/img/context/copy.png); }
.contextMenu LI.paste A { background-image: url(/img/context/paste.png); }
.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); }

View File

@@ -13,6 +13,19 @@ html>body
font-size: small;
}
.left, .cleft
{
float: left;
}
.cleft
{
clear: left;
}
fieldset.left, fieldset.cleft
{
display: inline;
}
div.container
{
position: relative;
@@ -82,6 +95,12 @@ table.borders, table.borders td, table.borders th
color: black;
}
.hover
{
background: #f6ff5b;
color: black;
}
table td,table th
{
font-size: small;
@@ -258,3 +277,49 @@ input.text
background-color: yellow;
}
.focused
{
border: 2px solid red;
}
div.cut, div.keep
{
position: absolute;
top: 0px;
text-align: center;
overflow: hidden;
border-radius: 5px;
-moz-border-radius: 5px;
}
div.keep
{
background: green;
color: white;
}
div.cut
{
background: #ff4000;
color: black;
}
.ui-button-text
{
font-size: inherit !important;
}
.ui-button, .ui-button-text
{
padding: 0;
font-size: 12px;
}
font.also
{
font-size: 0.9em;
font-style: italic;
color: #333;
background: transparent;
}

View File

@@ -10,6 +10,16 @@ table.tablesorter .header {
height: auto;
}
table.tablesorter .headerplain {
background-image: url(/img/tsort/bgplain.png);
background-repeat: no-repeat;
border-left: 1px solid #FFF;
border-right: 1px solid #000;
border-top: 1px solid #FFF;
padding-top: 8px;
height: auto;
}
table.tablesorter .headerSortUp {
background-image: url(/img/tsort/asc.png);
background-repeat: no-repeat;

View File

@@ -0,0 +1,38 @@
<!--#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" -->

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@@ -0,0 +1 @@
Channel 5 +1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

View File

@@ -0,0 +1 @@
Channel 5 +1.png

View File

@@ -0,0 +1 @@
blank.png

View File

@@ -0,0 +1 @@
blank.png

View File

@@ -0,0 +1 @@
blank.png

View File

@@ -1 +0,0 @@
blank.png

Before

Width:  |  Height:  |  Size: 9 B

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9 B

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 648 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 431 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 412 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 814 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 309 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 618 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 620 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 511 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 761 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 609 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -65,7 +65,7 @@ $(document).ready(function() {
<div style="float: left">
<center>
<a href=/services.shtml>
<img src=/img/spanner.jpg border=0 width=217 height=228>
<img src=/img/spanner.png border=0 width=217 height=228>
</a>
<br>
<a href=/services.shtml>
@@ -78,7 +78,7 @@ $(document).ready(function() {
<div style="float: left">
<center>
<a href=/pkg.shtml>
<img src=/img/packages.jpg border=0 width=217 height=228>
<img src=/img/packages.png border=0 width=217 height=228>
</a>
<br>
<a href=/pkg.shtml>
@@ -111,6 +111,14 @@ $(document).ready(function() {
<div class=footer>
<ul>
<li>
Release Notes:
<a target=_blank
href="http://wiki.hummy.tv/wiki/Customised_Firmware_Release_Notes">
Firmware</a> |
<a target=_blank href="http://wiki.hummy.tv/wiki/Webif_release_notes">Webif</a>
</li><li>
<a href=/diag.shtml>Diagnostics</a>
</li><li>
<a href=/cgi-bin/channel.jim>Channel Information</a>
</li><li>
<a href=/cgi-bin/db.jim target=_blank>SQLite3 Database Dump</a>

View File

@@ -0,0 +1,53 @@
(function($) {
$.fn.bar = function(options) {
var opts = $.extend({}, $.fn.bar.defaults, options);
return this.each(function() {
$this = $(this);
var o = $.meta ? $.extend({}, opts, $this.data()) : opts;
// $this.click(function(e){
if(!$('.jbar').length){
timeout = setTimeout('$.fn.bar.removebar()',o.time);
var _message_span = $(document.createElement('span')).addClass('jbar-content').html(o.message);
_message_span.css({"color" : o.color});
var _wrap_bar;
(o.position == 'bottom') ?
_wrap_bar = $(document.createElement('div')).addClass('jbar jbar-bottom'):
_wrap_bar = $(document.createElement('div')).addClass('jbar jbar-top') ;
_wrap_bar.css({"background-color" : o.background_color});
if(o.removebutton){
var _remove_cross = $(document.createElement('a')).addClass('jbar-cross');
_remove_cross.click(function(e){$.fn.bar.removebar();})
}
else{
_wrap_bar.css({"cursor" : "pointer"});
_wrap_bar.click(function(e){$.fn.bar.removebar();})
}
_wrap_bar.append(_message_span).append(_remove_cross).hide().insertBefore($('.content')).fadeIn('fast');
}
// })
});
};
var timeout;
$.fn.bar.removebar = function(txt) {
if($('.jbar').length){
clearTimeout(timeout);
$('.jbar').fadeOut('fast',function(){
$(this).remove();
});
}
};
$.fn.bar.defaults = {
background_color : '#FFFFFF',
color : '#000',
position : 'top',
removebutton : true,
time : 5000
};
})(jQuery);

View File

@@ -0,0 +1,70 @@
/*
* Content-Type:text/javascript
*
* A bridge between iPad and iPhone touch events and jquery draggable,
* sortable etc. mouse interactions.
* @author Oleg Slobodskoi
*
* modified by John Hardy to use with any touch device
* fixed breakage caused by jquery.ui so that mouseHandled internal flag is reset
* before each touchStart event
*
*/
(function( $ ) {
$.support.touch = typeof Touch === 'object';
if (!$.support.touch) {
return;
}
var proto = $.ui.mouse.prototype,
_mouseInit = proto._mouseInit;
$.extend( proto, {
_mouseInit: function() {
this.element
.bind( "touchstart." + this.widgetName, $.proxy( this, "_touchStart" ) );
_mouseInit.apply( this, arguments );
},
_touchStart: function( event ) {
if ( event.originalEvent.targetTouches.length != 1 ) {
return false;
}
this.element
.bind( "touchmove." + this.widgetName, $.proxy( this, "_touchMove" ) )
.bind( "touchend." + this.widgetName, $.proxy( this, "_touchEnd" ) );
this._modifyEvent( event );
$( document ).trigger($.Event("mouseup")); //reset mouseHandled flag in ui.mouse
this._mouseDown( event );
return false;
},
_touchMove: function( event ) {
this._modifyEvent( event );
this._mouseMove( event );
},
_touchEnd: function( event ) {
this.element
.unbind( "touchmove." + this.widgetName )
.unbind( "touchend." + this.widgetName );
this._mouseUp( event );
},
_modifyEvent: function( event ) {
event.which = 1;
var target = event.originalEvent.targetTouches[0];
event.pageX = target.clientX;
event.pageY = target.clientY;
}
});
})( jQuery );

View File

@@ -8,8 +8,8 @@ source /mod/var/mongoose/include/model.jim
puts {
</title>
<link rel="shortcut icon" href=/img/favicon.ico />
<link href=/css/style.css rel=stylesheet type=text/css />
<link type="text/css" href="/css/jquery-ui.css" rel="Stylesheet" />
<link href=/css/style.css rel=stylesheet type=text/css />
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="/js/jquery-ui.js"></script>
</head>

View File

@@ -5,8 +5,8 @@
<meta http-equiv="expires" value="Thu, 01 Jan 1970 00:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />
<link rel="shortcut icon" href=/img/favicon.ico />
<link href=/css/style.css rel=stylesheet type=text/css />
<link type="text/css" href="/css/jquery-ui.css" rel="Stylesheet" />
<link href=/css/style.css rel=stylesheet type=text/css />
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="/js/jquery-ui.js"></script>
</head>

View File

@@ -146,13 +146,13 @@ $(document).ready(function() {
<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=inst>
<span>Installed</span>
</a>
</li><li>
<a href=/cgi-bin/pkg.jim?type=avail>
<span>Available</span>

View File

@@ -0,0 +1,14 @@
#!/mod/bin/jimsh
source /mod/var/mongoose/lib/setup
require pretty_size
foreach file [concat \
[glob -nocomplain /var/log/*.log] \
[glob -nocomplain /mod/tmp/*.log] \
] {
puts "<a href=# class=log file=\"$file\">
<img border=0 height=14 src=/images/421_1_00_CH_Title_2R_Arrow.png>
[file tail $file]</a> ([pretty_size [file size $file]]) <br>"
}

View File

@@ -25,17 +25,23 @@ if {[system busy]} {
}
puts {
<small><button id=restart_cancel>Hide</button></small>
</font>
</div>
<div style="width: 60%; height: 0.7em; margin-bottom: 2em;
background: url(/img/stripes.gif) repeat-x;"></div>
</center>
<script type=text/javascript>
$('#restart_humaxtv').button();
$('#restart_humaxtv').click(function() {
$('#restart_humaxtv').button()
.click(function() {
if (confirm('Are you sure you wish to perform a restart now?'))
window.location = '/cgi-bin/restart.jim';
});
$('#restart_cancel').button()
.click(function() {
$.get('/cgi-bin/restart.jim?act=cancel');
$('#restart_block').slideUp('slow');
});
</script>
}

View File

@@ -38,6 +38,8 @@ $(document).ready(function() {
7: { sorter: false }
}
});
$('table.tablesorter thead th').filter('[class!=header]')
.addClass('headerplain');
});
$(document).ready(function() {
@@ -87,6 +89,10 @@ $(document).ready(function() {
$dialog.dialog('open');
}
$('a.schedule').click(function(e) { schedpopup(e, $(this)) });
$('table.tablesorter tbody tr').hover(
function() { $(this).addClass('hover'); },
function() { $(this).removeClass('hover'); });
});
</script>
}
@@ -133,17 +139,29 @@ proc eventrow {event {table TBL_RESERVATION}} {
}
if {$rsvicon ne ""} {
set rsvicon "<img src='/images/$rsvicon' height=20>
set rsvicon "<img src='/images/$rsvicon' height=20>"
if {[$event get ersvtype] == 3} {
if {[$event padded]} {
set padding "<- [expr [$event get ulPreOffset] / 60], [expr [$event get ulPostOffset] / 60] ->"
append rsvicon \
"<img src=/img/pad.png height=20
title=\"$padding\" alt=\"$padding\">"
} else {
append rsvicon \
"<img src=/img/ar.png height=20>"
}
}
}
if {$RKIcon ne ""} {
set RKIcon "<img src='/images/$RKIcon' height=20>
set RKIcon "<img src='/images/$RKIcon' height=20>"
}
if {$table eq "pending"} {
if {[$event get action] == 0} {
set icon "add"
} else {
set icon "close"
switch [$event get action] {
0 { set icon "add" }
1 { set icon "close" }
2 { set icon "ar" }
3 { set icon "pad" }
}
puts "<td align=center>
<img class=va width=30 src=/img/$icon.png></td>"
@@ -196,14 +214,13 @@ proc eventrow {event {table TBL_RESERVATION}} {
puts "[clock format [$event get nduration] -format %T]</td>"
}
puts "<td nowrap>$rsvicon $RKIcon</td>"
puts "<td nowrap>$rsvicon $RKIcon</td><td>"
if {[$event get aulEventToRecordInfo] != ""} {
puts "<td><img src=/img/lightning.png
puts "<img src=/img/lightning.png
alt=\"Accepted by Humax\"
title=\"Accepted by Humax\"></td>"
} else {
puts "<td>&nbsp;</td>"
title=\"Accepted by Humax\">"
}
puts "</td>";
puts "</tr>"
}

View File

@@ -1,5 +1,5 @@
if {[expr ! [exists -proc altrow ]]} {
if {![exists -proc altrow]} {
proc altrow {} {{i 0}} {
if { $i == 0 } {
puts "<tr class=odd>"

View File

@@ -1,7 +1,7 @@
if {[expr ! [exists -proc cat ]]} {
if {![exists -proc cat]} {
proc cat {file} {
if {[catch {set fp [open $file r]]}} { return }
if {[catch {set fp [open $file r}]} { return }
puts [read $fp]
close $fp
}

View File

@@ -0,0 +1,9 @@
if {![exists -proc classdump]} {
proc classdump {o} {
foreach var [$o vars] {
puts [format {%20s %s} $var [$o get $var]]
}
}
}

View File

@@ -0,0 +1,87 @@
if {![exists -proc class]} { package require oo }
class clipboard {
path "/tmp/webif.cb"
items {}
}
class clipboarditem {
action ""
path ""
}
clipboarditem method _parse {line} {
lassign [split $line "|"] action path
}
proc {clipboarditem load} {line} {
set c [clipboarditem new]
$c _parse $line
return $c
}
clipboard method save {} {
set fd [open $path w]
foreach item $items {
puts $fd "[$item get action]|[$item get path]"
}
$fd close
}
clipboard method load {} {
set items {}
set changed 0
if {[file exists $path]} {
set fd [open $path r]
foreach line [split [$fd read] "\n"] {
set ci [clipboarditem load $line]
if {[file exists [$ci get path]]} {
lappend items $ci
} else {
set changed 1
}
}
}
if {$changed} { $self save }
return $self
}
clipboard method present {xfile} {
foreach item $items {
if {[$item get path] eq $xfile} {
return 1
}
}
return 0
}
clipboard method index {xfile} {
set index -1
foreach item $items {
incr index
if {[$item get path] eq $xfile} {
return $index
}
}
return -1
}
clipboard method clear {} {
set items {}
}
clipboard method size {} {
return [llength $items]
}
clipboard method add {xaction xpath} {
lappend items [clipboarditem load "$xaction|$xpath"]
}
clipboard method remove {xpath} {
set index [$self index $xpath]
if {$index < 0} { return }
set items [lreplace $items $index $index]
}

View File

@@ -1,7 +1,7 @@
source /mod/var/mongoose/lib/setup
if {![exists -proc class ]} { package require oo }
if {![exists -proc sqlite3.open ]} { package require sqlite3 }
if {![exists -proc class]} { package require oo }
if {![exists -proc sqlite3.open]} { package require sqlite3 }
require settings.class progressbar rsv.class
@@ -257,6 +257,17 @@ epg method next {} {
}
}
epg method previous {} {
set tm $($start - 60)
set prevlist [epg fetch dump -service $service_id -time $tm]
if {[llength prevlist] > 0} {
return [lindex $prevlist 0]
} else {
return ""
}
}
epg method recommended {} {
set rec ""
if {$rec_crid ne ""} {

8
var/mongoose/lib/escape Normal file
View File

@@ -0,0 +1,8 @@
if {![exists -proc escape]} {
proc escape {str} {
regsub -all -- {"} "$str" "\\\"" str
return $str
}
}

View File

@@ -1,5 +1,5 @@
if {[expr ! [exists -proc class ]]} { package require oo }
if {![exists -proc class]} { package require oo }
class pkg {
name ""
@@ -12,8 +12,10 @@ set ::pkgmeta {}
pkg method _load {nm} {
set name $nm
set info [join [split [exec /bin/opkg list $nm] "\n"] " "]
regexp {^([^ ]+) - ([^ ]+) - (.*)$} $info full xname latest descr
foreach line [split [exec /bin/opkg list $nm] "\n"] {
# betaftpd - 0.0.8pre17-1 - Description...
regexp {^[^ ]+ - ([^ ]+) - (.*)$} $line x latest descr
}
set info [exec /bin/opkg list-installed $nm]
regexp {^([^ ]+) - ([^ ]+)$} $info full xname installed

View File

@@ -1,5 +1,5 @@
if {[expr ! [exists -proc pretty_size ]]} {
if {![exists -proc pretty_size]} {
proc pretty_size {size} {
set units {bytes KiB MiB GiB TiB}

View File

@@ -1,5 +1,5 @@
if {[expr ! [exists -proc progressbar ]]} {
if {![exists -proc progressbar]} {
proc progressbar {percent} {
set pos [expr 118 - $percent / 100.0 * 118]
return "<img src=/img/percentimage.png

View File

@@ -1,7 +1,7 @@
source /mod/var/mongoose/lib/setup
if {![exists -proc class ]} { package require oo }
if {![exists -proc sqlite3.open ]} { package require sqlite3 }
if {![exists -proc class]} { package require oo }
if {![exists -proc sqlite3.open]} { package require sqlite3 }
require settings.class system.class
set rsvdb [sqlite3.open /var/lib/humaxtv/rsv.db]
@@ -54,6 +54,17 @@ class rsv {
action 0
}
rsv method aul {} {
if {![exists -proc binary]} { package require binary }
set aul {}
for {set i 0} {$i < [string length $aulEventToRecordInfo]} {incr i 16} {
binary scan [string range $aulEventToRecordInfo $i $($i + 15)] \
iiii service start end event_id
lappend aul [list $service $start $end $event_id]
}
return $aul
}
rsv method clear_ulslot {} {
set ulslot -1
}
@@ -65,6 +76,9 @@ rsv method name {} {
}
if {$name == ""} {
switch $ersvtype {
1 { set name "--- Unnamed reminder ---" }
2 { set name "--- Unnamed reminder ---" }
3 { set name "--- Unnamed recording ---" }
5 { set name "--- Wake-up ---" }
6 { set name "--- Sleep ---" }
7 { set name "--- Auto Update ---" }
@@ -122,6 +136,16 @@ rsv method set_delete {} {
set action 1
}
rsv method set_unpad {} {
set action 2
}
rsv method set_pad {{pre 60} {post 60}} {
set action 3
set ulPreOffset $pre
set ulPostOffset $post
}
rsv method remove_pending {} {
$::rsvdb query "delete from pending where ulslot = $ulslot"
}
@@ -335,6 +359,11 @@ proc {rsv construct} {event type} {
set ccrid [$event get channel_crid]
# Fallback from series to event if there is no series CRID.
if {$type == 2 && [$event get series_crid] eq ""} {
set type 1
}
if {$type == 1} {
# Event
set args(ucCRIDType) 49

View File

@@ -1,6 +1,6 @@
if {![exists -proc class ]} { package require oo }
if {![exists -proc sqlite3.open ]} { package require sqlite3 }
if {![exists -proc class]} { package require oo }
if {![exists -proc sqlite3.open]} { package require sqlite3 }
if {![file exists /mod/etc/webif.db]} {
set settingsdb [sqlite3.open /mod/etc/webif.db]
@@ -116,6 +116,10 @@ settings method pkgdev {{val -1}} {
return [$self _nval_setting pkgdev $val]
}
settings method sortorder {{val -1}} {
return [$self _nval_setting sortorder $val]
}
settings method channel_groups {} {
set ret ""
set db [sqlite3.open /var/lib/humaxtv/setup.db]
@@ -135,3 +139,76 @@ settings method channel_groups {} {
return $ret
}
settings method aclusers {} {
if {![file exists "/mod/etc/htpasswd"]} { return {} }
set fd [open "/mod/etc/htpasswd" r]
set users {}
foreach line [string trim [split [read $fd] "\n"]] {
set info [split $line ":"]
if {[llength $info] != 3} { continue }
lappend users $info
}
$fd close
return $users
}
settings method mongooseauth {{mode 1}} {
set fd [open "/mod/etc/mongoose.conf" r]
set fdnew [open "/mod/etc/mongoose.conf.new" w]
foreach line [string trim [split [read $fd] "\n"]] {
if {[string match -nocase {authentication_domain*} $line]} {
continue
}
if {[string match -nocase {global_passwords_file*} $line]} {
continue
}
if {$line ne ""} { puts $fdnew $line }
}
$fd close
if {$mode} {
puts $fdnew "authentication_domain webif"
puts $fdnew "global_passwords_file /mod/etc/htpasswd"
}
$fdnew close
file delete "/mod/etc/mongoose.conf"
file rename "/mod/etc/mongoose.conf.new" "/mod/etc/mongoose.conf"
}
settings method addacluser {user pass} {
set msg ""
if {![llength [$self aclusers]]} {
$self mongooseauth 1
append msg "Enabled web server authentication<br>"
}
set cmd "/mod/sbin/mongoose -A /mod/etc/htpasswd webif $user $pass"
exec {*}$cmd
append msg "Successfully updated user $user"
return $msg
}
settings method delacluser {user} {
if {![file exists "/mod/etc/htpasswd"]} { return }
set fd [open "/mod/etc/htpasswd" r]
set fdnew [open "/mod/etc/htpasswd.new" w]
set num 0
foreach line [string trim [split [read $fd] "\n"]] {
lassign [split $line ":"] xuser
if {$xuser eq $user} { continue }
if {$line ne ""} {
puts $fdnew $line
incr num
}
}
$fd close
$fdnew close
file delete "/mod/etc/htpasswd"
file rename "/mod/etc/htpasswd.new" "/mod/etc/htpasswd"
set msg "Successfully removed user $user"
if {$num == 0} {
$self mongooseauth 0
append msg "<br>Disabled web server authentication<br>"
}
return $msg
}

View File

@@ -1,6 +1,6 @@
if {![exists -proc class ]} { package require oo }
if {![exists -proc sqlite3.open ]} { package require sqlite3 }
if {![exists -proc class]} { package require oo }
if {![exists -proc sqlite3.open]} { package require sqlite3 }
class system {}
@@ -21,13 +21,14 @@ proc {system hostname} {} {
return $hostname
}
proc {system modversion} {} {
proc {system modversion} {{short 0}} {
if {[catch {set fp [open /etc/modversion r]}]} {
set modver "1.02"
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]
}
@@ -36,6 +37,29 @@ proc {system pkgver} {{pkg webif}} {
return [lrange [split [exec opkg list-installed $pkg] " "] 2 end]
}
proc {system pkginst} {pkg} {
if {[exec opkg list-installed $pkg] ne ""} {
return 1 } else { 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 }
@@ -61,7 +85,9 @@ proc {system diskspace} {} {
proc {system busy} {} {
# Is humaxtv doing anything important?
set pid [exec /mod/bin/busybox/pgrep humaxtv]
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 }
@@ -100,3 +126,7 @@ proc {system padding} {} {
return [list $start $stop]
}
proc {system mkdir_p} {dir} {
exec /mod/bin/busybox/mkdir -p $dir
}

19
var/mongoose/lib/tdelete Normal file
View File

@@ -0,0 +1,19 @@
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
}
}
}

View File

@@ -1,5 +1,7 @@
if {![exists -proc class ]} { package require oo }
if {![exists -proc class]} { package require oo }
source /mod/var/mongoose/lib/setup
require tdelete
set dmsfile /mnt/hd2/dms_cds.db
@@ -16,10 +18,15 @@ class ts {
flags ""
error ""
guidance ""
bookmarks 0
schedstart 0
scheddur 0
}
ts method duration {} {
return [expr [expr $end - $start] / 60]
ts method duration {{raw 0}} {
set d [expr $end - $start]
if {!$raw} { set d $($d / 60) }
return $d
}
ts method size {} {
@@ -30,15 +37,15 @@ ts method size {} {
ts method _parse {line} {
set vars [split $line "\t"]
set title [lindex $vars 0]
set synopsis [lindex $vars 1]
set definition [lindex $vars 2]
set channel_num [lindex $vars 3]
set channel_name [lindex $vars 4]
set start [lindex $vars 5]
set end [lindex $vars 6]
set flags [split [string range [lindex $vars 7] 0 end-1] ,]
set guidance [lindex $vars 8]
lassign [split $line "\t"] \
title synopsis definition channel_num channel_name \
start end flags_list guidance bookmarks schedstart scheddur
set flags [split [string range $flags_list 0 end-1] ,]
}
ts method bookmarks {} {
return [exec /mod/bin/hmt -bookmarks $file]
}
ts method flag {f} {
@@ -113,10 +120,36 @@ proc {ts fetch} {file {checked 0}} {
}
ts method delete {} {
# Extract file basename
foreach f [glob -nocomplain "[file rootname $file].*"] {
set root [file rootname $file]
# 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}.*"] {
tdelete $f
puts "Removed $f<br>"
file delete $f
}
return 1
}
ts method move {dst {touch 0}} {
set root [file rootname $file]
regsub -all {([\\["$])} $root {\\\1} root
foreach f [glob -nocomplain "${root}.*"] {
set nf "$dst/[file tail $f]"
file rename $f $nf
if {$touch} {
exec /mod/bin/busybox/touch $nf
}
}
return 1
}
ts method copy {dst} {
set root [file rootname $file]
regsub -all {([\\["$])} $root {\\\1} root
foreach f [glob -nocomplain "${root}.*"] {
file copy $f "$dst/[file tail $f]"
}
return 1
}
@@ -164,5 +197,22 @@ proc {ts renamegroup} {from to} {
#puts "rename $f \"${dir}/${to}${ext}\""
file rename $f "${dir}/${to}${ext}"
}
exec /mod/bin/hmt "+setfilename=$to" "${dir}/${to}.hmt"
set ndir [file normalize $dir]
if {![catch {set db [sqlite3.open $::dmsfile]}]} {
set x [lindex [$db query {select mediaid from tblMedia
where localUrl = '%s'} [file normalize $from]] 0]
lassign $x key mediaid
if {$mediaid ne ""} {
$db query {update tblMedia set localUrl = '%s'
where mediaid = %s} "${ndir}/{$to}.ts" $mediaid
$db query {update tblMedia set title = '%s'
where mediaid = %s} "{$to}.ts" $mediaid
}
$db close
}
}