Compare commits
54 Commits
1.0.10@214
...
1.0.16@214
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea03a67b4a | ||
|
|
3adbeb987a | ||
|
|
23fdc62b81 | ||
|
|
b88691c9e5 | ||
|
|
3c4b907091 | ||
|
|
1c00e63f48 | ||
|
|
59006ff474 | ||
|
|
616c0afff1 | ||
|
|
84899871e1 | ||
|
|
ed042ee230 | ||
|
|
3c44ec33f9 | ||
|
|
02d7bc3f33 | ||
|
|
492b37be41 | ||
|
|
c237f228a8 | ||
|
|
7a523a9ddb | ||
|
|
972366de14 | ||
|
|
aeb96c2c8a | ||
|
|
68f98c8a65 | ||
|
|
61b09db04b | ||
|
|
de2035e1e0 | ||
|
|
b4bd45566e | ||
|
|
692488a11f | ||
|
|
bd27200ba8 | ||
|
|
7e30a4272e | ||
|
|
945007f73d | ||
|
|
fc9c912f99 | ||
|
|
bf67161898 | ||
|
|
f029ab1ce6 | ||
|
|
bfd099a82e | ||
|
|
d9a284994e | ||
|
|
e6df0ae3af | ||
|
|
e14ccce2cc | ||
|
|
60111cd8b1 | ||
|
|
fb81a7e954 | ||
|
|
218221c069 | ||
|
|
a001241c5d | ||
|
|
a8a9f041f0 | ||
|
|
67df756156 | ||
|
|
a73afaf951 | ||
|
|
fe439ec25a | ||
|
|
2fa55d3c90 | ||
|
|
c76e6638a4 | ||
|
|
cd3cbf186c | ||
|
|
38956e2669 | ||
|
|
62a13e18cc | ||
|
|
52d05a7f48 | ||
|
|
612a61a5b1 | ||
|
|
17ba0bb00e | ||
|
|
5f473c9e72 | ||
|
|
e0ac834c78 | ||
|
|
604ac65172 | ||
|
|
dad2a630c7 | ||
|
|
2bf876262f | ||
|
|
972eab191c |
@@ -1,6 +1,6 @@
|
||||
var/mongoose/html/css/EXTRA.css
|
||||
var/mongoose/html/favicon.ico
|
||||
var/mongoose/html/img/fav/57.png
|
||||
var/mongoose/html/img/fav/72.png
|
||||
var/mongoose/html/img/fav/114.png
|
||||
var/mongoose/html/img/fav/144.png
|
||||
webif/html/css/EXTRA.css
|
||||
webif/html/favicon.ico
|
||||
webif/html/img/fav/57.png
|
||||
webif/html/img/fav/72.png
|
||||
webif/html/img/fav/114.png
|
||||
webif/html/img/fav/144.png
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
Package: webif
|
||||
Priority: optional
|
||||
Section: web
|
||||
Version: 1.0.10
|
||||
Version: 1.0.16
|
||||
Architecture: mipsel
|
||||
Maintainer: af123@hummypkg.org.uk
|
||||
Depends: webif-channelicons(>=1.1.9),mongoose(>=3.0.11),jim(>=0.75-1),jim-oo,jim-sqlite3(>=0.75),jim-cgi(>=0.7),jim-binary(>=0.75),service-control(>=1.2),busybox(>=1.20.2-1),lsof,epg(>=1.0.13),hmt(>=1.1.14),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2),stripts(>=1.2.5-3),smartmontools,tmenu(>=1.05),ffmpeg,id3v2,multienv(>=1.6)
|
||||
Depends: webif-channelicons(>=1.1.12-1),lighttpd(>=1.4.35-2),jim(>=0.75-1),jim-oo,jim-sqlite3(>=0.75),jim-cgi(>=0.7),jim-binary(>=0.75),service-control(>=1.2),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.0.13),hmt(>=1.1.21),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2-1),stripts(>=1.2.5-3),smartmontools,tmenu(>=1.08),ffmpeg,id3v2,multienv(>=1.6),mongoose
|
||||
Suggests:
|
||||
Description: An evolving web interface for the Humax.
|
||||
Tags: http://hummy.tv/forum/threads/4659/
|
||||
Tags: http://hummy.tv/forum/threads/5031/
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Postinstall $*"
|
||||
# Relocate any stray files in /mod/var/mongoose
|
||||
|
||||
if [ -d /mod/var/mongoose -a ! -h /mod/var/mongoose ]; then
|
||||
(
|
||||
cd /mod/var/mongoose
|
||||
find . | cpio -pmud /mod/webif
|
||||
cd /mod/var
|
||||
rm -rf mongoose
|
||||
ln -s ../webif mongoose
|
||||
)
|
||||
fi
|
||||
|
||||
export tmpf=/tmp/cronf.$$
|
||||
|
||||
@@ -19,7 +29,7 @@ fi
|
||||
ana=$PKG_ROOT/etc/anacrontab
|
||||
egrep -v 'backup/backup.jim|bin/diskattrs' $ana > $tmpf
|
||||
cat $tmpf - << EOM > $ana
|
||||
1 8 sched_backup /mod/webif/cgi-bin/backup/backup.jim
|
||||
1 8 sched_backup /mod/webif/html/backup/backup.jim
|
||||
1 5 diskattrs /mod/webif/lib/bin/diskattrs
|
||||
EOM
|
||||
|
||||
|
||||
16
CONTROL/preinst
Executable file
16
CONTROL/preinst
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Handle moving the legacy /var/mongoose directory to /webif..
|
||||
|
||||
if [ -h /mod/webif -a -d /mod/var/mongoose -a ! -h /mod/var/mongoose ]; then
|
||||
echo "Relocating web interface files..."
|
||||
|
||||
cd /mod
|
||||
rm webif || exit 1
|
||||
mv var/mongoose webif || exit 1
|
||||
cd var
|
||||
ln -s ../webif mongoose
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
1
var/mongoose
Symbolic link
1
var/mongoose
Symbolic link
@@ -0,0 +1 @@
|
||||
../webif
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
source /mod/webif/lib/setup
|
||||
httpheader "text/plain"
|
||||
|
||||
foreach f [dict keys $env] {
|
||||
puts "$f = $env($f)"
|
||||
}
|
||||
|
||||
@@ -1,183 +0,0 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require system.class findhsvc epg.class rsv.class
|
||||
|
||||
set runmode cli
|
||||
if {[string match {*jim} $argv0]} { set runmode cgi }
|
||||
|
||||
set schedtime 1200
|
||||
switch $runmode {
|
||||
cgi {
|
||||
set type [cgi_get type "full"]
|
||||
httpheader
|
||||
}
|
||||
cli {
|
||||
set type "full"
|
||||
if {"-X" in $argv} { set schedtime 7200 }
|
||||
}
|
||||
}
|
||||
|
||||
if {[catch {set pid [exec pgrep -n humaxtv]}]} {
|
||||
puts "Cannot find humaxtv process."
|
||||
exit
|
||||
}
|
||||
|
||||
proc get_data {} {
|
||||
global pid
|
||||
|
||||
set ret {}
|
||||
if {[catch {set data \
|
||||
[exec /mod/bin/lsof -p $pid | grep Video | fgrep .ts]} ]} {
|
||||
set ret {}
|
||||
} else {
|
||||
foreach line [split $data "\n"] {
|
||||
regsub -all -- {[[:space:]]+} $line " " line
|
||||
set name [file rootname [file tail $line]]
|
||||
if {[dict exists $ret $name]} {
|
||||
set ret($name) -1
|
||||
} else {
|
||||
set size [lindex [split $line " "] 6]
|
||||
set ret($name) $size
|
||||
}
|
||||
}
|
||||
}
|
||||
return $ret
|
||||
}
|
||||
|
||||
set play 0
|
||||
set rec 0
|
||||
set seen {}
|
||||
set output {}
|
||||
|
||||
if {$type eq "full"} {
|
||||
set data [get_data]
|
||||
} else {
|
||||
set data {}
|
||||
}
|
||||
|
||||
if {[llength $data]} {
|
||||
sleep 3
|
||||
set ndata [get_data]
|
||||
foreach name [array names ndata] {
|
||||
if {![dict exists $seen $name]} { set seen($name) 0 }
|
||||
if {![dict exists $data $name]} { set data($name) 0 }
|
||||
if {[file exists "/mod/tmp/webif_auto/decrypting.$name.ts"]} {
|
||||
set mode "Decrypting"
|
||||
set icon "178_1_00_Icon_Lock.png style=\"padding: 0 0.2em 0 0.5em\""
|
||||
} elseif {$ndata($name) == -1} {
|
||||
incr rec
|
||||
incr play
|
||||
set mode "Chase Playing"
|
||||
set icon "745_1_11_Video_3REC_Live.png"
|
||||
} elseif {$ndata($name) > $data($name) && $seen($name) < 1} {
|
||||
incr rec
|
||||
set mode "Recording"
|
||||
set icon "745_1_11_Video_1REC.png"
|
||||
} else {
|
||||
incr play
|
||||
set mode "Playing"
|
||||
set icon "745_1_10_Video_2Live.png"
|
||||
}
|
||||
|
||||
incr seen($name)
|
||||
|
||||
if {$runmode eq "cgi"} {
|
||||
lappend output [concat \
|
||||
"<span class=\"va stitem\">\n" \
|
||||
" <img class=va src=/images/$icon>\n" \
|
||||
" <span>$mode <i>$name</i></span>\n" \
|
||||
"</span>\n" \
|
||||
]
|
||||
} else {
|
||||
lappend output "$mode $name"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if {![system instandby] && $play < 1} {
|
||||
set hsvc [system param CUR_SVC Value USERCONFIG]
|
||||
|
||||
set ff [$rsvdb query "
|
||||
select usSvcid as svcid, usLcn as lcn,
|
||||
substr(szSvcName, 2) as name
|
||||
from channel.TBL_SVC
|
||||
where hSvc = $hsvc
|
||||
limit 1
|
||||
"]
|
||||
|
||||
if {[llength $ff] == 1} {
|
||||
lassign [lindex $ff 0] x svcid x lcn x name
|
||||
set epgs [epg dbfetch get \
|
||||
-service $svcid \
|
||||
-time [clock seconds]\
|
||||
]
|
||||
set prog ""
|
||||
if {[llength $epgs] == 1} {
|
||||
lassign $epgs epg
|
||||
set prog "- [$epg get name] ("
|
||||
append prog "[clock format [$epg get start] -format %H:%M] - "
|
||||
append prog "[clock format $([$epg get start] + [$epg get duration]) -format %H:%M]"
|
||||
append prog ") \[[$epg percent]%\]"
|
||||
}
|
||||
|
||||
if {$runmode eq "cgi"} {
|
||||
lappend output [concat \
|
||||
"<span class=\"va stitem\">\n" \
|
||||
" [epg channelicon $name 30 \
|
||||
{vertical-align: middle; padding: 0 4px 0 2px}]\n" \
|
||||
" <span>Watching <i>$lcn: $name $prog</i></span>\n" \
|
||||
"</span>\n" \
|
||||
]
|
||||
} else {
|
||||
lappend output "Watching $lcn: $name $prog"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if {[system instandby]} {
|
||||
if {$runmode eq "cgi"} {
|
||||
lappend output [concat \
|
||||
"<span class=\"va stitem\">\n" \
|
||||
" <img class=va width=28 style=\"padding: 0 4px\"" \
|
||||
"src=/img/standby.png>\n" \
|
||||
" <span>System is in standby.</span>\n" \
|
||||
"</span>" \
|
||||
]
|
||||
} else {
|
||||
lappend output "System is in standby."
|
||||
}
|
||||
}
|
||||
|
||||
set events [rsv list tbl_reservation \
|
||||
" where ersvtype = 3 and nsttime - [clock seconds] < $schedtime
|
||||
and nsttime > [clock seconds] "]
|
||||
foreach event $events {
|
||||
if {$runmode eq "cgi"} {
|
||||
set icon "175_1_11_Reservation_Record.png"
|
||||
lappend output [concat \
|
||||
"<span class=\"va stitem\">\n" \
|
||||
" <img class=va src=/images/$icon width=20>\n" \
|
||||
" <span>Will record <i>[$event name]</i>" \
|
||||
" on [$event channel_name] at"\
|
||||
" [clock format [$event get nsttime] -format {%H:%M}]" \
|
||||
" </span>\n" \
|
||||
"</span>\n" \
|
||||
} else {
|
||||
lappend output [concat \
|
||||
"Will record '[$event name]' " \
|
||||
"on [$event channel_name] at " \
|
||||
"[clock format [$event get nsttime] -format {%H:%M}]" \
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
if {[llength $output]} {
|
||||
if {$runmode eq "cgi"} {
|
||||
puts [join $output "\n<br>\n"]
|
||||
} else {
|
||||
puts [join $output "\n"]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
<!--#include virtual="/lib/header.shtml" -->
|
||||
<!--#exec cmd="/mod/webif/include/backup.jim" -->
|
||||
<!--#include virtual="/lib/footer.shtml" -->
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
|
||||
httpheader
|
||||
|
||||
# dir=%2Fmedia%2FMy+Video%2FWeatherview
|
||||
# aexpiry_days=13
|
||||
|
||||
set dir [cgi_get dir "-"]
|
||||
set days [cgi_get aexpiry_days 7]
|
||||
if {$dir eq "-"} exit
|
||||
|
||||
if {![file isdirectory $dir]} {
|
||||
puts "Not a directory."
|
||||
exit
|
||||
}
|
||||
|
||||
set fd [open "$dir/.autoexpire" w]
|
||||
puts $fd $days
|
||||
$fd close
|
||||
puts "Ok."
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
../lib/jquery.iphone-style-checkboxes/iphone-style-checkboxes.css
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require system.class chunked
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
set diag [cgi_get diag general]
|
||||
|
||||
start_chunked
|
||||
|
||||
if {[system modversion 1] < 113} {
|
||||
chunk ">>> Diagnostics only available with customised firmware 1.13 or above."
|
||||
end_chunked
|
||||
exit
|
||||
}
|
||||
|
||||
chunk ">>> Beginning diagnostic $diag\r\n"
|
||||
|
||||
set bcmd "|/bin/diag $diag"
|
||||
set fd [open $bcmd r]
|
||||
while {[gets $fd line] >= 0} {
|
||||
chunk "$line\r\n"
|
||||
#chunk_pad
|
||||
}
|
||||
close $fd
|
||||
chunk "\r\n"
|
||||
chunk ">>> Ending diagnostic $diag\r\n"
|
||||
|
||||
end_chunked
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
<!--#include virtual="/lib/header.shtml" -->
|
||||
<!--#exec cmd="/mod/webif/include/epg.jim" -->
|
||||
<!--#include virtual="/lib/footer.shtml" -->
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
../lib/jquery.plugin/easing/easing.js
|
||||
@@ -1 +0,0 @@
|
||||
../lib/jquery.plugin/iajax/iajax.js
|
||||
@@ -1 +0,0 @@
|
||||
../lib/jquery.iphone-style-checkboxes/iphone-style-checkboxes.js
|
||||
6
var/mongoose/html/js/jquery-1.10.2.min.js
vendored
6
var/mongoose/html/js/jquery-1.10.2.min.js
vendored
File diff suppressed because one or more lines are too long
1
var/mongoose/html/js/jquery.js
vendored
1
var/mongoose/html/js/jquery.js
vendored
@@ -1 +0,0 @@
|
||||
jquery-1.10.2.min.js
|
||||
1
var/mongoose/html/js/jquery.ui.totop.js
vendored
1
var/mongoose/html/js/jquery.ui.totop.js
vendored
@@ -1 +0,0 @@
|
||||
../lib/jquery.plugin/ui.totop/jquery.ui.totop.js
|
||||
@@ -1 +0,0 @@
|
||||
<!--#exec cmd="/mod/webif/html/lib/footer.jim" -->
|
||||
@@ -1 +0,0 @@
|
||||
<!--#exec cmd="/mod/webif/html/lib/header.jim" -->
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 7.6 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.8 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.8 KiB |
@@ -1,36 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<!-- Need to get a proper redirect hooked up. Blech. -->
|
||||
<meta http-equiv="refresh" content="0;url=demos/">
|
||||
<meta name="robots" content="noindex, follow">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>jQuery Mobile</title>
|
||||
<link rel="stylesheet" href="css/themes/default/jquery.mobile-1.3.2.min.css">
|
||||
<link rel="stylesheet" href="demos/_assets/css/jqm-demos.css">
|
||||
<link rel="shortcut icon" href="demos/_assets/favicon.ico">
|
||||
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,700">
|
||||
<script src="js/jquery.js"></script>
|
||||
<script src="demos/_assets/js/index.js"></script>
|
||||
<script src="js/jquery.mobile-1.3.2.min.js"></script>
|
||||
<script>
|
||||
$( document ).on( "pageshow", function(){
|
||||
$( "p.message" ).hide().delay( 1500 ).show( "fast" );
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div data-role="page" class="jqm-demos">
|
||||
|
||||
<div data-role="content" class="jqm-content">
|
||||
|
||||
<p class="message">Nothing to see here folks. <a href="demos/">View the demo center home page →</a></p>
|
||||
|
||||
</div><!-- /content -->
|
||||
|
||||
</div><!-- /page -->
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
|
||||
jquery.mobile-1.3.2.min.css
|
||||
@@ -1 +0,0 @@
|
||||
jquery.mobile-1.3.2.min.js
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* jQuery Plugin : jConfirmAction
|
||||
*
|
||||
* by Hidayat Sagita
|
||||
* http://www.webstuffshare.com
|
||||
* Licensed Under GPL version 2 license.
|
||||
*
|
||||
*/
|
||||
(function($){
|
||||
|
||||
jQuery.fn.jConfirmAction = function (options, callback) {
|
||||
|
||||
// Some jConfirmAction options (limited to customize language) :
|
||||
// question : a text for your question.
|
||||
// yesAnswer : a text for Yes answer.
|
||||
// cancelAnswer : a text for Cancel/No answer.
|
||||
var theOptions = jQuery.extend ({
|
||||
question: "Are You Sure?",
|
||||
yesAnswer: "Yes",
|
||||
cancelAnswer: "Cancel"
|
||||
}, options);
|
||||
|
||||
return this.each (function () {
|
||||
$(this).click(function(e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
var p = $(this);
|
||||
|
||||
if($(this).next('.question').length <= 0)
|
||||
$(this).after('<div class="jcaquestion">'+theOptions.question+'<br/> <span class="jcayes">'+theOptions.yesAnswer+'</span><span class="jcacancel">'+theOptions.cancelAnswer+'</span></div>');
|
||||
|
||||
$(this).next('.jcaquestion').animate({opacity: 1}, 300);
|
||||
|
||||
$('.jcayes').bind('click', function() {
|
||||
callback(p);
|
||||
});
|
||||
|
||||
$('.jcacancel').bind('click', function(){
|
||||
$(this).parents('.jcaquestion').fadeOut(300, function() {
|
||||
$(this).remove();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
})(jQuery);
|
||||
@@ -1,75 +0,0 @@
|
||||
.iPhoneCheckContainer {
|
||||
position: relative;
|
||||
height: 27px;
|
||||
cursor: pointer;
|
||||
overflow: hidden; }
|
||||
.iPhoneCheckContainer input {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
left: 30px;
|
||||
opacity: 0;
|
||||
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0);
|
||||
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); }
|
||||
.iPhoneCheckContainer label {
|
||||
white-space: nowrap;
|
||||
font-size: 17px;
|
||||
line-height: 17px;
|
||||
font-weight: bold;
|
||||
font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
|
||||
text-transform: uppercase;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
height: 27px;
|
||||
position: absolute;
|
||||
width: auto;
|
||||
top: 0;
|
||||
padding-top: 5px;
|
||||
overflow: hidden; }
|
||||
.iPhoneCheckContainer, .iPhoneCheckContainer label {
|
||||
user-select: none;
|
||||
-moz-user-select: none;
|
||||
-khtml-user-select: none; }
|
||||
|
||||
.iPhoneCheckDisabled {
|
||||
opacity: 0.5;
|
||||
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=50);
|
||||
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=50); }
|
||||
|
||||
label.iPhoneCheckLabelOn {
|
||||
color: white;
|
||||
background: url('/img/iphone-style-checkboxes/on.png?1282083753') no-repeat;
|
||||
text-shadow: 0px 0px 2px rgba(0, 0, 0, 0.6);
|
||||
left: 0;
|
||||
padding-top: 5px; }
|
||||
label.iPhoneCheckLabelOn span {
|
||||
padding-left: 8px; }
|
||||
label.iPhoneCheckLabelOff {
|
||||
color: #8b8b8b;
|
||||
background: url('/img/iphone-style-checkboxes/off.png?1282083753') no-repeat right 0;
|
||||
text-shadow: 0px 0px 2px rgba(255, 255, 255, 0.6);
|
||||
text-align: right;
|
||||
right: 0; }
|
||||
label.iPhoneCheckLabelOff span {
|
||||
padding-right: 8px; }
|
||||
|
||||
.iPhoneCheckHandle {
|
||||
display: block;
|
||||
height: 27px;
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 0;
|
||||
background: url('/img/iphone-style-checkboxes/slider_left.png?1282083753') no-repeat;
|
||||
padding-left: 3px; }
|
||||
|
||||
.iPhoneCheckHandleRight {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
padding-right: 3px;
|
||||
background: url('/img/iphone-style-checkboxes/slider_right.png?1282083753') no-repeat right 0; }
|
||||
|
||||
.iPhoneCheckHandleCenter {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
background: url('/img/iphone-style-checkboxes/slider_center.png?1282083753'); }
|
||||
@@ -1,231 +0,0 @@
|
||||
/*!
|
||||
// iPhone-style Checkboxes jQuery plugin
|
||||
// Copyright Thomas Reynolds, licensed GPL & MIT
|
||||
*/
|
||||
;(function($, iphoneStyle) {
|
||||
|
||||
// Constructor
|
||||
$[iphoneStyle] = function(elem, options) {
|
||||
this.$elem = $(elem);
|
||||
|
||||
// Import options into instance variables
|
||||
var obj = this;
|
||||
$.each(options, function(key, value) {
|
||||
obj[key] = value;
|
||||
});
|
||||
|
||||
// Initialize the control
|
||||
this.wrapCheckboxWithDivs();
|
||||
this.attachEvents();
|
||||
this.disableTextSelection();
|
||||
|
||||
if (this.resizeHandle) { this.optionallyResize('handle'); }
|
||||
if (this.resizeContainer) { this.optionallyResize('container'); }
|
||||
|
||||
this.initialPosition();
|
||||
};
|
||||
|
||||
$.extend($[iphoneStyle].prototype, {
|
||||
// Wrap the existing input[type=checkbox] with divs for styling and grab DOM references to the created nodes
|
||||
wrapCheckboxWithDivs: function() {
|
||||
this.$elem.wrap('<div class="' + this.containerClass + '" />');
|
||||
this.container = this.$elem.parent();
|
||||
|
||||
this.offLabel = $('<label class="'+ this.labelOffClass +'">' +
|
||||
'<span>'+ this.uncheckedLabel +'</span>' +
|
||||
'</label>').appendTo(this.container);
|
||||
this.offSpan = this.offLabel.children('span');
|
||||
|
||||
this.onLabel = $('<label class="'+ this.labelOnClass +'">' +
|
||||
'<span>'+ this.checkedLabel +'</span>' +
|
||||
'</label>').appendTo(this.container);
|
||||
this.onSpan = this.onLabel.children('span');
|
||||
|
||||
this.handle = $('<div class="' + this.handleClass + '">' +
|
||||
'<div class="' + this.handleRightClass + '">' +
|
||||
'<div class="' + this.handleCenterClass + '" />' +
|
||||
'</div>' +
|
||||
'</div>').appendTo(this.container);
|
||||
},
|
||||
|
||||
// Disable IE text selection, other browsers are handled in CSS
|
||||
disableTextSelection: function() {
|
||||
return;
|
||||
// if (!$.browser.msie) { return; }
|
||||
|
||||
// Elements containing text should be unselectable
|
||||
$.each([this.handle, this.offLabel, this.onLabel, this.container], function() {
|
||||
$(this).attr("unselectable", "on");
|
||||
});
|
||||
},
|
||||
|
||||
// Automatically resize the handle or container
|
||||
optionallyResize: function(mode) {
|
||||
var onLabelWidth = this.onLabel.width(),
|
||||
offLabelWidth = this.offLabel.width();
|
||||
|
||||
if (mode == 'container') {
|
||||
var newWidth = (onLabelWidth > offLabelWidth) ? onLabelWidth : offLabelWidth;
|
||||
newWidth += this.handle.width() + 15;
|
||||
} else {
|
||||
var newWidth = (onLabelWidth < offLabelWidth) ? onLabelWidth : offLabelWidth;
|
||||
}
|
||||
|
||||
this[mode].css({ width: newWidth });
|
||||
},
|
||||
|
||||
attachEvents: function() {
|
||||
var obj = this;
|
||||
|
||||
// A mousedown anywhere in the control will start tracking for dragging
|
||||
this.container
|
||||
.bind('mousedown touchstart', function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
if (obj.$elem.is(':disabled')) { return; }
|
||||
|
||||
var x = event.pageX || event.originalEvent.changedTouches[0].pageX;
|
||||
$[iphoneStyle].currentlyClicking = obj.handle;
|
||||
$[iphoneStyle].dragStartPosition = x;
|
||||
$[iphoneStyle].handleLeftOffset = parseInt(obj.handle.css('left'), 10) || 0;
|
||||
$[iphoneStyle].dragStartedOn = obj.$elem;
|
||||
})
|
||||
|
||||
// Utilize event bubbling to handle drag on any element beneath the container
|
||||
.bind('iPhoneDrag', function(event, x) {
|
||||
event.preventDefault();
|
||||
|
||||
if (obj.$elem.is(':disabled')) { return; }
|
||||
if (obj.$elem != $[iphoneStyle].dragStartedOn) { return; }
|
||||
|
||||
var p = (x + $[iphoneStyle].handleLeftOffset - $[iphoneStyle].dragStartPosition) / obj.rightSide;
|
||||
if (p < 0) { p = 0; }
|
||||
if (p > 1) { p = 1; }
|
||||
obj.handle.css({ left: p * obj.rightSide });
|
||||
obj.onLabel.css({ width: p * obj.rightSide + 4 });
|
||||
obj.offSpan.css({ marginRight: -p * obj.rightSide });
|
||||
obj.onSpan.css({ marginLeft: -(1 - p) * obj.rightSide });
|
||||
})
|
||||
|
||||
// Utilize event bubbling to handle drag end on any element beneath the container
|
||||
.bind('iPhoneDragEnd', function(event, x) {
|
||||
if (obj.$elem.is(':disabled')) { return; }
|
||||
|
||||
var checked;
|
||||
if ($[iphoneStyle].dragging) {
|
||||
var p = (x - $[iphoneStyle].dragStartPosition) / obj.rightSide;
|
||||
checked = (p < 0) ? Math.abs(p) < 0.5 : p >= 0.5;
|
||||
} else {
|
||||
checked = !obj.$elem.attr('checked');
|
||||
}
|
||||
|
||||
obj.$elem.attr('checked', checked);
|
||||
|
||||
$[iphoneStyle].currentlyClicking = null;
|
||||
$[iphoneStyle].dragging = null;
|
||||
obj.$elem.change();
|
||||
});
|
||||
|
||||
// Animate when we get a change event
|
||||
this.$elem.change(function() {
|
||||
if (obj.$elem.is(':disabled')) {
|
||||
obj.container.addClass(obj.disabledClass);
|
||||
return false;
|
||||
} else {
|
||||
obj.container.removeClass(obj.disabledClass);
|
||||
}
|
||||
|
||||
var new_left = obj.$elem.attr('checked') ? obj.rightSide : 0;
|
||||
|
||||
obj.handle.animate({ left: new_left }, obj.duration);
|
||||
obj.onLabel.animate({ width: new_left + 4 }, obj.duration);
|
||||
obj.offSpan.animate({ marginRight: -new_left }, obj.duration);
|
||||
obj.onSpan.animate({ marginLeft: new_left - obj.rightSide }, obj.duration);
|
||||
});
|
||||
},
|
||||
|
||||
// Setup the control's inital position
|
||||
initialPosition: function() {
|
||||
this.offLabel.css({ width: this.container.width() - 5 });
|
||||
|
||||
// var offset = ($.browser.msie && $.browser.version < 7) ? 3 : 6;
|
||||
var offset = 6;
|
||||
this.rightSide = this.container.width() - this.handle.width() - offset;
|
||||
|
||||
if (this.$elem.is(':checked')) {
|
||||
this.handle.css({ left: this.rightSide });
|
||||
this.onLabel.css({ width: this.rightSide + 4 });
|
||||
this.offSpan.css({ marginRight: -this.rightSide });
|
||||
} else {
|
||||
this.onLabel.css({ width: 0 });
|
||||
this.onSpan.css({ marginLeft: -this.rightSide });
|
||||
}
|
||||
|
||||
if (this.$elem.is(':disabled')) {
|
||||
this.container.addClass(this.disabledClass);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// jQuery-specific code
|
||||
$.fn[iphoneStyle] = function(options) {
|
||||
var checkboxes = this.filter(':checkbox');
|
||||
|
||||
// Fail early if we don't have any checkboxes passed in
|
||||
if (!checkboxes.length) { return this; }
|
||||
|
||||
// Merge options passed in with global defaults
|
||||
var opt = $.extend({}, $[iphoneStyle].defaults, options);
|
||||
|
||||
checkboxes.each(function() {
|
||||
$(this).data(iphoneStyle, new $[iphoneStyle](this, opt));
|
||||
});
|
||||
|
||||
if (!$[iphoneStyle].initComplete) {
|
||||
// As the mouse moves on the page, animate if we are in a drag state
|
||||
$(document)
|
||||
.bind('mousemove touchmove', function(event) {
|
||||
if (!$[iphoneStyle].currentlyClicking) { return; }
|
||||
event.preventDefault();
|
||||
|
||||
var x = event.pageX || event.originalEvent.changedTouches[0].pageX;
|
||||
if (!$[iphoneStyle].dragging &&
|
||||
(Math.abs($[iphoneStyle].dragStartPosition - x) > opt.dragThreshold)) {
|
||||
$[iphoneStyle].dragging = true;
|
||||
}
|
||||
|
||||
$(event.target).trigger('iPhoneDrag', [x]);
|
||||
})
|
||||
|
||||
// When the mouse comes up, leave drag state
|
||||
.bind('mouseup touchend', function(event) {
|
||||
if (!$[iphoneStyle].currentlyClicking) { return; }
|
||||
event.preventDefault();
|
||||
|
||||
var x = event.pageX || event.originalEvent.changedTouches[0].pageX;
|
||||
$($[iphoneStyle].currentlyClicking).trigger('iPhoneDragEnd', [x]);
|
||||
});
|
||||
|
||||
$[iphoneStyle].initComplete = true;
|
||||
}
|
||||
|
||||
return this;
|
||||
}; // End of $.fn[iphoneStyle]
|
||||
|
||||
$[iphoneStyle].defaults = {
|
||||
duration: 200, // Time spent during slide animation
|
||||
checkedLabel: 'ON', // Text content of "on" state
|
||||
uncheckedLabel: 'OFF', // Text content of "off" state
|
||||
resizeHandle: true, // Automatically resize the handle to cover either label
|
||||
resizeContainer: true, // Automatically resize the widget to contain the labels
|
||||
disabledClass: 'iPhoneCheckDisabled',
|
||||
containerClass: 'iPhoneCheckContainer',
|
||||
labelOnClass: 'iPhoneCheckLabelOn',
|
||||
labelOffClass: 'iPhoneCheckLabelOff',
|
||||
handleClass: 'iPhoneCheckHandle',
|
||||
handleCenterClass: 'iPhoneCheckHandleCenter',
|
||||
handleRightClass: 'iPhoneCheckHandleRight',
|
||||
dragThreshold: 5 // Pixels that must be dragged for a click to be ignored
|
||||
};
|
||||
|
||||
})(jQuery, 'iphoneStyle');
|
||||
@@ -1 +0,0 @@
|
||||
test
|
||||
@@ -1 +0,0 @@
|
||||
test
|
||||
@@ -1,24 +0,0 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
set services [split [exec /mod/bin/service mlist]]
|
||||
|
||||
foreach service $services {
|
||||
lassign [split $service ":"] name installed auto running
|
||||
|
||||
puts "<tr><td class=even>$name</td>"
|
||||
if (!$installed) {
|
||||
puts "<td colspan=3><i>Not installed</i></td></tr>"
|
||||
continue
|
||||
}
|
||||
|
||||
puts -nonewline "<td><input type=checkbox class=auto name=\"$name\""
|
||||
if ($auto) { puts -nonewline " checked" }
|
||||
puts "></td>"
|
||||
|
||||
puts -nonewline "<td><input type=checkbox class=toggle name=\"$name\""
|
||||
if ($running) { puts -nonewline " checked" }
|
||||
puts "></td>"
|
||||
|
||||
puts "</tr>"
|
||||
}
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
source /mod/webif/lib/setup
|
||||
require system.class ts.class
|
||||
|
||||
proc do_shrink {ts} {
|
||||
if {[$ts flag "Shrunk"]} { return }
|
||||
|
||||
set file [file rootname [$ts get file]]
|
||||
|
||||
if {[$ts inuse]} { return }
|
||||
|
||||
if {[catch {
|
||||
set perc [exec /mod/bin/stripts -aq $file]
|
||||
} msg]} {
|
||||
return
|
||||
}
|
||||
|
||||
if {[string match {*%} $perc]} {
|
||||
set perc [string range $perc 0 end-1]
|
||||
} else {
|
||||
set perc 0
|
||||
}
|
||||
|
||||
if {$perc == 0} {
|
||||
puts " Flagging $file as shrunk..."
|
||||
$ts set_shrunk
|
||||
}
|
||||
}
|
||||
|
||||
proc entries {dir callback} {
|
||||
foreach entry [readdir -nocomplain $dir] {
|
||||
if {![string match {*.ts} $entry} continue
|
||||
if {[catch {set ts [ts fetch "$dir/$entry"]}]} continue
|
||||
if {$ts == 0} continue
|
||||
$callback $ts
|
||||
}
|
||||
}
|
||||
|
||||
proc scan {dir} {
|
||||
puts "Scanning $dir..."
|
||||
file stat "$dir/" st
|
||||
if {$st(dev) != $::rootdev} { return }
|
||||
|
||||
entries $dir do_shrink
|
||||
|
||||
foreach entry [readdir -nocomplain $dir] {
|
||||
if {[file isdirectory "$dir/$entry"]} {
|
||||
scan "$dir/$entry"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
set root [system mediaroot]
|
||||
file stat "$root/" rootstat
|
||||
set rootdev $rootstat(dev)
|
||||
|
||||
scan $root
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
|
||||
#proc {dict merge} {dict args} {
|
||||
# foreach d $args {
|
||||
# foreach k [dict keys $d] {
|
||||
# dict set dict $k [dict get $d $k]
|
||||
# }
|
||||
# }
|
||||
# return $dict
|
||||
#}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
|
||||
if {![exists -proc tdelete]} {
|
||||
proc tdelete {path} {
|
||||
if {[file isdirectory $path]} {
|
||||
regsub -all {([\\["$])} $path {\\\1} cpath
|
||||
foreach file [glob -nocomplain "${cpath}/*"] {
|
||||
if {[file isdirectory $file]} {
|
||||
tdelete $file
|
||||
} else {
|
||||
exec /mod/bin/trm $file
|
||||
}
|
||||
}
|
||||
exec /mod/bin/busybox/rm -rf $path
|
||||
} else {
|
||||
exec /mod/bin/trm $path
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require system.class chunked pretty_size
|
||||
require system.class pretty_size
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
@@ -10,16 +10,14 @@ cgi_input
|
||||
set file [cgi_get file "-"]
|
||||
if {$file eq "-"} { exit }
|
||||
|
||||
start_chunked
|
||||
httpheader "text/plain"
|
||||
|
||||
if {![file exists $file]} {
|
||||
chunk ">>> File $file does not exist.\r\n"
|
||||
puts ">>> File $file does not exist.\r\n"
|
||||
} else {
|
||||
chunk ">>> Contents of $file [pretty_size [file size $file]]\r\n"
|
||||
puts ">>> Contents of $file [pretty_size [file size $file]]\r\n"
|
||||
set fp [open $file r]
|
||||
chunk [read $fp]
|
||||
puts [read $fp]
|
||||
close $fp
|
||||
}
|
||||
|
||||
end_chunked
|
||||
|
||||
@@ -91,10 +91,10 @@ foreach tw [$db query {
|
||||
src=/images/421_1_00_CH_Title_2R_Arrow.png>
|
||||
view
|
||||
</a></td>"
|
||||
puts "<td>$ehs</th>"
|
||||
puts "<td>$ehs</td>"
|
||||
puts "</tr>"
|
||||
puts "<tr id=mchan_$tsIdx class=mchan style=\"display: none\">
|
||||
<td colspan=5>"
|
||||
<td colspan=9>"
|
||||
puts "<table style=\"margin-left: 5em\">"
|
||||
puts "<tr>
|
||||
<th colspan=3>Channel</th>
|
||||
@@ -107,15 +107,13 @@ foreach tw [$db query {
|
||||
set name [string range $name 1 end]
|
||||
set prv [string range $prv 3 end]
|
||||
altrow
|
||||
puts "<td class=va>"
|
||||
puts "[epg channelicon $name 50]</td>
|
||||
<td>$lcn</td><td>$name</td>"
|
||||
puts "</td><td>"
|
||||
puts $prv
|
||||
puts "</td><td>"
|
||||
puts $auth
|
||||
puts "</td>"
|
||||
puts "</tr>"
|
||||
puts "
|
||||
<td class=va>[epg channelicon $name 50]</td>
|
||||
<td>$lcn</td><td>$name</td>
|
||||
<td>$prv</td>
|
||||
<td>$auth</td>
|
||||
</tr>
|
||||
"
|
||||
}
|
||||
puts "</table>"
|
||||
puts "</td></tr>"
|
||||
@@ -142,3 +140,5 @@ $(document).ready(function() {
|
||||
</script>
|
||||
}
|
||||
|
||||
footer
|
||||
|
||||
@@ -63,7 +63,7 @@ proc db_info {db_file} {
|
||||
if {$fdb == 0} {
|
||||
puts "Please choose database to view:<ul>"
|
||||
foreach db $databases {
|
||||
puts "<li><a href=$::env(REQUEST_URI)?db=[file tail $db]>
|
||||
puts "<li><a href=$::env(SCRIPT_NAME)?db=[file tail $db]>
|
||||
$db</a></li>"
|
||||
}
|
||||
puts "</ul>"
|
||||
9
webif/cgi-bin/env.jim
Executable file
9
webif/cgi-bin/env.jim
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
source /mod/webif/lib/setup
|
||||
httpheader
|
||||
|
||||
puts "<pre>"
|
||||
parray env
|
||||
puts "</pre>"
|
||||
|
||||
@@ -13,7 +13,7 @@ set raw [cgi_get raw]
|
||||
puts "<pre>"
|
||||
if { $raw == 0 } {
|
||||
puts [epg exec dump -raw 1 -service $service -event $event]
|
||||
puts "<a href=$env(REQUEST_URI)?$env(QUERY_STRING)&raw=1>
|
||||
puts "<a href=$env(SCRIPT_NAME)?$env(QUERY_STRING)&raw=1>
|
||||
Click here for extended dump</a>"
|
||||
} else {
|
||||
puts [epg exec dumpraw -raw 1 -service $service -event $event]
|
||||
15
webif/cgi-bin/hximages.jim
Executable file
15
webif/cgi-bin/hximages.jim
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
source /mod/webif/lib/setup
|
||||
|
||||
header
|
||||
|
||||
puts "<ul>"
|
||||
|
||||
foreach f [readdir "/opt/share/images/blue"] {
|
||||
if {![string match {*.png} $f]} continue
|
||||
puts "<li><img src=\"/images/$f\">$f</li>"
|
||||
}
|
||||
|
||||
puts "</ul>"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require pkg.class chunked
|
||||
require pkg.class
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
@@ -10,30 +10,28 @@ cgi_input
|
||||
set cmd [cgi_get cmd update]
|
||||
|
||||
proc opkg {cmd} {
|
||||
chunk ">>> opkg $cmd\r\n"
|
||||
puts ">>> opkg $cmd"
|
||||
set bcmd "|/mod/webif/lib/bin/opkg $cmd"
|
||||
set fd [open $bcmd r]
|
||||
while {[gets $fd line] >= 0} {
|
||||
chunk "$line\r\n"
|
||||
#chunk_pad
|
||||
puts "$line"
|
||||
}
|
||||
close $fd
|
||||
chunk "\r\n"
|
||||
puts ""
|
||||
}
|
||||
|
||||
start_chunked
|
||||
httpheader "text/plain"
|
||||
|
||||
if {$cmd eq "upgrade"} { opkg update }
|
||||
opkg $cmd
|
||||
|
||||
if {$cmd eq "update" || $cmd eq "upgrade"} {
|
||||
chunk "Updating package meta information\r\n"
|
||||
puts "Updating package meta information"
|
||||
pkg fetchmeta
|
||||
chunk "Done.\r\n"
|
||||
chunk "Updating diagnostic meta information\r\n"
|
||||
puts "Done."
|
||||
puts ""
|
||||
puts "Updating diagnostic meta information"
|
||||
pkg fetchdiagmeta
|
||||
chunk "Done.\r\n"
|
||||
puts "Done."
|
||||
}
|
||||
|
||||
end_chunked
|
||||
|
||||
@@ -45,7 +45,7 @@ puts {
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#progressbar').reportprogress(0);
|
||||
handle = setInterval("update()", 350);
|
||||
handle = setInterval("update()", 400);
|
||||
$.get('/cgi-bin/restart.jim?now=yes');
|
||||
});
|
||||
</script>
|
||||
306
webif/cgi-bin/status.jim
Executable file
306
webif/cgi-bin/status.jim
Executable file
@@ -0,0 +1,306 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require system.class findhsvc epg.class rsv.class
|
||||
|
||||
set runmode cli
|
||||
if {[string match {*jim} $argv0]} { set runmode cgi }
|
||||
|
||||
set schedtime 1200
|
||||
switch $runmode {
|
||||
cgi {
|
||||
set type [cgi_get type "full"]
|
||||
httpheader
|
||||
}
|
||||
cli {
|
||||
set type "full"
|
||||
if {"-X" in $argv} { set schedtime 7200 }
|
||||
}
|
||||
}
|
||||
|
||||
if {"-d" in $argv} {
|
||||
proc debug {arg} { puts $arg }
|
||||
} else {
|
||||
proc debug {arg} {}
|
||||
}
|
||||
|
||||
if {[catch {set pid [exec pgrep -n humaxtv]}]} {
|
||||
puts "Cannot find humaxtv process."
|
||||
exit
|
||||
}
|
||||
|
||||
set exts {.ts .mkv .avi .mpg .mpeg .wmv .mp3 .mp4 .mov}
|
||||
|
||||
proc get_data {} {
|
||||
global pid exts opfile
|
||||
|
||||
set ret {}
|
||||
if {[catch {set data \
|
||||
[exec /mod/webif/lib/bin/lsof -X -Fns -p $pid]} msg]} {
|
||||
set ret {}
|
||||
} else {
|
||||
set size 0
|
||||
foreach line [split $data "\n"] {
|
||||
set typ [string index $line 0]
|
||||
switch $typ {
|
||||
s {
|
||||
set size [string range $line 1 end]
|
||||
}
|
||||
n {
|
||||
if {[string first Video/ $line] == -1 && \
|
||||
[string first /media/ $line] == -1} {
|
||||
continue
|
||||
}
|
||||
regsub -- { \([^\)]+\)$} $line "" line
|
||||
set ext [file extension $line]
|
||||
if {$ext ni $exts} continue
|
||||
set file [string range $line 1 end]
|
||||
# Handle chase play (same file open twice
|
||||
# and recently written)
|
||||
if {[dict exists $ret $file] && \
|
||||
$ext eq ".ts"} {
|
||||
set age [expr [clock seconds] - \
|
||||
[file mtime $file]]
|
||||
if {$age < 60} {
|
||||
set ret($file) -1
|
||||
}
|
||||
} else {
|
||||
set ret($file) $size
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if {$opfile ne "" && $opfile ni $ret} {
|
||||
set ret($opfile) [file size $opfile]
|
||||
}
|
||||
}
|
||||
return $ret
|
||||
}
|
||||
|
||||
set play 0
|
||||
set rec 0
|
||||
set output {}
|
||||
|
||||
set opfile ""
|
||||
if {[file exists "/mod/tmp/webif_auto/.op"} {
|
||||
set fp [open "/mod/tmp/webif_auto/.op"]
|
||||
lassign [split [string trim [$fp read]] ":"] op opfile
|
||||
$fp close
|
||||
debug "OP: $op - $opfile"
|
||||
}
|
||||
|
||||
set data {}
|
||||
if {$type eq "full"} {
|
||||
set data [get_data]
|
||||
}
|
||||
if {[llength $data]} {
|
||||
debug " DATA: ($data)"
|
||||
if {![file exists /tmp/.rractive]} {
|
||||
sleep 3
|
||||
set ndata [get_data]
|
||||
debug " NDATA: ($ndata)"
|
||||
set rr 0
|
||||
} else {
|
||||
sleep 1
|
||||
set ndata [get_data]
|
||||
debug " NDATA: ($ndata)"
|
||||
foreach k [array names data] {
|
||||
if {![dict exists $ndata $k]} {
|
||||
dict unset data $k
|
||||
}
|
||||
}
|
||||
|
||||
set rr 1
|
||||
set recs {}
|
||||
loop i 0 2 {
|
||||
catch {
|
||||
set fd [open "/tmp/.rec$i" r]
|
||||
lappend recs "[$fd read -nonewline].ts"
|
||||
$fd close
|
||||
}
|
||||
}
|
||||
debug " RECS: $recs"
|
||||
}
|
||||
foreach file [array names data] {
|
||||
set bname [file rootname [file tail $file]]
|
||||
|
||||
if {$file eq $opfile} {
|
||||
set mode $op
|
||||
} elseif {$data($file) == -1} {
|
||||
set mode chase
|
||||
} elseif {$rr} {
|
||||
if {$file in $recs} {
|
||||
set mode rec
|
||||
} else {
|
||||
set mode play
|
||||
}
|
||||
} else {
|
||||
if {![dict exists $ndata $file]} continue
|
||||
if {$ndata($file) > $data($file)} {
|
||||
set mode rec
|
||||
} else {
|
||||
set mode play
|
||||
}
|
||||
}
|
||||
|
||||
switch $mode {
|
||||
chase {
|
||||
incr rec
|
||||
incr play
|
||||
set mode "Chase Playing"
|
||||
set icon "745_1_11_Video_3REC_Live.png"
|
||||
}
|
||||
rec {
|
||||
incr rec
|
||||
set mode "Recording"
|
||||
set icon "745_1_11_Video_1REC.png"
|
||||
}
|
||||
play {
|
||||
incr play
|
||||
set mode "Playing"
|
||||
set icon "745_1_10_Video_2Live.png"
|
||||
}
|
||||
dec {
|
||||
set mode "Decrypting"
|
||||
set icon "/img/decrypt.png "
|
||||
append icon "style=\"padding: 0 0.2em 0 0.5em\""
|
||||
}
|
||||
mpg {
|
||||
set mode "Extracting MPG"
|
||||
set icon "/img/mpg.png "
|
||||
append icon "style=\"padding: 0 0.2em 0 0.5em\""
|
||||
}
|
||||
mp3 {
|
||||
set mode "Extracting MP3"
|
||||
set icon "/img/mp3.png "
|
||||
append icon "style=\"padding: 0 0.2em 0 0.5em\""
|
||||
}
|
||||
shrink {
|
||||
set mode "Shrinking"
|
||||
set icon "/img/compress.png "
|
||||
append icon "style=\"padding: 0 0.2em 0 0.5em\""
|
||||
}
|
||||
}
|
||||
|
||||
if {[string first "/" $icon] == -1} {
|
||||
set icon "/images/$icon"
|
||||
}
|
||||
|
||||
set name [string map {
|
||||
"/mnt/hd2/My Video/" ""
|
||||
"/media/drive1/Video/" ""
|
||||
"/media/" ""
|
||||
".ts" ""
|
||||
} $file]
|
||||
|
||||
if {$runmode eq "cgi"} {
|
||||
lappend output [concat \
|
||||
"<span class=\"va stitem\">\n" \
|
||||
" <img class=va src=$icon>\n" \
|
||||
" <span>$mode <i>$name</i></span>\n" \
|
||||
"</span>\n" \
|
||||
]
|
||||
} else {
|
||||
lappend output "$mode $name"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
######################################################################
|
||||
# Live viewing information
|
||||
|
||||
if {![system instandby] && $play < 1} {
|
||||
set hsvc [system param CUR_SVC Value USERCONFIG]
|
||||
|
||||
set ff [$rsvdb query "
|
||||
select usSvcid as svcid, usLcn as lcn,
|
||||
substr(szSvcName, 2) as name
|
||||
from channel.TBL_SVC
|
||||
where hSvc = $hsvc
|
||||
limit 1
|
||||
"]
|
||||
|
||||
if {[llength $ff] == 1} {
|
||||
lassign [lindex $ff 0] x svcid x lcn x name
|
||||
set epgs [epg dbfetch get \
|
||||
-service $svcid \
|
||||
-time [clock seconds]\
|
||||
]
|
||||
set prog ""
|
||||
if {[llength $epgs] == 1} {
|
||||
lassign $epgs epg
|
||||
set prog "- [$epg get name] ("
|
||||
append prog "[clock format [$epg get start] -format %H:%M] - "
|
||||
append prog "[clock format $([$epg get start] + [$epg get duration]) -format %H:%M]"
|
||||
append prog ") \[[$epg percent]%\]"
|
||||
}
|
||||
|
||||
if {$runmode eq "cgi"} {
|
||||
lappend output [concat \
|
||||
"<span class=\"va stitem\">\n" \
|
||||
" [epg channelicon $name 30 \
|
||||
{vertical-align: middle; padding: 0 4px 0 2px}]\n" \
|
||||
" <span>Watching <i>$lcn: $name $prog</i></span>\n" \
|
||||
"</span>\n" \
|
||||
]
|
||||
} else {
|
||||
lappend output "Watching $lcn: $name $prog"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
######################################################################
|
||||
# In standby
|
||||
|
||||
if {[system instandby]} {
|
||||
if {$runmode eq "cgi"} {
|
||||
lappend output [concat \
|
||||
"<span class=\"va stitem\">\n" \
|
||||
" <img class=va width=28 style=\"padding: 0 4px\"" \
|
||||
"src=/img/standby.png>\n" \
|
||||
" <span>System is in standby.</span>\n" \
|
||||
"</span>" \
|
||||
]
|
||||
} else {
|
||||
lappend output "System is in standby."
|
||||
}
|
||||
}
|
||||
|
||||
######################################################################
|
||||
# Upcoming recordings
|
||||
|
||||
set events [rsv list tbl_reservation \
|
||||
" where ersvtype = 3 and nsttime - [clock seconds] < $schedtime
|
||||
and nsttime > [clock seconds] "]
|
||||
foreach event $events {
|
||||
if {$runmode eq "cgi"} {
|
||||
set icon "175_1_11_Reservation_Record.png"
|
||||
lappend output [concat \
|
||||
"<span class=\"va stitem\">\n" \
|
||||
" <img class=va src=/images/$icon width=20>\n" \
|
||||
" <span>Will record <i>[$event name]</i>" \
|
||||
" on [$event channel_name] at"\
|
||||
" [clock format [$event get nsttime] -format {%H:%M}]" \
|
||||
" </span>\n" \
|
||||
"</span>\n" \
|
||||
} else {
|
||||
lappend output [concat \
|
||||
"Will record '[$event name]' " \
|
||||
"on [$event channel_name] at " \
|
||||
"[clock format [$event get nsttime] -format {%H:%M}]" \
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
######################################################################
|
||||
# Output
|
||||
|
||||
if {[llength $output]} {
|
||||
if {$runmode eq "cgi"} {
|
||||
puts [join $output "\n<br>\n"]
|
||||
} else {
|
||||
puts [join $output "\n"]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ $('#xepgnow')
|
||||
}
|
||||
|
||||
puts "
|
||||
<a href=/cgi-bin/settings.jim>
|
||||
<a href=/settings/settings.jim>
|
||||
<img border=0 height=14 src=/images/421_1_00_CH_Title_2R_Arrow.png>
|
||||
Visit settings to change EPG options.
|
||||
</a><br>
|
||||
@@ -1,7 +1,7 @@
|
||||
$(function() {
|
||||
|
||||
$('#epgswitch').button().click(function() {
|
||||
window.location = '/epg.shtml';
|
||||
window.location = '/epg/list.jim';
|
||||
});
|
||||
|
||||
$('button.nav').click(function() {
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
function refresh_files()
|
||||
{
|
||||
$('#backup_files').load('/cgi-bin/backup/files.jim', function() {
|
||||
$('#backup_files').load('files.jim', function() {
|
||||
$('input.restore').change(function() {
|
||||
$('#restore_button').removeAttr('disabled')
|
||||
.button('option', 'disabled', false);
|
||||
@@ -20,7 +20,7 @@ $(document).ready(function() {
|
||||
|
||||
$('#backup_button').click(function() {
|
||||
$('#backup_working').slideDown();
|
||||
$('#results').load('/cgi-bin/backup/backup.jim?' +
|
||||
$('#results').load('backup.jim?' +
|
||||
$('#backup_name').serialize(), function() {
|
||||
$('#results').slideDown(function() {
|
||||
$('#backup_working').slideUp();
|
||||
@@ -32,7 +32,7 @@ $(document).ready(function() {
|
||||
var backup = $('input.restore:checked').val();
|
||||
if (confirm('Confirm deletion of ' + backup))
|
||||
{
|
||||
$('#results').load('/cgi-bin/backup/delete.jim?' +
|
||||
$('#results').load('delete.jim?' +
|
||||
$('input.restore').serialize(), function() {
|
||||
$('#results').slideDown(function() {
|
||||
refresh_files();
|
||||
@@ -42,7 +42,7 @@ $(document).ready(function() {
|
||||
});
|
||||
$('#view_button').click(function() {
|
||||
var backup = $('input.restore:checked').val();
|
||||
$('#results').load('/cgi-bin/backup/view.jim?' +
|
||||
$('#results').load('view.jim?' +
|
||||
$('input.restore').serialize(), function() {
|
||||
$('#results').slideDown(function() {
|
||||
refresh_files();
|
||||
@@ -54,7 +54,7 @@ $(document).ready(function() {
|
||||
if (confirm('!!!!!!!!!!!!!!!!!!!!!!!!! PLEASE CONFIRM !!!!!!!!!!!!!!!!!!!!!!!!!\n\nAre you sure you wish to erase all scheduled recordings and favourite channels and then restore them from\n' + backup + '?'))
|
||||
{
|
||||
$('#restore_working').slideDown();
|
||||
$('#results').load('/cgi-bin/backup/restore.jim?' +
|
||||
$('#results').load('restore.jim?' +
|
||||
$('input.restore').serialize(), function() {
|
||||
$('#results').slideDown(function() {
|
||||
$('#restore_working').slideUp();
|
||||
@@ -3,8 +3,9 @@
|
||||
source /mod/webif/lib/setup
|
||||
require altrow rsv.class
|
||||
|
||||
noheader
|
||||
jscss /cgi-bin/backup/backup.js
|
||||
jscss backup.js
|
||||
header
|
||||
|
||||
puts {
|
||||
<h2>Backup/Restore</h2>
|
||||
|
||||
@@ -65,3 +66,5 @@ puts {
|
||||
</div>
|
||||
}
|
||||
|
||||
footer
|
||||
|
||||
49
webif/html/browse/aexpiry.jim
Executable file
49
webif/html/browse/aexpiry.jim
Executable file
@@ -0,0 +1,49 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require browse.class
|
||||
|
||||
# dir=%2Fmedia%2FMy+Video%2FWeatherview
|
||||
# aexpiry_days=13
|
||||
|
||||
set dir [cgi_get dir "-"]
|
||||
if {$dir eq "-"} exit
|
||||
|
||||
set act [cgi_get act "update"]
|
||||
|
||||
if {$act eq "fetch"} {
|
||||
httpheader "application/json"
|
||||
set data [{dir expiry} $dir]
|
||||
puts "{"
|
||||
puts " \"days\": \"$data(days)\","
|
||||
puts " \"keep\": \"$data(keep)\","
|
||||
puts " \"type\": \"$data(type)\","
|
||||
puts " \"keepnew\": \"$data(keepnew)\""
|
||||
puts "}"
|
||||
exit
|
||||
}
|
||||
|
||||
if {$act eq "remove"} {
|
||||
httpheader
|
||||
if {[file exists "$dir/.autoexpire"]} {
|
||||
file delete "$dir/.autoexpire"
|
||||
}
|
||||
exit
|
||||
}
|
||||
|
||||
httpheader
|
||||
|
||||
set data(days) [cgi_get aexpiry_days 0]
|
||||
set data(keep) [cgi_get aexpiry_min 0]
|
||||
set data(type) [cgi_get aexpiry_timetype recorded]
|
||||
set data(keepnew) [cgi_get aexpiry_unwatched 0]
|
||||
|
||||
if {![file isdirectory $dir]} {
|
||||
puts "Not a directory."
|
||||
exit
|
||||
}
|
||||
|
||||
{dir expiry} $dir $data
|
||||
puts "Ok."
|
||||
|
||||
@@ -29,6 +29,8 @@ if {[system pkginst ffmpeg]} {
|
||||
|
||||
puts { <li><a href=#vthm>View Thumbnail</a></li> }
|
||||
|
||||
puts { <li class=bookmark><a href=#bmarks>Bookmarks</a></li> }
|
||||
|
||||
if $nicesplice {
|
||||
puts {
|
||||
<li class="cut"><a href=#crop>Crop</a></li>
|
||||
@@ -38,6 +40,16 @@ if $nicesplice {
|
||||
puts {
|
||||
<li class=separator><a href=#lock>Toggle Lock</a></li>
|
||||
<li><a href=#new>Toggle New</a></li>
|
||||
}
|
||||
|
||||
if {[llength $plugins(menu)]} {
|
||||
foreach plugin $plugins(menu) {
|
||||
lassign $plugin tag options
|
||||
puts "<li class=$tag><a href=#$tag>$options(desc)</a></li>"
|
||||
}
|
||||
}
|
||||
|
||||
puts {
|
||||
</ul>
|
||||
|
||||
<ul id=ooptmenu class=contextMenu style="width: 160px">
|
||||
@@ -80,7 +92,7 @@ if $flatten {
|
||||
}
|
||||
|
||||
puts {
|
||||
<li class=clock><a href=#expire>Auto-Expire</a></li>
|
||||
<li class=clock><a href=#expire>Auto-Expire Options</a></li>
|
||||
}
|
||||
|
||||
if {[system pkginst ffmpeg]} {
|
||||
@@ -90,6 +102,13 @@ if {[system pkginst ffmpeg]} {
|
||||
}
|
||||
}
|
||||
|
||||
if {[llength $plugins(dmenu)]} {
|
||||
foreach plugin $plugins(dmenu) {
|
||||
lassign $plugin tag options
|
||||
puts "<li class=$tag><a href=#$tag>$options(desc)</a></li>"
|
||||
}
|
||||
}
|
||||
|
||||
puts {
|
||||
</ul>
|
||||
|
||||
@@ -259,28 +278,76 @@ puts {
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div id=aexpiry title="Auto-Expiry" style="display: none">
|
||||
<div id=aexpiry title="Auto-Expiry Settings"
|
||||
style="display: none; line-height: 1em;">
|
||||
<form id=aexpiry_form>
|
||||
<input type=hidden name="dir" id="aexpiry_ldir" value="">
|
||||
}
|
||||
puts {
|
||||
<table border=0>
|
||||
<tr>
|
||||
<th>
|
||||
|
||||
<tr><th align=right>
|
||||
<label for="aexpiry_days">
|
||||
<b>Expire after</b>
|
||||
<span class=blood>(in days)</span>
|
||||
<b>Remove recordings after</b> (in days)
|
||||
<br><span class=footnote>
|
||||
(Leave blank to skip age check)
|
||||
</span>
|
||||
</label>
|
||||
</th>
|
||||
<td>
|
||||
</th><td>
|
||||
<input name="aexpiry_days" id="aexpiry_days"
|
||||
type=number value=0 size=5 maxlength=3
|
||||
class="text ui-widget-content ui-corner-all">
|
||||
</td>
|
||||
</tr>
|
||||
</td></tr>
|
||||
|
||||
<tr><th>
|
||||
<label for="aexpiry_min">
|
||||
<b>Keep at least</b>
|
||||
(number of recordings)
|
||||
<br>
|
||||
<span class=footnote>(Oldest will be deleted first)
|
||||
</span>
|
||||
</label>
|
||||
</th><td>
|
||||
<input name="aexpiry_min" id="aexpiry_min"
|
||||
type=number value=0 size=5 maxlength=3
|
||||
class="text ui-widget-content ui-corner-all">
|
||||
</td></tr>
|
||||
|
||||
<tr><th>
|
||||
<label for="aexpiry_timetype">
|
||||
<b>For date of recording, use</b>
|
||||
</label>
|
||||
</th><td>
|
||||
<input name="aexpiry_timetype" id="aexpiry_timetype0"
|
||||
type=radio value=0 checked
|
||||
class="text ui-widget-content ui-corner-all">
|
||||
Recording end time
|
||||
<br>
|
||||
<input name="aexpiry_timetype" id="aexpiry_timetype1"
|
||||
type=radio value=1
|
||||
class="text ui-widget-content ui-corner-all">
|
||||
<span>
|
||||
When last watched
|
||||
<span class=bfootnote>(or end time if unwatched)</span>
|
||||
</span>
|
||||
</td></tr>
|
||||
|
||||
<tr><th>
|
||||
<label for="aexpiry_unwatched">
|
||||
<b>Never delete unwatched recordings</b>
|
||||
</label>
|
||||
</th><td>
|
||||
<input name="aexpiry_unwatched" id="aexpiry_unwatched"
|
||||
type=checkbox value=1
|
||||
class="ui-widget-content ui-corner-all">
|
||||
</td></tr>
|
||||
|
||||
</table>
|
||||
<div id=aexpiry_working class=hidden>
|
||||
<img src=/img/loading.gif> Applying auto-expiry...
|
||||
<img src=/img/loading.gif> Applying changes...
|
||||
</div>
|
||||
<div id=aexpiry_loading class=hidden>
|
||||
<img src=/img/loading.gif> Retrieving data...
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
49
webif/html/browse/bookmarks/index.jim
Executable file
49
webif/html/browse/bookmarks/index.jim
Executable file
@@ -0,0 +1,49 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require ts.class pretty_size
|
||||
|
||||
jscss script.js style.css
|
||||
jqplugin touchpunch
|
||||
header
|
||||
|
||||
set rfile [cgi_get file]
|
||||
set ts [ts fetch $rfile]
|
||||
set dir [string map {' \\'} [file dirname $rfile]]
|
||||
set erfile [string map {' \\'} $rfile]
|
||||
|
||||
set len [$ts duration 1]
|
||||
|
||||
puts "
|
||||
<script type=text/javascript>
|
||||
var initbookmarks = '[$ts bookmarks]';
|
||||
var len = [$ts duration 1];
|
||||
var file = '$erfile';
|
||||
var dir = '$dir';
|
||||
</script>
|
||||
<fieldset class=cleft>
|
||||
<legend>Manage Bookmarks</legend>
|
||||
|
||||
<table class=keyval cellpadding=5>
|
||||
<tr><th>File:</th><td>$rfile</td></tr>
|
||||
<tr><th>Length:</th><td>[clock format $len -format %T]</td></tr>
|
||||
<tr><th>Size:</th><td>[pretty_size [$ts size]] ([$ts get definition])</td></tr>
|
||||
<tr><th>Bookmarks<br><span class=footnote>(enter in seconds)</span></th><td>
|
||||
<input id=bookmarks size=80 maxlength=255 init=\"[$ts bookmarks]\"
|
||||
value=\"\" />
|
||||
<button id=update>Update</button>
|
||||
<br>
|
||||
<span id=bookmarkstime></span>
|
||||
</td></tr><tr><td align=right>
|
||||
<button class=left id=addbmark>Add Bookmark</button>
|
||||
<button class=left id=delbmark>Remove Bookmark</button>
|
||||
</td><td><div id=slider></div></td></tr>
|
||||
</table>
|
||||
<div id=buttons>
|
||||
<button id=save>Save Bookmarks</button>
|
||||
<button id=back>Back to Media Browser</button>
|
||||
</div>
|
||||
<div id=results class=\"hidden blood\"></div>
|
||||
"
|
||||
|
||||
20
webif/html/browse/bookmarks/save.jim
Executable file
20
webif/html/browse/bookmarks/save.jim
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require ts.class
|
||||
|
||||
httpheader
|
||||
|
||||
set file [cgi_get file]
|
||||
set bookmarks [cgi_get bookmarks ""]
|
||||
|
||||
if {[system inuse $file]} {
|
||||
puts "This file is in use. Cannot process at the moment."
|
||||
exit
|
||||
}
|
||||
|
||||
set ts [ts fetch $file]
|
||||
$ts setbookmarks [split [string trim $bookmarks]]
|
||||
puts "Bookmarks saved successfully."
|
||||
|
||||
132
webif/html/browse/bookmarks/script.js
Normal file
132
webif/html/browse/bookmarks/script.js
Normal file
@@ -0,0 +1,132 @@
|
||||
var curval = 0;
|
||||
var $slider;
|
||||
|
||||
function
|
||||
setvals()
|
||||
{
|
||||
values = $.trim($('#bookmarks').val()).split(/ +/);
|
||||
if (!values.length || values[0] == '')
|
||||
{
|
||||
refreshtimes();
|
||||
return;
|
||||
}
|
||||
nvalues = [];
|
||||
$.each(values, function(k, v) {
|
||||
if (v > len)
|
||||
v = len;
|
||||
if (v < 0)
|
||||
v = 0;
|
||||
nvalues.push(v);
|
||||
});
|
||||
values = nvalues;
|
||||
$('#bookmarks').val(values.join(' '));
|
||||
sortmarks();
|
||||
refreshtimes();
|
||||
}
|
||||
|
||||
function
|
||||
draw_slider()
|
||||
{
|
||||
if ($slider)
|
||||
$slider.slider('destroy');
|
||||
else
|
||||
$slider = $('#slider');
|
||||
setvals();
|
||||
values = $.trim($('#bookmarks').val()).split(/ +/);
|
||||
if (!values.length || values[0] == '')
|
||||
{
|
||||
$slider = null;
|
||||
return;
|
||||
}
|
||||
$slider.slider({
|
||||
min: 0,
|
||||
max: len,
|
||||
step: 1,
|
||||
values: values,
|
||||
start: function(event, ui) {
|
||||
curval = ui.value;
|
||||
},
|
||||
stop: function(event, ui) {
|
||||
curval = ui.value;
|
||||
sortmarks();
|
||||
refreshtimes();
|
||||
},
|
||||
slide: function(event, ui) {
|
||||
var marks = '';
|
||||
for (var i = 0; i < ui.values.length; ++i)
|
||||
marks += ui.values[i] + ' ';
|
||||
$('#bookmarks').val($.trim(marks));
|
||||
setvals();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function
|
||||
refreshtimes()
|
||||
{
|
||||
var t = '';
|
||||
values = $.trim($('#bookmarks').val()).split(/ +/);
|
||||
if (!values.length || values[0] == '')
|
||||
{
|
||||
$('#bookmarkstime').text(t);
|
||||
return;
|
||||
}
|
||||
$.each(values, function(k, v) {
|
||||
t += new Date(null, null, null, null, null, v)
|
||||
.toTimeString().match(/\d{2}:\d{2}:\d{2}/)[0] + ' ';
|
||||
});
|
||||
$('#bookmarkstime').text(t);
|
||||
}
|
||||
|
||||
function
|
||||
sortmarks()
|
||||
{
|
||||
var a = $.trim($('#bookmarks').val()).split(/ +/);
|
||||
a.sort(function(a, b){return a-b});
|
||||
$('#bookmarks').val(a.join(" "));
|
||||
}
|
||||
|
||||
$(function() {
|
||||
|
||||
$('#bookmarks').val($('#bookmarks').attr('init'));
|
||||
draw_slider();
|
||||
|
||||
$('#addbmark').button({icons: {primary: "ui-icon-plus"}, text: false})
|
||||
.on('click', function() {
|
||||
$('#bookmarks').val('0 ' + $('#bookmarks').val());
|
||||
draw_slider();
|
||||
});
|
||||
|
||||
$('#delbmark').button({icons: {primary: "ui-icon-minus"}, text: false})
|
||||
.on('click', function() {
|
||||
var cur = $('#bookmarks').val();
|
||||
cur = $.trim(cur.replace(
|
||||
new RegExp('(^| )' + curval + '( |$)', ''), ' '));
|
||||
$('#bookmarks').val(cur);
|
||||
draw_slider();
|
||||
});
|
||||
|
||||
$('#save').button({icons: {primary: "ui-icon-disk"}})
|
||||
.on('click', function() {
|
||||
$.post('save.jim', {
|
||||
file: file,
|
||||
bookmarks: $('#bookmarks').val()
|
||||
}, function(data) {
|
||||
$('#results').html(data)
|
||||
.slideDown('slow').delay(5000).slideUp('slow');
|
||||
});
|
||||
});
|
||||
|
||||
$('#back').button({icons: {primary: "ui-icon-arrowreturnthick-1-w"}})
|
||||
.on('click', function() {
|
||||
window.location = '../index.jim?dir=' + dir;
|
||||
});
|
||||
|
||||
$('#update').button()
|
||||
.on('click', function() {
|
||||
draw_slider();
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
16
webif/html/browse/bookmarks/style.css
Normal file
16
webif/html/browse/bookmarks/style.css
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
#slider
|
||||
{
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
#buttons
|
||||
{
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
#buttons2
|
||||
{
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
@@ -9,13 +9,14 @@ jscss crop.js
|
||||
header
|
||||
|
||||
set rfile [cgi_get file]
|
||||
set invert [cgi_get invert 0]
|
||||
set ts [ts fetch $rfile]
|
||||
set dir [file dirname $rfile]
|
||||
|
||||
set len [$ts duration 1]
|
||||
|
||||
puts "
|
||||
<fieldset class=cleft>
|
||||
<fieldset>
|
||||
<legend>Crop recording</legend>
|
||||
|
||||
<table class=keyval cellpadding=5>
|
||||
@@ -24,12 +25,9 @@ puts "
|
||||
<tr><th>Size:</th><td>[pretty_size [$ts size]] ([$ts get definition])</td></tr>
|
||||
<tr><th>Bookmarks:</th><td>[$ts get bookmarks] @ "
|
||||
|
||||
set flag 0
|
||||
foreach b [$ts bookmarks] {
|
||||
if $flag { puts -nonewline ", " }
|
||||
incr flag
|
||||
puts -nonewline [clock format $b -format "%T"]
|
||||
}
|
||||
puts [join [lmap i [$ts bookmarks 1] {
|
||||
clock format $i -format "%T"
|
||||
}] ", "]
|
||||
|
||||
puts "</td></tr><tr><th>File</th><td>"
|
||||
|
||||
@@ -41,10 +39,16 @@ proc div {type left right} {
|
||||
$type</div>"
|
||||
}
|
||||
|
||||
set bookmarks {}
|
||||
if {$invert} {
|
||||
append bookmarks "0 "
|
||||
}
|
||||
append bookmarks [$ts bookmarks]
|
||||
|
||||
set keeping 0
|
||||
set last 0
|
||||
set start -1
|
||||
foreach b [$ts bookmarks] {
|
||||
foreach b $bookmarks {
|
||||
if {$start < 0} {
|
||||
set start $b
|
||||
continue
|
||||
@@ -94,6 +98,7 @@ puts "
|
||||
></span>
|
||||
|
||||
<div id=cropdiv style=\"padding: 1em\">
|
||||
<button id=invert invert=$invert>Invert selection</button>
|
||||
<button id=cropit>Perform crop operation</button>
|
||||
</div>
|
||||
|
||||
@@ -101,9 +106,9 @@ puts "
|
||||
Cropping: <div id=progressbar></div>
|
||||
</div>
|
||||
|
||||
<button id=back class=hidden>Back to media list</button>
|
||||
<button id=back>Back to media list</button>
|
||||
|
||||
<div id=output class=pre style=\"margin-top: 10px\"></div>
|
||||
<div id=output class=\"hidden pre\" style=\"margin-top: 10px\"></div>
|
||||
</fieldset>
|
||||
|
||||
"
|
||||
@@ -24,8 +24,9 @@ $('#cropit').button().click(function() {
|
||||
$('#cropdiv').hide('slow');
|
||||
$('#progressdiv').show('slow');
|
||||
handle = setInterval("update()", 1000);
|
||||
$('#output').text('Please do not interrupt...')
|
||||
.load('execute.jim?file=' + $('#params').attr('file'),
|
||||
$('#output').show().text('Please do not interrupt...')
|
||||
.load('execute.jim?file=' + $('#params').attr('file') +
|
||||
'&invert=' + $('#invert').attr('invert'),
|
||||
function() {
|
||||
clearInterval(handle);
|
||||
handle = 0;
|
||||
@@ -34,5 +35,10 @@ $('#cropit').button().click(function() {
|
||||
});
|
||||
});
|
||||
|
||||
$('#invert').button().on('click', function() {
|
||||
window.location = 'crop.jim?file=' + $('#params').attr('file') +
|
||||
'&invert=' + ($(this).attr('invert') == '1' ? '0' : '1');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -7,6 +7,7 @@ require ts.class pretty_size system.class
|
||||
httpheader
|
||||
|
||||
set rfile [cgi_get file]
|
||||
set invert [cgi_get invert]
|
||||
|
||||
if {[system inuse $rfile]} {
|
||||
puts "This file is in use. Cannot process at the moment."
|
||||
@@ -25,7 +26,7 @@ set origdir "$dir/_original"
|
||||
if {![file exists $origdir]} { file mkdir $origdir }
|
||||
|
||||
set shname [file tail $base]
|
||||
puts "Processing $shname"
|
||||
puts "Processing $shname (inverted: $invert)"
|
||||
|
||||
if {[file exists "$origdir/$shname.ts"]} {
|
||||
puts "This recording already exists within _original"
|
||||
@@ -33,24 +34,47 @@ if {[file exists "$origdir/$shname.ts"]} {
|
||||
exit
|
||||
}
|
||||
|
||||
set bookmarks [$ts bookmarks]
|
||||
|
||||
puts "Moving recording to $origdir"
|
||||
foreach f [glob -nocomplain "${base}.*"] {
|
||||
set tail [file tail $f]
|
||||
puts " $tail"
|
||||
file rename $f "$origdir/$tail"
|
||||
|
||||
set tail [file tail $base]
|
||||
foreach ext $tsgroup {
|
||||
if {![file exists "$base.$ext"]} continue
|
||||
puts " $tail.$ext"
|
||||
file rename "$base.$ext" "${origdir}/$tail.$ext"
|
||||
}
|
||||
|
||||
puts [exec /mod/bin/nicesplice \
|
||||
-in "$origdir/$shname" \
|
||||
-out "$dir/$shname" \
|
||||
-cutBookMarks]
|
||||
set cmd [list /mod/bin/nicesplice \
|
||||
-in "$origdir/$shname" \
|
||||
-out "$dir/$shname"]
|
||||
|
||||
if {$invert} {
|
||||
if {[expr [llength $bookmarks] % 2] != 0} {
|
||||
lappend bookmarks [$ts duration 1]
|
||||
}
|
||||
foreach k [array names bookmarks] {
|
||||
lappend cmd -cut $($k * 10) $($bookmarks($k) * 10)
|
||||
}
|
||||
} else {
|
||||
lappend cmd "-cutBookMarks"
|
||||
}
|
||||
|
||||
puts "CMD: $cmd"
|
||||
|
||||
puts [exec {*}$cmd]
|
||||
#puts [exec /mod/bin/nicesplice \
|
||||
# -in "$origdir/$shname" \
|
||||
# -out "$dir/$shname" \
|
||||
# -cutBookMarks]
|
||||
|
||||
set newname "$shname-[clock seconds]"
|
||||
puts "Renaming file group to $newname"
|
||||
ts renamegroup "$dir/$shname.ts" $newname
|
||||
exec /mod/bin/hmt "+setfilename=$newname" "$dir/$newname.hmt"
|
||||
# New nicesplice shrinks whilst cropping.
|
||||
exec /mod/bin/hmt "+shrunk" "$dir/$newname.hmt"
|
||||
# No longer required - nicesplice now sets this flag.
|
||||
#exec /mod/bin/hmt "+shrunk" "$dir/$newname.hmt"
|
||||
|
||||
set croptime [expr [expr [clock milliseconds] - $cropstart] / 1000.0]
|
||||
puts "Time taken: $croptime"
|
||||
@@ -42,20 +42,22 @@ exec wget -O "$rfile.decrypting" $url
|
||||
|
||||
puts "Moving recording to $origdir"
|
||||
|
||||
foreach f [glob -nocomplain "${base}.*"] {
|
||||
if {[file extension $f] eq ".decrypting"} { continue }
|
||||
set tail [file tail $f]
|
||||
puts " $tail"
|
||||
file rename $f "${origdir}/$tail"
|
||||
set tail [file tail $base]
|
||||
foreach ext $tsgroup {
|
||||
if {![file exists "$base.$ext"]} continue
|
||||
puts " $tail.$ext"
|
||||
file rename "$base.$ext" "${origdir}/$tail.$ext"
|
||||
}
|
||||
|
||||
file rename "$rfile.decrypting" $rfile
|
||||
file touch $rfile "$origdir/$tail.ts"
|
||||
|
||||
foreach ext {nts hmt thm} {
|
||||
set sidecar "$shname.$ext"
|
||||
if {[file exists "$origdir/$sidecar"]} {
|
||||
puts "Copying back sidecar $ext"
|
||||
file copy "$origdir/$sidecar" "$dir/$sidecar"
|
||||
file touch "$dir/$sidecar" "$origdir/$tail.ts"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require pretty_size
|
||||
require pretty_size progressbar
|
||||
|
||||
httpheader
|
||||
|
||||
@@ -79,6 +79,11 @@ if {$type eq "ts"} {
|
||||
<td>[$ts duration] minute(s).
|
||||
<font class=also>(Scheduled: [expr [$ts get scheddur] / 60])
|
||||
</font></td>
|
||||
</tr><tr>
|
||||
<th>Resumes</th>
|
||||
<td>[expr [$ts get resume] / 60] minutes into recording.
|
||||
[progressbar $([$ts get resume] * 100 / [$ts duration 1])]
|
||||
</td>
|
||||
</tr><tr>
|
||||
<th>Size</th>
|
||||
<td>$sz</td>
|
||||
@@ -111,7 +116,10 @@ puts "</td>
|
||||
<td>[$ts get flags]
|
||||
"
|
||||
if {[$ts get bookmarks]} {
|
||||
puts " \[Bookmarks: [$ts get bookmarks]\]"
|
||||
puts " \[Bookmarks: [$ts get bookmarks] @ [join \
|
||||
[lmap i [$ts bookmarks 1] {
|
||||
clock format $i -format "%T"
|
||||
}] ", "]"
|
||||
}
|
||||
|
||||
puts "</tr>"
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user