Compare commits

..

1 Commits
0.9.7 ... 0.8.3

Author SHA1 Message Date
hummypkg
3fc4e3848e tag 0.8.3
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/tags/0.8.3@544 2a923420-c742-0410-a762-8d5b09965624
2011-12-05 21:46:01 +00:00
902 changed files with 3406 additions and 7978 deletions

View File

@@ -1,9 +1,11 @@
Package: webif
Priority: optional
Section: web
Version: 0.9.7
Version: 0.8.3
Architecture: mipsel
Maintainer: af123@hummypkg.org.uk
Depends: webif-channelicons(>=1.0.1),mongoose(>=3.0-7),jim(>=0.73-1),jim-oo,jim-sqlite3(>=0.73),jim-cgi(>=0.5),service-control(>=1.2),busybox(>=1.19.3-1),lsof,epg(>=1.0.9),hmt(>=1.1.6),ssmtp,anacron,trm,openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts
Suggests: ffmpeg,webif-iphone
Depends: mongoose(>=3.0-2),jim(>=0.71-1),jim-sqlite3(>=0.71-1),jim-cgi(>=0.4-1),jim-oo,jim-pack,service-control,busybox(>=1.19.3-1),lsof,epg(>=1.0.8),hmt(>=1.1.1),ssmtp
Replaces: af123-webif
Conflicts: af123-webif
Suggests: ffmpeg,webif-iphone,nicesplice
Description: An evolving web interface for the Humax.

View File

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

View File

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

View File

@@ -13,23 +13,12 @@ puts ""
cgi_input
#cgi_dump
set now [clock seconds]
set file [file tail [cgi_get file \
[clock format $now -format "auto-%Y-%b-%d-%H:%M"]]]
if {[string match {auto-*} $file]} {
# Delete any automatic backups over 7 days old.
set mt $(15 * 86400)
foreach af [glob -nocomplain "$dir/auto-*"] {
set aft [file mtime $af]
set diff $($now - $aft)
if {$diff > $mt} {
puts "Removing $af"
file delete $af
}
}
if {![dict exists $_cgi file]} {
puts "No filename supplied."
exit
}
set file [file tail [dict get $_cgi file]]
set ffile "/$dir/$file.rbk"
if {[file exists $ffile]} {

View File

@@ -20,18 +20,7 @@ if {![file isdirectory $dir]} {
exit
}
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"]]
set backups [glob -nocomplain "$dir/*.rbk"]
if {![llength $backups]} {
empty

View File

@@ -53,9 +53,6 @@ foreach line $data {
lappend vars $f [lindex $vals $i]
}
# Don't restore DSO events.
if {$vars(ersvtype) == 11} { continue }
set rsv [rsv new $vars]
# Need to fix up channel and CRID mappings in case something has
@@ -92,14 +89,6 @@ puts "Restoring favourite channels..."
$rsvdb query {begin transaction;}
$rsvdb query {delete from channel.TBL_FAV}
$rsvdb query {drop table if exists pending.fav}
$rsvdb query {create table pending.fav (
favIdx integer primary key autoincrement unique,
hSvc integer(4),
eFavGroup integer(4),
[eSvcType] integer(4)
)}
set grp 0
foreach line $data {
set vals [split $line "\t"]
@@ -117,13 +106,13 @@ foreach line $data {
puts " $chan"
if {$hsvc eq ""} {
if {!$hsvc} {
puts " Cannot map channel name to service."
continue
}
set query "
insert into pending.fav(hSvc, eFavGroup, eSvcType)
insert into channel.TBL_FAV(hSvc, eFavGroup, eSvcType)
values($hsvc, $group, $type);
"

View File

@@ -2,80 +2,32 @@
package require cgi
source /mod/var/mongoose/lib/setup
require ts.class pretty_size system.class settings.class escape
require ts.class pretty_size system.class
puts "Content-Type: text/html"
puts ""
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}
set ignore {.nts .thm .hmt .hmi}
set include {.ts .avi .mpg .mpeg .wmv .mkv .mp3 .mp4 .mov}
cgi_input
#cgi_dump
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 model [system model]
set dustbin [system dustbin 1]
proc icon {img {hover ""} {extra ""}} {
puts -nonewline "<img src=$img class=va height=21 $extra"
if {$hover ne ""} {
puts -nonewline " alt=\"$hover\" title=\"$hover\""
}
puts ">"
}
#set env(REQUEST_URI) ''
#set _cgi(dir) "/media/My Video/\[Don't Die Young\]"
proc directory {file bfile} {
global flatten
regsub -all " +" $bfile "" tbfile
puts "<div class=va>"
set img "/images/711_1_09_Media_Folder.png"
if {$bfile eq $::dustbin} { set img "/img/Dustbin_Folder.png" }
puts "<img border=0 class=va id=\"img$tbfile\" src=$img>"
puts "<img border=0 class=va id=\"img$tbfile\"
src=/images/711_1_09_Media_Folder.png>"
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 "<a href=\"$::env(REQUEST_URI)?dir=[cgi_quote_url $file]\"
file=\"$file\">"
puts "$bfile</a><span class=filesize id=\"$tbfile\">
</span>"
set noflat 0
if $flatten {
if {[string match {\[*\]} [file tail $file]]} { set noflat 1 }
if {[file exists "$file/.noflatten"]} { set noflat 1 }
if $noflat { icon "/img/flat-tyre.png" "No-flatten" }
}
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>"
</span></div>"
}
proc entry {file} {{i 0}} {
@@ -91,8 +43,7 @@ proc entry {file} {{i 0}} {
if {$ext in $::ignore || $ext ni $::include} { continue }
file stat $file st
set rsz $st(size)
set sz [pretty_size $rsz]
set sz [pretty_size $st(size)]
set base [file rootname $file]
@@ -100,12 +51,6 @@ 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
@@ -115,25 +60,22 @@ proc entry {file} {{i 0}} {
set new 0
if {$type eq "ts"} {
if {[$ts flag "New"] > 0} { set new 1 }
} elseif {$type eq "gen"} {
if {![file exists "${base}.hmi"]} { set new 1 }
} else {
if {![file exists "[file rootname $file].hmi"]} { set new 1 }
}
if {$new} { append img _New }
set fscl "fs"
set synopsis ""
if {$type eq "ts"} {
set fscl "fs fsts"
set synopsis [cgi_quote_html [$ts get synopsis]]
}
puts "
<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=#>
<a class=bf file=\"$file\" type=$type href=#>
$bfile
</a>
"
@@ -148,7 +90,6 @@ proc entry {file} {{i 0}} {
set odencd 1
set def unknown
set bx 0
set dlna 0
if {$type eq "ts"} {
# HD / SD
if {[$ts get definition] eq "HD"} {
@@ -158,33 +99,32 @@ proc entry {file} {{i 0}} {
set def SD
set img "172_1_26_SD"
}
icon "/images/$img.png"
puts "<img class=va src=/images/$img.png height=21>"
# Locked
if {[$ts flag "Locked"] > 0} {
set locked 1
icon "/images/178_1_00_Icon_Lock.png" "Locked"
puts "<img class=va src=/images/178_1_00_Icon_Lock.png
height=21>"
}
# Encrypted
if {[$ts flag "Encrypted"] > 0} {
set encd 1
icon "/images/749_1_26_Video_Encryption.png" ""
puts "<img class=va
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
icon "/img/Decrypted.png" "Decrypted"
}
# Guidance
if {[$ts flag "Guidance"] > 0} {
icon "/images/174_1_26_GuidancePolicy.png"
}
# Indexed
if {$::model eq "HDR" && [llength [$ts dlnaloc]]} {
icon "/img/dlna.png" "Indexed by DLNA Server"
set dlna 1
puts "<img class=va
src=/images/174_1_26_GuidancePolicy.png
height=21>"
}
set bx [$ts get bookmarks]
@@ -196,8 +136,7 @@ proc entry {file} {{i 0}} {
<a href=#>
<img class=\"opt va\" border=0 width=45 type=$type did=$i
locked=$locked encd=$encd def=$def new=$new bx=$bx
rsize=$rsz
odencd=$odencd dlna=$dlna
odencd=$odencd
src=/images/181_1_00_Help5_OPT_Plus.png>
</a>
<div class=\"results blood\" style=\"margin: 0 0 0 5em\"></div>
@@ -214,23 +153,100 @@ header
puts {
<link href=/css/jquery.contextMenu.css rel=stylesheet type=text/css />
<script type=text/javascript src=/js/jquery.contextMenu.js></script>
<link href=/css/jquery.bar.css rel=stylesheet type=text/css />
<script type=text/javascript src=/js/jquery.bar.js></script>
<script type=text/javascript src=/js/enadis.js></script>
<script type="text/javascript" src="/js/jquery.contextMenu.js"></script>
<ul id=optmenu class=contextMenu>
<li class=delete><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>
}
if {[system model] eq "HDR"} {
puts { <li class="separator"><a href=#decrypt>Decrypt</a></li> }
}
if $nicesplice {
puts { <li class="cut separator"><a href=#crop>Crop</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 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>
<script type=text/javascript src=/cgi-bin/browse/browse.js></script>
<link type=text/css rel=stylesheet href=/cgi-bin/browse/style.css />
}
source /mod/var/mongoose/cgi-bin/browse/assets.jim
puts "
<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;\">
"
puts "<span style=\"display:none\" id=dir>$dir</span>"
# Breadcrumb path
puts "
<fieldset style=\"margin: 1em\">
<legend style=\"font-size: 1.5em; padding: 0 0.5em 0.5em 0.5em;\">
"
set stub ""
foreach part [split $dir /] {
if {$stub eq "/"} { set name $part } else { set name "/$part" }
@@ -252,84 +268,24 @@ if {$parent ne ""} {
"
}
proc s_time {a b} {
global dir
# Strip double slashes
regsub -all -- {\/+} "$dir/*" "/" dir
set a "$dir/$a"
set b "$dir/$b"
# Escape square brackets (for glob)
regsub -all {([\\[])} $dir {\\\1} dir
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
foreach file [lsort [glob -nocomplain "$dir"]] {
entry $file
}
set files [readdir -nocomplain $dir]
switch $order {
1 { set files [lsort -command s_time $files] }
default { set files [lsort $files] }
}
foreach file $files { entry "$dir/$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=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>

View File

@@ -1,168 +0,0 @@
#!/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 {$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>
<li><a href=#mpg>Extract to MPG</a></li>
}
}
if $nicesplice {
puts {
<li class="cut"><a href=#crop>Crop</a></li>
<li class="cut"><a href=#chunk>Split (45m parts)</a></li>
}
}
puts {
<li class=separator><a href=#lock>Toggle Lock</a></li>
<li><a href=#enc>Toggle Enc</a></li>
<li><a href=#new>Toggle New</a></li>
</ul>
<ul id=doptmenu class=contextMenu style="width: 160px">
<li class=delete><a href=#delete>Delete</a></li>
<li class=cut><a href=#cut>Cut to clipboard</a></li>
<li class=pwcopy><a href=#copy>Copy to clipboard</a></li>
<li class=separator><a href=#rename>Rename</a></li>
<li class=separator><a href=#resetnew>Reset new flag</a></li>
}
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

@@ -1,52 +0,0 @@
#!/mod/bin/jimsh
package require sqlite3
package require cgi
source /mod/var/mongoose/lib/setup
require ts.class system.class
puts "Content-Type: text/html\r\n\r\n"
cgi_input
#cgi_dump
set rfile [cgi_get file]
set ts [ts fetch $rfile]
set dir [file dirname $rfile]
set len [$ts duration 1]
header
puts "
<link href=/css/jquery.progressbar.css rel=stylesheet type=text/css />
<script type=text/javascript src=/js/jquery.progressbar.js></script>
<script type=text/javascript src=audio.js></script>
<fieldset class=cleft>
<legend>Audio Extraction</legend>
<table class=keyval cellpadding=5>
<tr><th>File:</th><td>$rfile</td></tr>
<tr><th>Length:</th><td>[clock format $len -format "%T"]</td></tr>
</table>
<span class=hidden id=params
dir=\"[cgi_quote_url $dir]\"
rfile=\"[cgi_quote_url $rfile]\"
></span>
<div id=audiodiv style=\"padding: 1em\">
<button id=audioit>Perform audio extraction</button>
</div>
<div id=progressdiv class=hidden>
Extracting audio: <div id=progressbar></div>
</div>
<button id=back class=hidden>Back to media list</button>
<div id=output class=pre style=\"margin-top: 10px\"></div>
</fieldset>
"

View File

@@ -1,35 +0,0 @@
var handle = 0;
function update()
{
$.get('progress.jim?file=' + $('#params').attr('rfile'),
function(data) {
if (handle)
$('#progressbar').reportprogress(data);
});
}
$(document).ready(function() {
$('#progressbar').reportprogress(0);
$('#back').button().click(function() {
window.location = '/cgi-bin/browse.jim?dir=' + $('#params').attr('dir');
});
$('#audioit').button().click(function() {
$('#audiodiv').hide('slow');
$('#progressdiv').show('slow');
handle = setInterval("update()", 1000);
$('#output').load('execute.jim?file=' + $('#params').attr('rfile'),
function() {
clearInterval(handle);
handle = 0;
$('#back').show();
$('#progressbar').reportprogress(100);
});
});
});

View File

@@ -1,39 +0,0 @@
#!/mod/bin/jimsh
package require sqlite3
package require cgi
source /mod/var/mongoose/lib/setup
require ts.class system.class
puts "Content-Type: text/html\r\n\r\n"
cgi_input
#cgi_dump
set rfile [cgi_get file]
set ts [ts fetch $rfile]
set dir [file dirname $rfile]
set len [$ts duration 1]
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"

View File

@@ -1,26 +0,0 @@
#!/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,66 +1,29 @@
(function($)
{
$.fn.enable = function()
{
return this.each(function() {
$(this)
.removeClass('ui-state-disabled')
.removeProp('disabled');
});
};
var dir;
$.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();
});
});
$('#paste').button()
.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);
});
});
// End Clipboard post-load actions
});
}
function epginfo_callback(data, status, xhr)
{
var width = 85;
@@ -112,17 +75,16 @@ function new_folder_callback(data, status, xhr)
$.each(data, set_folder_new);
}
function delete_callback(file, dir, id)
function delete_callback(file, type, id)
{
var el = 'div.bf#' + id;
var results = el + ' .results';
var url = '/cgi-bin/browse/delete.jim?file=' +
encodeURIComponent(file) + '&type=' + type;
$(results)
.html('<img src=/img/loading.gif>Deleting, please wait...')
.slideDown('slow')
.load('/cgi-bin/browse/delete.jim', {
'dir': dir,
'files': [decodeURIComponent(file)]
}, function() {
.load(url, function() {
$(el).delay(3000).slideUp(300, function() {
$(el).remove();
});
@@ -131,19 +93,19 @@ function delete_callback(file, dir, id)
function lock_callback(file, type, id)
{
var url = '/cgi-bin/browse/lock.jim?file=' + file;
var url = '/cgi-bin/browse/lock.jim?file=' + encodeURIComponent(file);
$.get(url, function() { window.location.reload(true); });
}
function enc_callback(file, type, id)
{
var url = '/cgi-bin/browse/enc.jim?file=' + file;
var url = '/cgi-bin/browse/enc.jim?file=' + encodeURIComponent(file);
$.get(url, function() { window.location.reload(true); });
}
function new_callback(file, type, id)
{
var url = '/cgi-bin/browse/new.jim?file=' + file;
var url = '/cgi-bin/browse/new.jim?file=' + encodeURIComponent(file);
$.get(url, function() { window.location.reload(true); });
}
@@ -154,20 +116,6 @@ 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();
@@ -193,7 +141,7 @@ function confirm_action(action, callback, file, type, id)
});
$('#confirm').empty().html(
'Are you sure you wish to ' + action + '<br>' +
'<i>' + decodeURIComponent(bfile) + '</i> ?'
'<i>' + bfile + '</i> ?'
);
$confirm.dialog('open');
}
@@ -204,7 +152,7 @@ function preparemenu(el, menu)
{
if (el.attr('def') == 'HD')
{
$(menu).enableContextMenuItems('#enc');
$('#optmenu').enableContextMenuItems('#enc');
if (el.attr('encd') == 1)
$(menu).changeContextMenuItem('#enc',
'Remove Enc');
@@ -214,81 +162,50 @@ function preparemenu(el, menu)
}
if (el.attr('bx') > 0)
$(menu).enableContextMenuItems('#crop');
$('#optmenu').enableContextMenuItems('#crop');
else
$(menu).disableContextMenuItems('#crop');
$('#optmenu').disableContextMenuItems('#crop');
if (el.attr('rsize') > 4294967296)
$(menu).enableContextMenuItems('#chunk');
else
$(menu).disableContextMenuItems('#chunk');
$(menu).enableContextMenuItems('#new');
$('#optmenu').enableContextMenuItems('#new');
if (el.attr('new') == 1)
$(menu).changeContextMenuItem('#new', 'Mark watched');
else
$(menu).changeContextMenuItem('#new', 'Mark new');
$(menu).enableContextMenuItems('#lock');
$('#optmenu').enableContextMenuItems('#lock');
if (el.attr('locked') == 1)
{
$(menu).changeContextMenuItem('#lock', 'Unlock');
$(menu).disableContextMenuItems('#delete');
$('#optmenu').disableContextMenuItems('#delete');
}
else
{
$(menu).changeContextMenuItem('#lock', 'Lock');
$(menu).enableContextMenuItems('#delete');
$('#optmenu').enableContextMenuItems('#delete');
}
if (el.attr('odencd') == 1 && el.attr('dlna') == 1)
$(menu).enableContextMenuItems('#decrypt');
else
$(menu).disableContextMenuItems('#decrypt');
if (el.attr('odencd') == 1)
{
$(menu).disableContextMenuItems('#audio');
$(menu).disableContextMenuItems('#mpg');
}
$('#optmenu').enableContextMenuItems('#decrypt');
else
{
$(menu).enableContextMenuItems('#audio');
$(menu).enableContextMenuItems('#mpg');
}
$('#optmenu').disableContextMenuItems('#decrypt');
}
else
{
$(menu).enableContextMenuItems('#delete');
$(menu).disableContextMenuItems('#lock');
$(menu).disableContextMenuItems('#enc');
$(menu).disableContextMenuItems('#new');
$(menu).disableContextMenuItems('#decrypt');
$(menu).disableContextMenuItems('#audio');
$(menu).disableContextMenuItems('#mpg');
$(menu).disableContextMenuItems('#crop');
$(menu).disableContextMenuItems('#chunk');
$('#optmenu').enableContextMenuItems('#delete');
$('#optmenu').disableContextMenuItems('#lock');
$('#optmenu').disableContextMenuItems('#enc');
$('#optmenu').disableContextMenuItems('#new');
$('#optmenu').disableContextMenuItems('#decrypt');
$('#optmenu').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() {
dir = $('#dir').text();
var menuclick = function(action, el, pos)
{
var file = $(el).parent().prevAll('a.bf').last().attr('file');
@@ -300,18 +217,7 @@ var menuclick = function(action, el, pos)
{
case 'delete':
confirm_action('delete', delete_callback, file,
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();
});
type, id);
break;
case 'lock':
@@ -330,8 +236,8 @@ var menuclick = function(action, el, pos)
break;
case 'rename':
$('#rename').val(decodeURIComponent(bfile));
$('#renameorig').val(decodeURIComponent(file));
$('#rename').val(bfile);
$('#renameorig').val(file);
$('#titleorig').val('');
$('#renametitle').val('');
@@ -341,7 +247,7 @@ var menuclick = function(action, el, pos)
if (type == 'ts')
{
$.getJSON('/cgi-bin/browse/epgtitle.jim?file=' +
file, epginfo_callback);
encodeURIComponent(file), epginfo_callback);
}
$('#renameform').dialog('open');
@@ -349,96 +255,17 @@ var menuclick = function(action, el, pos)
case 'download':
window.location.href = '/cgi-bin/browse/download.jim?file=' +
file;
encodeURIComponent(file);
break;
case 'crop':
window.location.href = '/cgi-bin/browse/crop/crop.jim?file=' +
file;
break;
case 'chunk':
window.location.href = '/cgi-bin/browse/chunk/chunk.jim?file=' +
file;
window.location.href = '/cgi-bin/browse/crop.jim?file=' +
encodeURIComponent(file);
break;
case 'decrypt':
window.location.href =
'/cgi-bin/browse/decrypt/decrypt.jim?file=' + file;
break;
case 'audio':
window.location.href = '/cgi-bin/browse/audio/audio.jim?file=' +
file;
break;
case 'mpg':
window.location.href = '/cgi-bin/browse/mpg/mpg.jim?file=' +
file;
break;
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?dir=' + file;
$.get(url, function() { window.location.reload(true); });
break;
case 'resetnew':
var url = '/cgi-bin/browse/resetnew.jim?dir=' + file;
$.get(url, function() { window.location.reload(true); });
window.location.href = '/cgi-bin/browse/decrypt.jim?file=' +
encodeURIComponent(file);
break;
default:
@@ -457,25 +284,9 @@ var dmenuclick = 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');
var $buttons = {
"Close" : function() {$(this).dialog('close');}
};
var $buttonsp = $.extend(
{"Play" : function() { doplay(); }},
$buttons);
// Create reusable dialogue.
var $dialog = $('#dialogue').dialog({
title: "Media Details",
@@ -483,43 +294,23 @@ var dmenuclick = function(action, el, pos)
height: 600, width: 700,
show: 'scale', hide: 'fade',
draggable: true, resizable: true,
buttons: $buttons,
buttons: {
"Close": function() {
$(this).dialog('close');
}
},
close: function(e,u) { $('#dialogue').empty().html(
'<img src="/img/loading.gif" alt="loading">'); }
});
function doplay()
{
var file = $dialog.attr('file');
var type = $dialog.attr('type');
disableall();
window.location = '/cgi-bin/browse/play.jim?' +
'dir=' + encodeURIComponent(dir) +
'&file=' + file;
}
// Bind dialogue open to filenames.
$('a.bf').click(function(e) {
e.preventDefault();
var file = $(this).attr('file');
var type = $(this).attr('type');
var opt = $(this).nextAll('a').find('img.opt');
var url = '/cgi-bin/browse/file.jim?file=' + file
+ '&type=' + type;
$dialog.load(url);
$dialog.attr('file', file);
$dialog.attr('type', type);
if (type == 'ts' &&
(opt.attr('odencd') == 0 || opt.attr('dlna') == 1))
$dialog.dialog("option", "buttons", $buttonsp);
else
$dialog.dialog("option", "buttons", $buttons);
var url = '/cgi-bin/browse/file.jim?file=' +
encodeURIComponent(file) + '&type=' + type;
$('#dialogue').load(url);
$dialog.dialog('open');
});
@@ -536,19 +327,6 @@ var dmenuclick = 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',
@@ -569,6 +347,8 @@ var dmenuclick = 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),
@@ -578,16 +358,13 @@ var dmenuclick = 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 = '/dedup/dedup.jim?dir='
window.location = '/cgi-bin/dedup.jim?dir='
+ encodeURIComponent(dir);
});
@@ -612,10 +389,10 @@ var dmenuclick = function(action, el, pos)
.click(function() {
var files = new Array();
var els = $('input.fsts:checked + a').each(function() {
files.push($(this).attr('file'));
files.push(encodeURIComponent($(this).attr('file')));
});
//console.log("%o", files);
window.location.href = '/cgi-bin/browse/join/join.jim?files=' +
window.location.href = '/cgi-bin/browse/join.jim?files=' +
files.join();
});
@@ -623,7 +400,7 @@ var dmenuclick = function(action, el, pos)
.click(function() {
var files = new Array();
var els = $('input.fs:checked + a').each(function() {
files.push(decodeURIComponent($(this).attr('file')));
files.push(encodeURIComponent($(this).attr('file')));
});
//console.log("%o", files);
var str = 'Are you sure you want to delete ' + files.length +
@@ -634,74 +411,20 @@ var dmenuclick = function(action, el, pos)
{
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);
});
window.location.href =
'/cgi-bin/browse/mdelete.jim?dir=' +
encodeURIComponent(dir) + '&files=' +
files.join();
}
});
$('#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);
});
});
$('#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();
$('#delete').enable();
else
$('#delete,#cut,#copy').disable();
$('#delete').disable();
var num = $('input.fsts:checked').size();
if (num > 1)
$('#join').enable();

View File

@@ -1,6 +0,0 @@
div.progressbar
{
width: 200px;
}

View File

@@ -1,72 +0,0 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
require ts.class pretty_size
puts "Content-Type: text/html\r\n\r\n"
cgi_input
#cgi_dump
set rfile [cgi_get file]
set ts [ts fetch $rfile]
set dir [file dirname $rfile]
# 45 minute chunks
set max $(45 * 60)
set len [$ts duration 1]
set esttime $(int($len * 0.025))
if {[$ts get definition] eq "HD"} { set esttime $($esttime * 4) }
header
puts "
<script type=text/javascript src=/js/jquery.progressbar.js></script>
<script type=text/javascript src=chunk.js></script>
<link href=/css/jquery.progressbar.css rel=stylesheet type=text/css />
<link href=chunk.css rel=stylesheet type=text/css />
<fieldset class=cleft>
<legend>Split recording into 45 minute segments</legend>
<table class=keyval cellpadding=5>
<tr><th>File:</th><td>$rfile</td></tr>
<tr><th>Length:</th><td>[clock format $len -format "%T"]</td></tr>
<tr><th>Size:</th><td>[pretty_size [$ts size]] ([$ts get definition])</td></tr>
<tr><th>Time:</th>
<td>Splitting will take around [clock format $esttime -format "%T"]</td></tr>
"
set bytesperminute $([$ts size] / ($len / 60))
while {$len > 0} {
incr part
incr len -$max
puts "<tr class=\"part hidden\">
<th>Part $part</th><td>
<div id=progresspart$part class=progressbar></div>
<div id=progressstat$part class=also>waiting...</div>
</td></tr>"
}
puts "
</table>
<span class=hidden id=params parts=$part bpm=$bytesperminute
file=\"[cgi_quote_url $rfile]\">
</span>
<div id=chunkdiv style=\"padding: 1em\">
<button id=chunkit>Split recording into $part parts</button>
</div>
<div id=findiv style=\"padding: 1em\" class=hidden>
<button id=back dir=\"[cgi_quote_url [file dirname $rfile]]\">
Back to Media Browser
</button>
</div>
</fieldset>
"

View File

@@ -1,76 +0,0 @@
var handle;
var currentpart = 0;
var stime = 0;
function xprogress()
{
var file = $('#params').attr('file');
var bpm = $('#params').attr('bpm');
if (currentpart > 0)
$.get('progress.jim?part=' + currentpart + '&file=' + file,
function(data) {
if (currentpart > 0)
{
perc = (data / bpm) * 100 / 45;
$('#progresspart' + currentpart)
.reportprogress(perc);
}
});
}
function xpart(part)
{
var parts = $('#params').attr('parts');
var file = $('#params').attr('file');
if (part++ < parts)
{
currentpart = part;
$('#progressstat' + part)
.text('extracting...')
.addClass('blood');
stime = new Date().getTime();
$.get('extract.jim?parts=' + parts +
'&part=' + part +
'&file=' + file,
function(data) {
var taken = (new Date().getTime() - stime) / 1000;
$('#progressstat' + part)
.text('done... (' + taken + ' seconds)')
.removeClass('blood');
currentpart = 0;
$('#progresspart' + part)
.reportprogress(100);
xpart(part);
});
}
else
{
clearInterval(handle);
$('#findiv').show('slow');
}
}
$(function() {
$('div.progressbar').reportprogress(0);
$('#chunkit').button().click(function(e) {
e.preventDefault();
$('#chunkdiv').hide('slow');
$('tr.part').show('slow');
handle = setInterval("xprogress()", 1000);
xpart(0);
});
$('#back').button().click(function(e) {
e.preventDefault();
var dir = $(this).attr('dir');
window.location = '/cgi-bin/browse.jim?dir=' + dir;
});
});

View File

@@ -1,38 +0,0 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
require ts.class pretty_size
puts "Content-Type: text/html\r\n\r\n"
cgi_input
#cgi_dump
set rfile [cgi_get file]
set part [cgi_get part -]
set parts [cgi_get parts "?"]
if {$part eq "-"} exit
set start $(($part - 1) * 45 * 600 - 600)
set end $($part * 45 * 600 + 600)
puts "START: $start"
puts "END: $end"
set ts [ts fetch $rfile]
set base [file rootname $rfile]
set cmd [list /mod/bin/nicesplice -in $base -out "$base.part$part"]
if {$start > 0} { lappend cmd -cut 0 $start }
lappend cmd -cut $end 9999999
puts "CMD: ($cmd)"
puts [exec {*}$cmd]
set ts [ts fetch "$base.part$part.ts"]
$ts settitle "$part/$parts. [string range [ts get $title] 0 40]"

View File

@@ -1,17 +0,0 @@
#!/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 file [cgi_get file]
set part [cgi_get part]
set rfile "[file rootname $file].part$part"
puts [file size $rfile]

View File

@@ -1,119 +0,0 @@
#!/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=paste>Paste to current folder</button>"
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,192 @@
#!/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 tsfile [cgi_get file]
set rfile [file normalize $tsfile]
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

@@ -1,117 +0,0 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
require ts.class pretty_size
puts "Content-Type: text/html\r\n\r\n"
cgi_input
#cgi_dump
set rfile [cgi_get file]
set ts [ts fetch $rfile]
set dir [file dirname $rfile]
set len [$ts duration 1]
header
puts "
<link href=/css/jquery.progressbar.css rel=stylesheet type=text/css />
<script type=text/javascript src=/js/jquery.progressbar.js></script>
<script type=text/javascript src=crop.js></script>
<fieldset class=cleft>
<legend>Crop recording</legend>
<table class=keyval cellpadding=5>
<tr><th>File:</th><td>$rfile</td></tr>
<tr><th>Length:</th><td>[clock format $len -format \"%T\"]</td></tr>
<tr><th>Size:</th><td>[pretty_size [$ts size]] ([$ts get definition])</td></tr>
<tr><th>Bookmarks:</th><td>[$ts get bookmarks] @ "
set flag 0
foreach b [$ts bookmarks] {
if $flag { puts -nonewline ", " }
incr flag
puts -nonewline [clock format $b -format "%T"]
}
puts "</td></tr><tr><th>File</th><td>"
puts "<div style=\"position: relative; top: -10px\">"
proc div {type left right} {
set width $($right - $left)
puts "<div class=$type style=\"left: ${left}px; width: ${width}px\">
$type</div>"
}
set keeping 0
set last 0
set start -1
foreach b [$ts bookmarks] {
if {$start < 0} {
set start $b
continue
}
set end $b
incr keeping $($end - $start)
set left $($start * 500 / $len)
set right $($end * 500 / $len)
div cut $last $($left - 1)
div keep $left $($right - 1)
set last $right
set start -1
}
if {$start > 0} {
incr keeping $($len - $start)
set left $($start * 500 / $len)
div cut $last $($left - 1)
div keep $left 500
} else {
div cut $last 500
}
set keepperc $($keeping * 100.0 / $len)
set esttime $(int($keeping * 0.025))
if {[$ts get definition] eq "HD"} { set esttime $($esttime * 4) }
puts "
</div>
</td></tr>
<tr><th>Keeping:</th><td>
[clock format $keeping -format "%T"] ([format "%.2f" $keepperc]%)
</td></tr>
<tr><th>Time:</th>
<td>Cropping will take around [clock format $esttime -format "%T"]</td></tr>
</table>
<span class=hidden id=params
file=\"[cgi_quote_url $rfile]\"
perc=\"$keepperc\"
dir=\"[cgi_quote_url $dir]\"
></span>
<div id=cropdiv style=\"padding: 1em\">
<button id=cropit>Perform crop operation</button>
</div>
<div id=progressdiv class=hidden>
Cropping: <div id=progressbar></div>
</div>
<button id=back class=hidden>Back to media list</button>
<div id=output class=pre style=\"margin-top: 10px\"></div>
</fieldset>
"

View File

@@ -1,38 +0,0 @@
var handle = 0;
function update()
{
var perc = $('#params').attr('perc');
var file = $('#params').attr('file');
$.get('progress.jim' + '?perc=' + perc + '&file=' + file,
function(data) {
if (handle)
$('#progressbar').reportprogress(data);
});
}
$(document).ready(function() {
$('#progressbar').reportprogress(0);
$('#back').button().click(function() {
window.location = '/cgi-bin/browse.jim?dir=' + $('#params').attr('dir');
});
$('#cropit').button().click(function() {
$('#cropdiv').hide('slow');
$('#progressdiv').show('slow');
handle = setInterval("update()", 1000);
$('#output').text('Please do not interrupt...')
.load('execute.jim?file=' + $('#params').attr('file'),
function() {
clearInterval(handle);
handle = 0;
$('#back').show();
$('#progressbar').reportprogress(100);
});
});
});

View File

@@ -1,52 +0,0 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
require ts.class pretty_size
puts "Content-Type: text/html\r\n\r\n"
cgi_input
#cgi_dump
set rfile [cgi_get file]
set ts [ts fetch $rfile]
set dir [file dirname $rfile]
set len [$ts duration 1]
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"

View File

@@ -0,0 +1,129 @@
#!/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 tsfile [cgi_get file]
set rfile [file normalize $tsfile]
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 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"
}
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."
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

@@ -1,72 +0,0 @@
#!/mod/bin/jimsh
package require sqlite3
package require cgi
source /mod/var/mongoose/lib/setup
require ts.class
puts "Content-Type: text/html\r\n\r\n"
cgi_input
#cgi_dump
set rfile [cgi_get file]
set ts [ts fetch $rfile]
set dir [file dirname $rfile]
set len [$ts duration 1]
lassign [$ts dlnaloc] url
header
puts "
<link href=/css/jquery.progressbar.css rel=stylesheet type=text/css />
<script type=text/javascript src=/js/jquery.progressbar.js></script>
<script type=text/javascript src=decrypt.js></script>
<fieldset class=cleft>
<legend>Decrypt in-place</legend>
<table class=keyval cellpadding=5>
<tr><th>File:</th><td>$rfile</td></tr>
<tr><th>Length:</th><td>[clock format $len -format "%T"]</td></tr>
<tr><th>DLNA URL</th><td>$url</td></tr>
</table>
"
if {$url eq ""} {
puts "This file has not been indexed by the media server.
Cannot decrypt."
puts "Have you enabled <i>Content Sharing</i> in the Humax menus?"
exit
}
if {![system is_listening 9000]} {
puts "The Humax media server is not running, cannot decrypt."
puts "Have you enabled <i>Content Sharing</i> in the Humax menus?"
puts "It can sometimes turn itself off so it's worth double checking."
puts "If it is on then try turning sharing off and on again."
exit
}
puts "
<span class=hidden id=params
dir=\"[cgi_quote_url $dir]\"
file=\"[cgi_quote_url $rfile]\"
></span>
<div id=decryptdiv style=\"padding: 1em\">
<button id=decryptit>Perform decryption</button>
</div>
<div id=progressdiv class=hidden>
Decrypting: <div id=progressbar></div>
</div>
<button id=back class=hidden>Back to media list</button>
<div id=output class=pre style=\"margin-top: 10px\"></div>
</fieldset>
"

View File

@@ -1,35 +0,0 @@
var handle = 0;
function update()
{
$.get('progress.jim?file=' + $('#params').attr('file'),
function(data) {
if (handle)
$('#progressbar').reportprogress(data);
});
}
$(document).ready(function() {
$('#progressbar').reportprogress(0);
$('#back').button().click(function() {
window.location = '/cgi-bin/browse.jim?dir=' + $('#params').attr('dir');
});
$('#decryptit').button().click(function() {
$('#decryptdiv').hide('slow');
$('#progressdiv').show('slow');
handle = setInterval("update()", 1000);
$('#output').load('execute.jim?file=' + $('#params').attr('file'),
function() {
clearInterval(handle);
handle = 0;
$('#back').show();
$('#progressbar').reportprogress(100);
});
});
});

View File

@@ -1,66 +0,0 @@
#!/mod/bin/jimsh
package require sqlite3
package require cgi
source /mod/var/mongoose/lib/setup
require ts.class
puts "Content-Type: text/html\r\n\r\n"
cgi_input
#cgi_dump
set rfile [cgi_get file]
set ts [ts fetch $rfile]
set dir [file dirname $rfile]
set len [$ts duration 1]
lassign [$ts dlnaloc] url
if {$url eq ""} {
puts "This file has not been indexed by the media server.
Cannot decrypt."
exit
}
set xstart [clock milliseconds]
set base [file rootname $rfile]
set origdir "$dir/_original"
if {![file exists $origdir]} { file mkdir $origdir }
set shname [file tail $base]
puts "Processing $shname"
if {[file exists "$origdir/$shname.ts"]} {
puts "The file already exists in _original, cannot decrypt."
exit
}
exec wget -O "$rfile.decrypting" $url
puts "Moving recording to $origdir"
foreach f [glob -nocomplain "${base}.*"] {
if {[file extension $f] eq ".decrypting"} { continue }
set tail [file tail $f]
puts " $tail"
file rename $f "${origdir}/$tail"
}
file rename "$rfile.decrypting" $rfile
foreach ext {nts hmt thm} {
set sidecar "$shname.$ext"
if {[file exists "$origdir/$sidecar"]} {
puts "Copying back sidecar $ext"
file copy "$origdir/$sidecar" "$dir/$sidecar"
}
}
if {[file exists "$dir/$shname.hmt"]} {
exec /mod/bin/hmt -encrypted "$dir/$shname.hmt"
}
set xtime [expr [expr [clock milliseconds] - $xstart] / 1000.0]
puts "Time taken: $xtime"

View File

@@ -1,101 +1,28 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
require ts.class pretty_size system.class tdelete
source /mod/var/mongoose/lib/ts.class
puts "Content-Type: text/html\r\n"
puts "Content-Type: text/html"
puts ""
cgi_input
#cgi_dump
set dir [cgi_get dir]
regsub -all {([\\["$])} $dir {\\\1} dir
set file [dict get $_cgi file]
set type [dict get $_cgi type]
#puts "DIR: ($dir)"
if {[system pkginst undelete]} {
set dustbin [system dustbin]
} else {
set dustbin ""
}
proc bindir {file} {
global dustbin
set dir [file dirname $file]
regsub "^[system mediaroot]" $dir $dustbin ndir
if {$dir eq $ndir} { set ndir $dustbin }
system mkdir_p $ndir
return $ndir
}
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\"..."
if {![string match "$dir/*" $file]} {
puts "Error - outside directory."
continue
}
if {$dustbin ne "" && [string first $dustbin $file] > -1} {
set ldustbin ""
if {$type eq "ts"} {
set ts [ts fetch $file]
if {[$ts delete]} {
puts "Successfully deleted $file."
} else {
set ldustbin $dustbin
puts "Problem deleting $file, [$ts get error]"
}
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>"
exit
}
puts "</ul>"
file delete $file
file delete "[file rootname $file].hmi"
puts "Successfully deleted $file."

View File

@@ -11,23 +11,20 @@ cgi_input
#cgi_dump
set file [cgi_get file]
set rfile [file normalize $file]
set ts [ts fetch $file]
# Default to just downloading the raw file.
set url $file
set mime "video/ts"
if {[string match {*.ts} $file]} {
if {![catch {set ts [ts fetch $file]}]} {
# If it's encrypted on disk and the DLNA option is available, then use
# the server to perform decryption on the fly.
if {[$ts flag "ODEncrypted"] > 0} {
set dlna [$ts dlnaloc]
if {[llength $dlna]} { lassign $dlna url mime }
# 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 "DLNA: $dlna"
}
puts "Content-Type: text/plain"

View File

@@ -65,28 +65,22 @@ 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).
<font class=also>(Scheduled: [expr [$ts get scheddur] / 60])
</font></td>
<td>[$ts duration] minute(s).</td>
</tr><tr>
<th>Size</th>
<td>$sz</td>
"
lassign [$ts dlnaloc] url
if {$url ne ""} {
set dlna [$ts dlnaloc]
lassign $dlna url
if {[llength $dlna]} {
puts "</tr><tr><th>DLNA&nbsp;URL</th>
<td><a href=\"$url\">$url</a></td>"
}

View File

@@ -1,28 +0,0 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/ts.class
puts "Content-Type: text/html"
puts ""
cgi_input
#cgi_dump
set dir [cgi_get dir]
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,136 @@
#!/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>
<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

@@ -1,6 +0,0 @@
#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; }

View File

@@ -1,65 +0,0 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
require ts.class pretty_size
puts "Content-Type: text/html\r\n\r\n"
header
cgi_input 1
#cgi_dump
puts "
<link href=/css/jquery.progressbar.css rel=stylesheet type=text/css />
<link href=join.css rel=stylesheet type=text/css />
<script type=text/javascript src=/js/jquery.progressbar.js></script>
<script type=text/javascript src=/js/touchbridge.js></script>
<script type/text/javascript src=join.js></script>
<p><b>
Drag the files below into order, enter a name for the resulting file and then
click the <i>Join</i> button.</b>
"
puts "<ul id=filelist>"
set esize 0
foreach file [split [cgi_get files] ","] {
set file [cgi_unquote_input $file]
set dir [file dirname $file]
set ts [ts fetch $file]
puts "<li class=\"va ui-state-default\" id=\"$file\"><span
class=\"va ui-icon ui-icon-arrowthick-2-n-s\"></span>
<img class=va src=/img/Video_TS.png>
<span class=pl>
$file ([clock format [$ts duration 1] -format "%T"])
\[[pretty_size [$ts size]]\]
<br><i style=\"font-size: 0.8em\">[$ts get title]</i>
</span>
</li>"
incr esize [$ts size]
}
puts "</ul>"
puts "
<br><br>
<div id=joindiv>
Name for joined file:
<input id=dest name=dfile class=\"text ui-widget-content ui-corner-all\"
length=20 maxlength=50>
<button id=dojoin>Join</button>
</div>
<div id=progressdiv style=\"display: none\">
Joining: <div id=progressbar></div>
<button id=back
dir=\"[cgi_quote_url $dir]\"
esize=\"$esize\"
style=\"display: none\">Back to media list</button>
<div id=output class=pre style=\"margin-top: 10px\"></div>
</div>
"
footer

View File

@@ -1,62 +0,0 @@
$('#filelist li').hover(
function() { $(this).css('cursor', 'pointer'); },
function() { $(this).css('cursor', 'auto'); }
);
var handle = 0;
function update()
{
$.get('progress.jim'
+ '?esize=' + $('#back').attr('esize')
+ '&file=' + $('#back').attr('dir') + '/' + $('#dest').val(),
function(data) {
if (handle)
$('#progressbar').reportprogress(data);
});
}
$(document).ready(function() {
$('#progressbar').reportprogress(0);
$('#back').button().click(function() {
window.location = '/cgi-bin/browse.jim?dir=' + $(this).attr('dir');
});
$('#filelist').sortable().disableSelection();
$('#dojoin').button().attr('disabled', true).addClass('ui-state-disabled')
.click(function() {
var files = $('#filelist').sortable('toArray');
var sfiles = new Array();
for (x in files)
sfiles.push(encodeURIComponent(files[x]));
$('#joindiv').hide('slow');
$('#progressdiv').show('slow');
handle = setInterval("update()", 1000);
$('#output').text('Please do not interrupt...')
.load('execute.jim?files=' +
sfiles.join() + '&dest=' + $('#dest').val(),
function() {
clearInterval(handle);
handle = 0;
$('#back').show();
$('#progressbar').reportprogress(100);
});
});
$('#dest').val('').keyup(function() {
if ($(this).val().length > 0)
$('#dojoin')
.removeProp('disabled').removeClass('ui-state-disabled');
else
$('#dojoin')
.prop('disabled', true).addClass('ui-state-disabled');
});
});

View File

@@ -0,0 +1,55 @@
#!/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
set dir [cgi_unquote_input [cgi_get dir]]
puts "<div id=deleting class=blood><img src=/img/loading.gif>Deleting...</div>"
puts "<ul style=\"list-style-type: square\">"
foreach file [split [cgi_get files] ","] {
set file [cgi_unquote_input $file]
puts -nonewline "<li>\"$file\"..."
if {[file isdirectory $file]} {
puts -nonewline "Directory..."
puts [exec /mod/bin/busybox/rm -rf $file]
puts -nonewline "Done..."
} elseif {[string match {*.ts} $file]} {
set ts [ts fetch $file]
if {[catch {$ts delete} msg]} {
puts -nonewline "Error loading TS file..."
} else {
puts -nonewline "Done..."
}
} else {
if {[catch {file delete $ts} msg]} {
puts -nonewline "Error: $msg"
} else {
catch {file delete "[file rootname $file].hmi"}
puts -nonewline "Done..."
}
}
puts "</li>"
}
puts "</ul>"
puts "<button id=back dir=\"$dir\">Back to media list</button>";
puts {
<script type=text/javascript>
$('#deleting').slideUp('slow');
$('#back').button().click(function() {
window.location.href = '/cgi-bin/browse.jim?dir=' +
encodeURIComponent($('#back').attr('dir'));
});
</script>
}
footer

View File

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

@@ -1,31 +0,0 @@
#!/mod/bin/jimsh
package require sqlite3
package require cgi
source /mod/var/mongoose/lib/setup
require ts.class system.class
puts "Content-Type: text/html\r\n\r\n"
cgi_input
#cgi_dump
set rfile [cgi_get file]
set ts [ts fetch $rfile]
set dir [file dirname $rfile]
set len [$ts duration 1]
set xstart [clock milliseconds]
set base [file rootname $rfile]
set shname [file tail $base]
puts "Processing $shname"
puts [exec /mod/bin/ffmpeg -y -benchmark -v 0 \
-i $rfile \
-map 0:0 -map 0:1 \
-vcodec copy -acodec copy "${base}.mpg"]
set xtime [expr [expr [clock milliseconds] - $xstart] / 1000.0]
puts "Time taken: $xtime"

View File

@@ -1,52 +0,0 @@
#!/mod/bin/jimsh
package require sqlite3
package require cgi
source /mod/var/mongoose/lib/setup
require ts.class system.class
puts "Content-Type: text/html\r\n\r\n"
cgi_input
#cgi_dump
set rfile [cgi_get file]
set ts [ts fetch $rfile]
set dir [file dirname $rfile]
set len [$ts duration 1]
header
puts "
<link href=/css/jquery.progressbar.css rel=stylesheet type=text/css />
<script type=text/javascript src=/js/jquery.progressbar.js></script>
<script type=text/javascript src=mpg.js></script>
<fieldset class=cleft>
<legend>Extract to MPG</legend>
<table class=keyval cellpadding=5>
<tr><th>File:</th><td>$rfile</td></tr>
<tr><th>Length:</th><td>[clock format $len -format "%T"]</td></tr>
</table>
<span class=hidden id=params
dir=\"[cgi_quote_url $dir]\"
rfile=\"[cgi_quote_url $rfile]\"
></span>
<div id=mpgdiv style=\"padding: 1em\">
<button id=mpgit>Perform mpg extraction</button>
</div>
<div id=progressdiv class=hidden>
Extracting mpg: <div id=progressbar></div>
</div>
<button id=back class=hidden>Back to media list</button>
<div id=output class=pre style=\"margin-top: 10px\"></div>
</fieldset>
"

View File

@@ -1,35 +0,0 @@
var handle = 0;
function update()
{
$.get('progress.jim?file=' + $('#params').attr('rfile'),
function(data) {
if (handle)
$('#progressbar').reportprogress(data);
});
}
$(document).ready(function() {
$('#progressbar').reportprogress(0);
$('#back').button().click(function() {
window.location = '/cgi-bin/browse.jim?dir=' + $('#params').attr('dir');
});
$('#mpgit').button().click(function() {
$('#mpgdiv').hide('slow');
$('#progressdiv').show('slow');
handle = setInterval("update()", 1000);
$('#output').load('execute.jim?file=' + $('#params').attr('rfile'),
function() {
clearInterval(handle);
handle = 0;
$('#back').show();
$('#progressbar').reportprogress(100);
});
});
});

View File

@@ -1,26 +0,0 @@
#!/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}.mpg"]} {
puts "0"
} else {
set sz [file size $rfile]
set nsz [expr [file size "${bfile}.mpg"] / 0.75]
set perc [expr $nsz * 100 / $sz]
if {$perc > 100} { set perc 100 }
puts $perc
}

View File

@@ -1,8 +1,7 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
require ts.class
source /mod/var/mongoose/lib/ts.class
puts "Content-Type: text/html"
puts ""

View File

@@ -1,51 +0,0 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
require ts.class pretty_size
puts "Content-Type: text/html\r\n"
cgi_input
#cgi_dump
header
set rfile [cgi_get file]
set ts [ts fetch $rfile]
if {[catch {$ts get file}]} {
puts "Invalid TS file, '$rfile'"
exit
}
if {![$ts flag "ODEncrypted"]} {
set url $rfile
} else {
lassign [$ts dlnaloc] url
if {$url eq ""} {
alert("Media is encrypted and not indexed by the DLNA Server.");
}
}
puts "
<span id=url style=\"display: none\">$url</span>
"
puts {
<script language="javascript" src="/js/jquery-vlc.js"></script>
<link rel="stylesheet" type="text/css" href="/css/vlc.css" />
<script type=text/javascript src=play.js></script>
<fieldset class=cleft style="margin: 0 1em 1em 1em">
<legend>VLC Player</legend>
}
puts "<span class=also>Now playing: $rfile, [$ts duration] minutes.</span>"
puts {
<div id=vlc></div>
<div class=also id=info style="float: right">
</div>
</fieldset>
}

View File

@@ -1,13 +0,0 @@
$(document).ready(function() {
var url = $('#url').text();
var vlc = VLCobject.embedPlayer('vlc', 800, 450, true);
vlc.play(encodeURI(url));
if (window.console)
console.log("Playing: %o", url);
});

View File

@@ -1,49 +0,0 @@
#!/mod/bin/jimsh
package require cgi
package require pack
source /mod/var/mongoose/lib/setup
require ts.class hexdump
puts "Content-Type: text/html"
puts ""
cgi_input
#cgi_dump
set dir [cgi_get dir]
if {![file isdirectory $dir]} { exit }
if {![file exists "$dir/.series"]} { exit }
set tot 0
set watched 0
foreach file [readdir -nocomplain $dir] {
if {![string match {*.ts} $file]} { continue }
#puts "FILE: $file"
incr tot
if {[set ts [ts fetch "$dir/$file"]] != 0} {
if {![$ts flag "New"]} { incr watched }
}
}
set fd [open "$dir/.series"]
set bytes [read $fd]
close $fd
set recs [unpack $bytes -uintle 0 32]
set played [unpack $bytes -uintle 32 32]
puts "Current: $played/$recs"
#hexdump $bytes
puts "Calculated: $watched/$tot"
pack bytes $tot -intle 32 0
pack bytes $watched -intle 32 32
#hexdump $bytes
set fd [open "$dir/.series" "w"]
puts -nonewline $fd $bytes
close $fd

View File

@@ -16,10 +16,11 @@ set dir [dict get $_cgi dir]
#9.4G /media/My Video/Archive
#1.4G /media/My Video/CSI_ Crime Scene Investigation
puts "{"
regsub -all {([\\["$])} $dir {\\\1} xdir
foreach line [split [exec /mod/bin/busybox/du -h -d 1 "$dir/"] "\n"] {
lassign [split $line "\t"] size node
regsub -- "^$xdir/" $node "" node
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]
puts "\"$node\" : \"$size\","
}

View File

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

7
var/mongoose/cgi-bin/cfwreset Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/sh
echo "Content-Type: text/plain"
echo
/bin/rm -rf /mod/*

View File

@@ -1,7 +0,0 @@
#!/bin/sh
echo "Content-Type: text/plain"
echo
touch /var/lib/humaxtv/mod/_RESET_CUSTOM_FIRMWARE_ENVIRONMENT

View File

@@ -32,19 +32,17 @@ 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, szNetName, usTsID, ulFrequency, ucLevel, ucQuality
from TBL_TS join TBL_NET using (netIdx)
select tsIdx, usTsID, ulFrequency, ucLevel, ucQuality
from TBL_TS
order by ulFrequency
}] {
lassign $tw \
x tsIdx x netName x usTsID x ulFrequency x ucLevel x ucQuality
lassign $tw x tsIdx x usTsID x ulFrequency x ucLevel x ucQuality
altrow
puts "
@@ -53,7 +51,6 @@ 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
@@ -62,7 +59,7 @@ foreach tw [$db query {
order by usLcn
} $tsIdx]
set mux "Local"
set mux "???"
set ehs 0
foreach chan $channels {
lassign $chan x lcn x name
@@ -75,7 +72,6 @@ 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,8 +8,13 @@ require altrow
puts "Content-Type: text/html"
puts ""
set databases [glob /var/lib/humaxtv/*.db]
lappend databases "/mnt/hd2/dms_cds.db"
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
}
header

View File

@@ -4,9 +4,6 @@ package require cgi
source /mod/var/mongoose/lib/setup
require ts.class pretty_size altrow
source normalise.jim
source process.jim
puts "Content-Type: text/html"
puts ""
@@ -16,9 +13,9 @@ cgi_input
set dir [cgi_get dir "/media/My Video"]
set doit [cgi_get doit 0]
header
# Strip double slashes
puts "<script type=text/javascript src=script.js></script>"
header
puts "<fieldset style=\"display: inline\">
<legend>De-duplicate <span id=dir>$dir</span></legend>
@@ -31,25 +28,38 @@ puts "<fieldset style=\"display: inline\">
</tr>
"
regsub -all -- {\/+} "$dir/*" "/" sdir
set seen {}
foreach file [readdir $dir] {
set file "$dir/$file"
foreach file [lsort [glob -nocomplain "$sdir"]] {
if {[file extension $file] ne ".hmt"} { continue }
set base [file tail [file rootname $file]]
lassign [dedupprocess $file] stat ts syn fn
altrow
set ts [ts fetch $file 1]
set base [file tail [file rootname $file]]
puts "<td nowrap>$base</td>"
set syn [$ts get synopsis]
regsub -nocase -all -- {^new series\.* *} $syn "" syn
regsub -all -- { *[:].*$} $syn "" syn
if {[string length $syn] > 40} {
lassign [split $syn "."] v w
set syn $v
if {[string length $syn] < 6 && [string length $w] < 6} {
append syn "_$w"
}
}
if {[string length $syn] < 10} {
if {[string match "${syn}*" [$ts get title]]} {
set syn [$ts get title]
} else {
append syn " [$ts get title]"
}
}
regsub -all -- {[\/ &]} $syn "_" fn
puts "<td>$fn</td>"
puts "<td>$syn</td>"
puts "<td>"
switch $stat {
inuse {
puts -nonewline "In Use"
}
dup {
if {$fn in $seen} {
puts -nonewline "Duplicate"
if {$doit} {
set dupdir "$dir/_duplicates"
@@ -60,25 +70,19 @@ foreach file [readdir $dir] {
ts renamegroup $file "_duplicates/$fn"
puts -nonewline " - Renamed to _duplicates/$fn"
}
}
error {
} elseif {[string length $syn] > 40} {
puts -nonewline "Cannot process"
}
nothing {
} elseif {$base eq $fn} {
puts -nonewline "Nothing to do"
}
preserve {
} elseif {[file exists "$dir/$fn.ts"]} {
puts -nonewline "Preserving"
}
ok {
if {$doit} {
# Dooooo, it.
$ts settitle $syn
ts renamegroup $file $fn
puts -nonewline "Done"
}
}
} elseif {$doit} {
# Dooooo, it.
$ts settitle $syn
ts renamegroup $file $fn
puts -nonewline "Done"
}
lappend seen $fn
puts "</td>"
puts "</tr>"
@@ -96,8 +100,25 @@ if {!$doit} { puts "<button id=dedup>Process folder</button>" }
puts {
</small>
</div>
<script type=text/javascript>
$('#browse').button().click(function() {
window.location = '/cgi-bin/browse.jim?dir=' +
encodeURIComponent($('#dir').text());
});
}
if {!$doit} {
puts {
$('#dedup').button().click(function() {
window.location = window.location + '&doit=1';
});
}
}
puts "</script>"
footer

View File

@@ -18,6 +18,18 @@ 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>
@@ -79,7 +91,7 @@ if {[$record get event_crid] != ""} {
puts "
<tr>
<th>CRID</th><td>
<a href=/cgi-bin/epg/search.jim?crid=[$record get event_crid]>
<a href=/cgi-bin/epg_search.jim?crid=[$record get event_crid]>
<img border=0 height=14
src=/images/421_1_00_CH_Title_2R_Arrow.png>
[$record get channel_crid][$record get event_crid]
@@ -93,7 +105,7 @@ if {[$record get series_crid] != ""} {
puts "
<tr>
<th nowrap>Series CRID</th><td>
<a href=/cgi-bin/epg/search.jim?scrid=[$record get series_crid]>
<a href=/cgi-bin/epg_search.jim?scrid=[$record get series_crid]>
<img border=0 height=14
src=/images/421_1_00_CH_Title_2R_Arrow.png>
[$record get channel_crid][$record get series_crid]
@@ -107,7 +119,7 @@ if {[$record get rec_crid] != ""} {
set rec [$record recommended]
if {$rec != ""} {
puts "<tr><th>Recommends</th><td>
<a href=/cgi-bin/epg/search.jim?crid=[$rec get event_crid]>
<a href=/cgi-bin/epg_search.jim?crid=[$rec get event_crid]>
<img border=0 height=14
src=/images/421_1_00_CH_Title_2R_Arrow.png>
[$rec get name]
@@ -126,7 +138,7 @@ puts "
</tr>
</table>
<a class=footnote href=/cgi-bin/epg/dump.jim?service=[$record get service_id]&event=[$record get event_id]&raw=1>
<a class=footnote href=/cgi-bin/epg_dump.jim?service=[$record get service_id]&event=[$record get event_id]&raw=1>
<img border=0 src=/images/532_1_00_Find_Path_Arrow.png>
Show raw EPG info
</a>

View File

@@ -108,7 +108,7 @@ foreach record [lsort -command rsort $records] {
puts "<td>[$record get channel_num]</td>"
puts "<td>[$record channel_icon 50]</td>"
puts "<td nowrap>
<a href=/cgi-bin/epg/service.jim?service=[$record get service_id]>
<a href=/cgi-bin/epg_service.jim?service=[$record get service_id]>
[$record get channel_name]
</a></td>"
puts [$record cell]

View File

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

View File

@@ -8,12 +8,6 @@ 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."
@@ -49,7 +43,7 @@ puts {
$(document).ready(function() {
$('#progressbar').reportprogress(0);
handle = setInterval("update()", 350);
handle = setInterval("update()", 300);
$.get('/cgi-bin/restart.jim?now=yes');
});
</script>

View File

@@ -17,23 +17,12 @@ set event [rsv slot $table $slot]
set rsvicon [$event icon]
if {$rsvicon ne ""} {
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 rsvicon "<img src='images/$rsvicon' 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} {
@@ -63,12 +52,7 @@ puts "
</td>
</tr><tr>
<th>Event Name</th>
<td>[$event name]"
if {[$event get ucRecKind] == 4 && [$event name] ne [$event folder]} {
puts "<span class=also>(Folder: [$event folder])</span>"
}
puts "</td>
<td>[$event name]</td>
</tr><tr>
<th>Start</th>
"
@@ -106,7 +90,7 @@ if {$crid != ""} {
puts "<tr><th>"
if $series { puts "Series" } else { puts "Event" }
puts " CRID</th><td>"
puts -nonewline "<a href=/cgi-bin/epg/search.jim?"
puts -nonewline "<a href=/cgi-bin/epg_search.jim?"
if $series { puts -nonewline "s" }
puts "crid=/$crid>
<img border=0 src=/images/421_1_00_CH_Title_2R_Arrow.png
@@ -122,7 +106,7 @@ foreach ev [split [$event get szEventToRecord] "|"] {
if {$flag} { puts "<br>" }
incr flag
set crid [join [lrange [split $ev /] 1 end]]
puts -nonewline "<a href=/cgi-bin/epg/search.jim?"
puts -nonewline "<a href=/cgi-bin/epg_search.jim?"
puts "crid=/$crid>
<img border=0 src=/images/421_1_00_CH_Title_2R_Arrow.png
height=14>
@@ -131,7 +115,7 @@ foreach ev [split [$event get szEventToRecord] "|"] {
}
puts "</td></tr>"
puts "<tr><th>Accepted</th><td>"
if {[$event get aulEventToRecordInfo] ne ""} {
if {[$event get aulEventToRecordInfo] != ""} {
puts "Yes"
}
puts "</td></tr>"

View File

@@ -11,17 +11,6 @@ puts ""
cgi_input
#cgi_dump
if {[cgi_get act] eq "https"} {
if {[cgi_get val off] eq "off"} {
file delete /mod/etc/mongoose.cert
puts "HTTPS Server will be disabled after next reboot."
} else {
exec /mod/sbin/mongoose_mkcert
puts "HTTPS Server will be enabled after next reboot."
}
exit
}
set settings [settings new]
set hostname [$settings hostname]
@@ -64,6 +53,9 @@ handle_str_update hostname $hostname Hostname
_handle_update ascii smtp_server $smtp_server "SMTP Server"
handle_int_update channel_group $channel_group "Channel Group"
handle_str_update epg_style $epg_style "EPG Type"
if {[dict exists $_cgi pkgdevoff] && ![dict exists $_cgi pkgdev]} {
set _cgi(pkgdev) 0
}
handle_int_update pkgdev $pkgdev "Development Package Display"
set acluser [cgi_get acluser "-"]
@@ -97,7 +89,6 @@ if {$aclact ne "-" && $acluser ne "-"} {
header
puts {
<script type="text/javascript" src="/cgi-bin/settings.js"></script>
<script type="text/javascript" src="/js/jquery.form.js"></script>
<script type="text/javascript" src="/js/jconfirmaction.jquery.js"></script>
<link href=/css/jconfirmaction.jquery.css rel=stylesheet type=text/css />
@@ -105,6 +96,26 @@ puts {
<link href=/css/iphone-style-checkboxes.css rel=stylesheet type=text/css />
}
puts {
<script type=text/javascript>
$(document).ready(function () {
$(":submit").button();
$('form.auto').each(function(i, el) {
var id = $(this).attr('id');
var output = '#' + id + '_output'
$(this).ajaxForm({
target: output,
success: function() {
$(output).css('font-style', 'italic');
$(output).show('slow');
$(output).delay(2000).fadeOut('slow');
}
});
});
});
</script>
}
puts "
<fieldset style=\"display: inline\">
<legend>
@@ -129,17 +140,6 @@ puts "
</tr>
"
puts -nonewline "
<tr>
<th class=key>HTTPS web server?</th>
<td><input id=https_toggle name=https type=checkbox value=yes"
if {[file exists /mod/etc/mongoose.cert]} { puts -nonewline " checked" }
puts ">
<div id=https_output></div>
</td>
</tr>
"
puts "
<tr>
<form class=auto id=epg_style method=get action=$env(REQUEST_URI)>
@@ -315,25 +315,57 @@ $('button.pwchange').click(function(el) {
</script>
}
puts -nonewline "
puts "
<br><br>
<fieldset style=\"display: inline\">
<legend> Advanced Settings </legend>
<table>
<tr>
<th class=key>Show development and advanced packages?</th>
<td><input name=pkgdev id=pkgdev value=1 type=checkbox
"
if {$pkgdev} { puts -nonewline " checked" }
puts ">
puts "
<tr>
<form class=auto id=pkgdev method=get action=$env(REQUEST_URI)>
<th class=key>Show development and advanced packages?</th>
<td><input name=pkgdevoff value=0 type=hidden>
<input name=pkgdev id=pkgdev value=1 type=checkbox
"
if {$pkgdev} { puts " checked" }
puts {
>
<small>
<input id=pkgdev_submit value="save" type=submit>
</small>
<div id=pkgdev_output></div>
</td>
</form>
</tr>
}
puts "
</table>
<div id=pkgdev_output></div>
</fieldset>
"
eval_plugins settings
puts {
<br><br>
<fieldset style="display: inline">
<legend> Reset Custom Firmware </legend>
<button id=cfwreset>
Click to remove all packages and settings installed by the custom firmware.
</button>
</fieldset>
<script type=text/javascript>
$('#cfwreset').jConfirmAction({
yesAnswer: "Delete"
}, function(el) {
$('html').html('Restart the Humax using the remote control.');
$.get('/cgi-bin/cfwreset');
});
</script>
}
footer

View File

@@ -1,77 +0,0 @@
(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);
$(document).ready(function () {
$(":submit").button();
$(":checkbox").iphoneStyle();
$('form.auto').each(function(i, el) {
var id = $(this).attr('id');
var output = '#' + id + '_output'
$(this).ajaxForm({
target: output,
success: function() {
$(output).css('font-style', 'italic');
$(output).show('slow');
$(output).delay(2000).fadeOut('slow');
}
});
});
$('#pkgdev').change(function() {
var arg = '0';
if ($(this).attr('checked'))
arg = '1';
$(this).disable();
$('#pkgdev_output')
.empty()
.show('slow')
.load('/cgi-bin/settings.jim?pkgdev=' + arg,
function() {
$('#pkgdev').enable();
$('#pkgdev_output')
.css('font-style', 'italic')
.delay(2000).fadeOut('slow');
});
});
$('#https_toggle').change(function() {
var arg = 'off';
if ($(this).attr('checked'))
arg = 'on';
$(this).disable();
$('#https_output')
.empty()
.html('<img src=/img/loading.gif>Please Wait...')
.show('slow')
.load('/cgi-bin/settings.jim?act=https&val=' + arg,
function() {
$('#https_toggle').enable();
$('#https_output')
.css('font-style', 'italic')
.delay(2000).fadeOut('slow');
});
});
});

View File

@@ -1,111 +1,49 @@
#!/mod/bin/jimsh
source /mod/var/mongoose/lib/setup
require system.class findhsvc epg.class
puts "Content-Type: text/html"
puts ""
if {[catch {set pid [exec pgrep humaxtv]}]} {
puts "Cannot find humaxtv process."
exit
if {[catch {set pid [exec pgrep humaxtv]}]} { exit }
if {[catch {set data [exec lsof -p $pid | grep Video | fgrep .ts]} ]} {
exit
}
proc get_data {} {
global pid
set lines [split $data "\n"]
foreach line $lines {
regsub -all -- {[[:space:]]+} $line " " line
set fields [split $line " "]
set name [lindex [split $line "/"] end]
set size($name) [lindex $fields 6]
set seen($name) 0
}
set ret {}
if {[catch {set data \
[exec /mod/bin/lsof -p $pid | grep Video | fgrep .ts]} ]} {
set ret {}
sleep 2
set data [exec lsof -p $pid | grep Video | fgrep .ts]
regsub -all -- {[[:space:]]+} $line " " line
set lines [split $data "\n"]
foreach line $lines {
regsub -all -- {[[:space:]]+} $line " " line
set fields [split $line " "]
set name [lindex [split $line "/"] end]
set size2 [lindex $fields 6]
if { $size2 > $size($name) && $seen($name) < 1 } {
set mode "Recording"
set icon "745_1_11_Video_1REC.png"
} 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
}
}
set mode "Watching"
set icon "745_1_10_Video_2Live.png"
}
return $ret
}
set play 0
set rec 0
set seen {}
set output {}
incr seen($name)
set data [get_data]
if {[llength $data]} {
sleep 2
set ndata [get_data]
foreach name [array names ndata] {
if {![dict exists $seen $name]} { set seen($name) 0 }
if {![dict exists $data $name]} { set data($name) 0 }
if {$ndata($name) == -1} {
incr rec
incr play
set mode "Chase Playing"
set icon "745_1_11_Video_3REC_Live.png"
} elseif {$ndata($name) > $data($name) && $seen($name) < 1} {
incr rec
set mode "Recording"
set icon "745_1_11_Video_1REC.png"
} else {
incr play
set mode "Playing"
set icon "745_1_10_Video_2Live.png"
}
incr seen($name)
lappend output "<img class=va src=/images/$icon><span class=va>
$mode&nbsp;<i>$name</i></span>"
}
}
if {![system instandby] && $play < 1} {
set hsvc [system param CUR_SVC Value USERCONFIG]
set ff [$rsvdb query "
select usSvcid as svcid, usLcn as lcn,
substr(szSvcName, 2) as name
from channel.TBL_SVC
where hSvc = $hsvc
limit 1
"]
if {[llength $ff] == 1} {
lassign [lindex $ff 0] x svcid x lcn x name
set epgs [epg dbfetch get \
-service $svcid \
-time [clock seconds]\
]
set prog ""
if {[llength $epgs] == 1} {
lassign $epgs epg
set prog "- [$epg get name] ("
append prog "[clock format [$epg get start] -format %H:%M] - "
append prog "[clock format $([$epg get start] + [$epg get duration]) -format %H:%M]"
append prog ") \[[$epg percent]%\]"
}
lappend output "[epg channelicon $name 30 \
{vertical-align: middle; padding: 0 4px 0 2px}]
<span class=va> Watching <i>$lcn: $name $prog</i></span>"
}
}
if {[system instandby]} {
lappend output "<img class=va width=28 style=\"padding: 0 4px\"
src=/img/standby.png>
<span class=va>System is in standby.</span>"
lappend output "<img class=va src=/images/$icon><span class=va>
$mode&nbsp;$name</span><br>"
}
if {[llength $output]} {
puts [join $output "<br>"]
puts [join $output " "]
}

View File

@@ -0,0 +1,13 @@
#!/mod/bin/jimsh
set url "http://$env(HTTP_HOST):9091/"
puts "Content-Type: text/html
Location: $url
<meta http-equiv=refresh content=\"0; url=$url\">
Transmission is available <a href=$url>here</a>
"

View File

@@ -98,7 +98,7 @@ foreach e $records {
puts "[$e channel_icon 30]&nbsp;"
puts "$chnum
<a href=/cgi-bin/epg/service.jim?service=[$e get service_id]
<a href=/cgi-bin/epg_service.jim?service=[$e get service_id]
title=\"[$e get channel_name]\">
[$e get channel_name]
</a></div>"

View File

@@ -1,48 +0,0 @@
.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

@@ -1,6 +1,6 @@
/* progress bar container */
.progressbar, #progressbar{
#progressbar{
border:1px solid black;
width:200px;
height:20px;
@@ -8,7 +8,7 @@
color:black;
}
/* color bar */
.progressbar div.progress,#progressbar div.progress{
#progressbar div.progress{
position:absolute;
width:0;
height:100%;
@@ -16,13 +16,13 @@
background-color:#369;
}
/* text on bar */
.progressbar div.progress .text,#progressbar div.progress .text{
#progressbar div.progress .text{
position:absolute;
text-align:center;
color:white;
}
/* text off bar */
.progressbar div.text,#progressbar div.text{
#progressbar div.text{
position:absolute;
width:100%;
height:100%;

View File

@@ -1,91 +0,0 @@
UL.jqueryFileTree {
font-family: Verdana, sans-serif;
font-size: 11px;
line-height: 18px;
padding: 0px;
margin: 0px;
}
UL.jqueryFileTree LI {
list-style: none;
padding: 0px;
padding-left: 20px;
margin: 0px;
white-space: nowrap;
}
UL.jqueryFileTree A {
color: #333;
text-decoration: none;
display: block;
padding: 0px 2px;
}
UL.jqueryFileTree A:hover {
background: #BDF;
}
/* Core Styles */
.jqueryFileTree LI.directory { background: url(/img/filetree/directory.png) left top no-repeat; }
.jqueryFileTree LI.expanded { background: url(/img/filetree/folder_open.png) left top no-repeat; }
.jqueryFileTree LI.file { background: url(/img/filetree/file.png) left top no-repeat; }
.jqueryFileTree LI.wait { background: url(/img/filetree/spinner.gif) left top no-repeat; }
/* File Extensions*/
.jqueryFileTree LI.ext_3gp { background: url(/img/filetree/film.png) left top no-repeat; }
.jqueryFileTree LI.ext_afp { background: url(/img/filetree/code.png) left top no-repeat; }
.jqueryFileTree LI.ext_afpa { background: url(/img/filetree/code.png) left top no-repeat; }
.jqueryFileTree LI.ext_asp { background: url(/img/filetree/code.png) left top no-repeat; }
.jqueryFileTree LI.ext_aspx { background: url(/img/filetree/code.png) left top no-repeat; }
.jqueryFileTree LI.ext_avi { background: url(/img/filetree/film.png) left top no-repeat; }
.jqueryFileTree LI.ext_bat { background: url(/img/filetree/application.png) left top no-repeat; }
.jqueryFileTree LI.ext_bmp { background: url(/img/filetree/picture.png) left top no-repeat; }
.jqueryFileTree LI.ext_c { background: url(/img/filetree/code.png) left top no-repeat; }
.jqueryFileTree LI.ext_cfm { background: url(/img/filetree/code.png) left top no-repeat; }
.jqueryFileTree LI.ext_cgi { background: url(/img/filetree/code.png) left top no-repeat; }
.jqueryFileTree LI.ext_com { background: url(/img/filetree/application.png) left top no-repeat; }
.jqueryFileTree LI.ext_cpp { background: url(/img/filetree/code.png) left top no-repeat; }
.jqueryFileTree LI.ext_css { background: url(/img/filetree/css.png) left top no-repeat; }
.jqueryFileTree LI.ext_doc { background: url(/img/filetree/doc.png) left top no-repeat; }
.jqueryFileTree LI.ext_exe { background: url(/img/filetree/application.png) left top no-repeat; }
.jqueryFileTree LI.ext_gif { background: url(/img/filetree/picture.png) left top no-repeat; }
.jqueryFileTree LI.ext_fla { background: url(/img/filetree/flash.png) left top no-repeat; }
.jqueryFileTree LI.ext_h { background: url(/img/filetree/code.png) left top no-repeat; }
.jqueryFileTree LI.ext_htm { background: url(/img/filetree/html.png) left top no-repeat; }
.jqueryFileTree LI.ext_html { background: url(/img/filetree/html.png) left top no-repeat; }
.jqueryFileTree LI.ext_jar { background: url(/img/filetree/java.png) left top no-repeat; }
.jqueryFileTree LI.ext_jpg { background: url(/img/filetree/picture.png) left top no-repeat; }
.jqueryFileTree LI.ext_jpeg { background: url(/img/filetree/picture.png) left top no-repeat; }
.jqueryFileTree LI.ext_js { background: url(/img/filetree/script.png) left top no-repeat; }
.jqueryFileTree LI.ext_lasso { background: url(/img/filetree/code.png) left top no-repeat; }
.jqueryFileTree LI.ext_log { background: url(/img/filetree/txt.png) left top no-repeat; }
.jqueryFileTree LI.ext_m4p { background: url(/img/filetree/music.png) left top no-repeat; }
.jqueryFileTree LI.ext_mov { background: url(/img/filetree/film.png) left top no-repeat; }
.jqueryFileTree LI.ext_mp3 { background: url(/img/filetree/music.png) left top no-repeat; }
.jqueryFileTree LI.ext_mp4 { background: url(/img/filetree/film.png) left top no-repeat; }
.jqueryFileTree LI.ext_mpg { background: url(/img/filetree/film.png) left top no-repeat; }
.jqueryFileTree LI.ext_mpeg { background: url(/img/filetree/film.png) left top no-repeat; }
.jqueryFileTree LI.ext_ogg { background: url(/img/filetree/music.png) left top no-repeat; }
.jqueryFileTree LI.ext_pcx { background: url(/img/filetree/picture.png) left top no-repeat; }
.jqueryFileTree LI.ext_pdf { background: url(/img/filetree/pdf.png) left top no-repeat; }
.jqueryFileTree LI.ext_php { background: url(/img/filetree/php.png) left top no-repeat; }
.jqueryFileTree LI.ext_png { background: url(/img/filetree/picture.png) left top no-repeat; }
.jqueryFileTree LI.ext_ppt { background: url(/img/filetree/ppt.png) left top no-repeat; }
.jqueryFileTree LI.ext_psd { background: url(/img/filetree/psd.png) left top no-repeat; }
.jqueryFileTree LI.ext_pl { background: url(/img/filetree/script.png) left top no-repeat; }
.jqueryFileTree LI.ext_py { background: url(/img/filetree/script.png) left top no-repeat; }
.jqueryFileTree LI.ext_rb { background: url(/img/filetree/ruby.png) left top no-repeat; }
.jqueryFileTree LI.ext_rbx { background: url(/img/filetree/ruby.png) left top no-repeat; }
.jqueryFileTree LI.ext_rhtml { background: url(/img/filetree/ruby.png) left top no-repeat; }
.jqueryFileTree LI.ext_rpm { background: url(/img/filetree/linux.png) left top no-repeat; }
.jqueryFileTree LI.ext_ruby { background: url(/img/filetree/ruby.png) left top no-repeat; }
.jqueryFileTree LI.ext_sql { background: url(/img/filetree/db.png) left top no-repeat; }
.jqueryFileTree LI.ext_swf { background: url(/img/filetree/flash.png) left top no-repeat; }
.jqueryFileTree LI.ext_tif { background: url(/img/filetree/picture.png) left top no-repeat; }
.jqueryFileTree LI.ext_tiff { background: url(/img/filetree/picture.png) left top no-repeat; }
.jqueryFileTree LI.ext_txt { background: url(/img/filetree/txt.png) left top no-repeat; }
.jqueryFileTree LI.ext_vb { background: url(/img/filetree/code.png) left top no-repeat; }
.jqueryFileTree LI.ext_wav { background: url(/img/filetree/music.png) left top no-repeat; }
.jqueryFileTree LI.ext_wmv { background: url(/img/filetree/film.png) left top no-repeat; }
.jqueryFileTree LI.ext_xls { background: url(/img/filetree/xls.png) left top no-repeat; }
.jqueryFileTree LI.ext_xml { background: url(/img/filetree/code.png) left top no-repeat; }
.jqueryFileTree LI.ext_zip { background: url(/img/filetree/zip.png) left top no-repeat; }

View File

@@ -13,19 +13,6 @@ html>body
font-size: small;
}
.left, .cleft
{
float: left;
}
.cleft
{
clear: left;
}
fieldset.left, fieldset.cleft
{
display: inline;
}
div.container
{
position: relative;
@@ -95,12 +82,6 @@ table.borders, table.borders td, table.borders th
color: black;
}
.hover
{
background: #f6ff5b;
color: black;
}
table td,table th
{
font-size: small;
@@ -127,7 +108,7 @@ table.keyval td
color: black;
}
pre, .pre, .prelike
pre, .pre
{
font-family: Consolas, 'Courier New', Courier, monospace;
color: black;
@@ -145,10 +126,7 @@ pre, .pre, .prelike
-webkit-border-top-right-radius: 4px;
-moz-border-radius-topright: 4px;
-khtml-border-top-right-radius: 4px;
}
pre, .pre
{
white-space: pre-wrap;
white-space: -moz-pre-wrap !important;
white-space: -pre-wrap;
@@ -318,11 +296,3 @@ div.cut
font-size: 12px;
}
.also
{
font-size: 0.9em;
font-style: italic;
color: #333;
background: transparent;
}

View File

@@ -10,16 +10,6 @@ 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

@@ -1,60 +0,0 @@
.x-vlc-slider {
background:#C7F2FF;
text-align:center;
}
.x-vlc-slider-thumb {
background:#4EAECC;
width:3px;
}
.x-vlc-main {
}
.x-vlc-toolbar {
color:black;
}
.x-vlc-toolbar * {
vertical-align:top;
}
.x-vlc-btn {
padding-right:10px;
}
.x-vlc-btn-fullscreen {
background:url(/img/vlc/fullscreen2.gif) no-repeat;
}
.x-vlc-btn-plus {
background:url(/img/vlc/plus2.gif) no-repeat;
}
.x-vlc-btn-moins {
background:url(/img/vlc/moins2.gif) no-repeat;
}
.x-vlc-btn:hover {
color:red;
}
.x-vlc-btn-play {
background:url(/img/vlc/play2.gif) no-repeat;
}
.x-vlc-btn-stop {
background:url(/img/vlc/stop2.gif) no-repeat;
}
.x-vlc-btn-pause {
background:url(/img/vlc/pause2.gif) no-repeat;
}
.x-vlc-timer {
width:100px;
font-size:12px;
vertical-align:top;
text-align:center
}
.x-vlc-about {
font-size:10px;
}

View File

@@ -1,77 +0,0 @@
#!/mod/bin/jimsh
source /mod/var/mongoose/lib/setup
require ts.class
source /mod/var/mongoose/html/dedup/normalise.jim
source /mod/var/mongoose/html/dedup/process.jim
set dirs {}
set doit 0
foreach arg $argv {
if {$arg eq "-yes"} {
set doit 1
} else {
lappend dirs $arg
}
}
if {![llength $dirs]} { lappend dirs [exec pwd] }
foreach dir $dirs {
if {[string index $dir end] eq "/"} {
set dir [string range $dir 0 end-1]
}
puts "\[$dir\]"
foreach file [readdir $dir] {
if {[file extension $file] ne ".hmt"} { continue }
set file "$dir/$file"
set base [file tail [file rootname $file]]
lassign [dedupprocess $file] stat ts syn fn
puts -nonewline "$base -> "
switch $stat {
inuse {
puts -nonewline "In Use"
}
dup {
puts -nonewline "Duplicate"
if {$doit} {
set dupdir "$dir/_duplicates"
if {![file exists $dupdir]} {
file mkdir $dupdir
}
while {[file exists $dupdir/$fn.hmt]} {
append fn "~"
}
ts renamegroup $file "_duplicates/$fn"
puts -nonewline " - Renamed to _duplicates/$fn"
}
}
error {
puts -nonewline "Cannot process"
}
nothing {
puts -nonewline "Nothing to do"
}
preserve {
puts -nonewline "Preserving"
}
ok {
puts -nonewline $fn
if {$doit} {
# Dooooo, it.
$ts settitle $syn
ts renamegroup $file $fn
puts -nonewline "Done"
}
}
}
puts ""
}
}

View File

@@ -1,48 +0,0 @@
#!/mod/bin/jimsh
set dedup_prefixes {
{^new series\.* *}
{^cbeebies\.* *}
{^cbbc\.* *}
{^brand new series *-* *}
{^\.+}
}
proc dedupnormalise {title {reserve ""}} {
global dedup_prefixes
# Strip common prefixes
foreach prefix $dedup_prefixes {
regsub -nocase -all -- $prefix $title "" title
}
# Strip anything following a colon.
regsub -all -- { *[:].*$} $title "" title
# If the resulting string is longer than 40 characters then
# split around . and take the left hand side if appropriate.
if {[string length $title] > 40} {
lassign [split $title "."] v w
set title $v
if {[string length $title] < 6 && [string length $w] < 6} {
append title "_$w"
}
}
# if still short, add the reserve string.
if {[string length $title] < 10} {
if {[string match "${title}*" $reserve]} {
set title $reserve
} else {
append title " $reserve"
}
}
# Shorten if too long.
if {[string length $title] > 40} {
set title [string range $title 0 39]
}
return $title
}

View File

@@ -1,31 +0,0 @@
#!/mod/bin/jimsh
require system.class
proc dedupprocess {file} {{seen {}}} {
set ts [ts fetch $file 1]
set dir [file dirname $file]
set base [file tail [file rootname $file]]
set syn [dedupnormalise [$ts get synopsis] [$ts get title]]
# Escape special characters to create the filename.
regsub -all -- {[\/ &]} $syn "_" fn
regsub -all -- {[?]} $fn "" fn
set stat ok
if {[system inuse [file rootname $file]]} {
set stat inuse
} elseif {$fn in $seen} {
set stat dup
} elseif {[string length $syn] > 40} {
set stat error
} elseif {$base eq $fn} {
set stat nothing
} elseif {[file exists "$dir/$fn.ts"]} {
set stat preserve
}
lappend seen $fn
return [list $stat $ts $syn $fn]
}

View File

@@ -1,14 +0,0 @@
$(function() {
$('#browse').button().click(function() {
window.location = '/cgi-bin/browse.jim?dir=' +
encodeURIComponent($('#dir').text());
});
$('#dedup').button().click(function() {
window.location = window.location + '&doit=1';
});
});

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" -->

View File

@@ -1,139 +0,0 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
require pretty_size
puts "Content-Type: text/html"
puts ""
header
puts {
<script type=text/javascript src=/js/enadis.js></script>
<script type=text/javascript src=script.js></script>
<fieldset class=cleft>
<legend>Utilities</legend>
<table>
<tr>
<td>Run Diagnostic:</td>
<td><input name=seq id=seq autocorrect=off autocapitalize=off
value=general size=30 maxlength=50
class="text ui-widget-content ui-corner-all">
<button id=rundiag>Run Diagnostic</button>
</td>
</tr>
<tr>
<td>Package:</td>
<td><input name=fopkg id=fopkg autocorrect=off autocapitalize=off
value='' size=30 maxlength=50
class="text ui-widget-content ui-corner-all">
<button id=runfopkg>Force re-install</button>
</td>
</tr>
<tr><td colspan=2 style="height: 10px"></td></tr>
<tr>
<td colspan=2 align=center>
<button id=runedit style="width: 48%">File Editor</button>
<button id=dbinfo style="width: 48%">Database Browser</button>
</td>
</tr>
<tr>
<td colspan=2 align=center>
<button id=channelinfo style="width: 48%">Channel Information</button>
</td>
</tr>
}
if {[system model] eq "HDR"} {
puts {
<tr>
<td colspan=2 align=center>
<button id=dlna style="width: 48%">DLNA Server</button>
</td>
</tr>
}
}
puts {
<tr><td colspan=2 style="height: 10px"></td></tr>
<tr>
<td colspan=2>
<button id=reboot style="width: 100%">Reboot System</button>
</td>
</tr>
<tr>
<td colspan=2>
<button id=runreset style="width: 100%"
}
if {[system modversion 1] < 200} {
puts -nonewline " disabled class=ui-state-disabled"
}
puts {
>
Remove all custom firmware packages and settings
</button>
}
if {[system modversion 1] < 200} {
puts {
<div class=footnote style="text-align: center">
(Install custom firmware v2.00 to enable this option)
</div>
}
}
puts {
<div id=resetdone class="hidden blood">
Restart your Humax with the remote control.<br>
Allow it to turn off completely before restarting.<br>
</div>
</td>
</tr>
</table>
<span class=also style="padding-left: 5px">
View:
<a href=/jim/ref.html target=_blank>Jim Reference Manual</a> |
<a href=/jim/oo.html target=_blank>OO</a> |
<a href=/jim/sqlite.html target=_blank>Sqlite</a>
</span>
</fieldset>
<fieldset class=left>
<legend>View Log Files</legend>
}
foreach file [lsort [concat \
[glob -nocomplain /var/log/*.log] \
[glob -nocomplain /mod/tmp/*.log] \
]] {
puts "<a href=# class=log file=\"$file\">
<img border=0 height=14 src=/images/421_1_00_CH_Title_2R_Arrow.png>
[file tail $file]</a> ([pretty_size [file size $file]]) <br>"
}
puts {
</fieldset>
<div style="margin-top: 2em; display: none; float: left; clear: left"
id=results></div>
}
footer

View File

@@ -1,83 +0,0 @@
$(function() {
$('button').button();
$('#rundiag').click(function() {
$('#results')
.slideDown()
.text('\n\nRunning diagnostic, please wait...\n\n')
.load('rundiag.jim?diag=' +
encodeURIComponent($('#seq').val()), function() {
$('#results').wrapInner('<pre>');
});
});
$('#runfopkg').click(function() {
$('#results')
.slideDown()
.text('\n\nForcibly re-installing package, please wait...\n\n')
.load('/cgi-bin/opkg.jim?cmd=install+--force-reinstall+' +
encodeURIComponent($('#fopkg').val()), function() {
$('#results').wrapInner('<pre>');
$('#fopkg').val('');
});
});
$('a.log').click(function() {
$('#results')
.slideDown()
.text('\n\nLoading log, please wait...\n\n')
.load('/cgi-bin/cat.jim?file=' +
encodeURIComponent($(this).attr('file')), function() {
$('#results').wrapInner('<pre>');
});
});
$('#runedit').click(function(e) {
e.preventDefault();
window.location = '/edit/edit.jim';
});
$('#dbinfo').click(function(e) {
e.preventDefault();
window.location = '/cgi-bin/db.jim';
});
$('#channelinfo').click(function(e) {
e.preventDefault();
window.location = '/cgi-bin/channel.jim';
});
$('#dlna').click(function(e) {
e.preventDefault();
window.location = '/dlna/dlna.jim';
});
$('#reboot').click(function(e) {
e.preventDefault();
if (confirm('Are you sure you wish to perform a reboot now?'))
if (confirm('Really sure?\n\nThere is a small chance the ' +
' Humax may not restart\n' +
'without physical intervention.\n\n' +
'i.e. pressing the standby button or using the remote control'))
window.location = '/cgi-bin/restart.jim';
});
$('#runreset').click(function(e) {
e.preventDefault();
if (!confirm('Are you sure? This will completely remove all packages and settings.'))
return;
if (!confirm('Are you really sure?'))
return;
if (!confirm('One last time, are you sure?'))
return;
$.get('/cgi-bin/cfwreset.cgi', function() {
$('button').disable();
$('#resetdone').slideDown();
});
});
});

View File

@@ -1,84 +0,0 @@
#!/mod/bin/jimsh
package require cgi
package require sqlite3
source /mod/var/mongoose/lib/setup
require ts.class pretty_size
puts "Content-Type: text/html\r\n\r\n"
cgi_input
#cgi_dump
header
#append dmsfile ".rr"
set vars {
object.container 0
object.item.videoItem.movie 0
object.item.imageItem.photo 0
object.item.audioItem.musicTrack 0
}
if {[file exists $dmsfile] && ![catch {set db [sqlite3.open $dmsfile]}]} {
catch {
foreach ret [$db query "
select class, count(*) from tblObject group by 1
"] {
lassign $ret x class x num
set vars($class) $num
}
}
$db close
}
if {[system param DMS_START_ON]} {
set cfgstat "Enabled"
} else {
set cfgstat "Disabled"
}
if {[system is_listening 9000]} {
set stat "Running."
set img "745_1_10_Video_2Live.png"
} else {
set stat "Not running."
set img "745_1_11_Video_1REC.png"
}
puts "
<script type=text/javascript src=script.js></script>
<fieldset class=cleft>
<legend>DLNA Server Information</legend>
<table class=keyval cellpadding=5>
<tr>
<th>Server Status</th>
<td class=va>$cfgstat - <img class=va src=/images/$img> $stat</td>
</tr><tr>
<th>Folders Indexed</th>
<td>$vars(object.container)</td>
</tr><tr>
<th>Movies Indexed</th>
<td>$vars(object.item.videoItem.movie)</td>
</tr><tr>
<th>Photos Indexed</th>
<td>$vars(object.item.imageItem.photo)</td>
</tr><tr>
<th>Music Tracks Indexed</th>
<td>$vars(object.item.audioItem.musicTrack)</td>
</tr><tr>
</table>
</fieldset>
<div class=cleft style=\"padding-top: 0.5em\">
<button id=dlnareset>Reset DLNA Database</button>
</div>
<div id=results class=\"cleft hidden blood\"
style=\"border: solid 1px #ccc; margin: 1em; padding: 1em;\">
</div>
"
footer

View File

@@ -1,27 +0,0 @@
#!/mod/bin/jimsh
source /mod/var/mongoose/lib/setup
require system.class
puts "Content-Type: text/html"
puts ""
set menupath "Settings-&gt;System-&gt;Internet Setting-&gt;Content Share"
set dbpath "/mnt/hd2/dms_cds.db"
if {[system param DMS_START_ON] || [system is_listening 9000]} {
puts "To reset the DLNA Database, disable <i>Content Sharing</i>"
puts " in the Humax menus at<br>"
puts "<span class=also style=\"padding-left: 5em\">$menupath</span><br>"
puts "and click the button again."
} elseif {![file exists $dbpath]} {
puts "The DLNA Database does not exist.<br>"
puts "(already reset?)"
} else {
file delete $dbpath
puts "The DLNA Database has been reset.<br>"
puts "You can now re-enable <i>Content Sharing</i> in the Humax menus."
puts "<br>"
puts "<span class=also style=\"padding-left: 5em\">$menupath</span><br>"
}

View File

@@ -1,11 +0,0 @@
$(function() {
$('button').button();
$('#dlnareset').click(function(e) {
e.preventDefault();
$('#results').empty().slideDown().load('reset.jim');
});
});

View File

@@ -1,53 +0,0 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
puts "Content-Type: text/html"
puts ""
header
cgi_input
#cgi_dump
set file [cgi_get file "/tmp/hosts"]
puts {
<script type=text/javascript src=/js/enadis.js></script>
<script type=text/javascript src=/js/tabsupport.js></script>
<script type=text/javascript src=/js/jqueryFileTree.js></script>
<link rel=stylesheet type=text/css href=/css/jqueryFileTree.css />
<script type=text/javascript src=script.js></script>
<link rel=stylesheet href=style.css type=text/css />
<fieldset class=cleft>
<legend>File Editor</legend>
<div id=msg class=blood style="padding-bottom: 0.7em">
Use the <i>Open</i> button below to begin.
</div>
<textarea cols=80 rows=20 id=editor></textarea>
<br>
<button class=xeditactive id=open>Open</button>
<button class=editactive id=save>Save</button>
<button class=editactive id=revert>Revert</button>
<div id=result class="blood hidden" />
</fieldset>
<div class=cleft>
<button id=back>Back to diagnostics</button>
</div>
<div id=chooserd>
<i>Humax Filesystem</i>
<div id=chooser></div>
</div>
}
footer

View File

@@ -1,43 +0,0 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
cgi_input
#cgi_dump
puts "Content-Type: text/html"
puts ""
set root [cgi_get dir]
set files [lsort [readdir -nocomplain $root]]
puts "<ul class=jqueryFileTree class=hidden>"
foreach dir $files {
set path "$root/$dir"
regsub -all -- {\/+} $path "/" path
if {![file isdirectory $path]} continue
puts -nonewline "<li class=\"directory collapsed\"><a href=# rel=\""
puts -nonewline [cgi_quote_html $path]
puts "\">[cgi_quote_html $dir]</a></li>"
}
foreach file $files {
set path "$root/$file"
regsub -all -- {\/+} $path "/" path
if {[file isdirectory $path]} continue
set ext [file extension $file]
puts -nonewline "<li class=\"file"
if {[string length $ext]} {
puts -nonewline " ext_[string range $ext 1 end]"
}
puts -nonewline "\">"
puts -nonewline "<a href=# rel=\"[cgi_quote_html $path]\">"
puts -nonewline [cgi_quote_html $file]
puts "</a></li>"
}
puts "</ul>"

View File

@@ -1,32 +0,0 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
require chunked pretty_size
cgi_input
#cgi_dump
set file [cgi_get file "/tmp/hosts"]
if {$file eq "-"} { exit }
start_chunked "text/plain"
if {![file exists $file]} {
chunk ">>> File $file does not exist.\r\n"
} else {
set type [exec /mod/bin/file --brief --mime-type --dereference $file]
if {![string match {text/*} $type]} {
chunk ">>> File $file is not a plain file ($type)"
} elseif {[file size $file] > 102400} {
chunk ">>> File $file is too large."
chunk ">>> [pretty_size [file size $file]]"
} else {
set fp [open $file r]
chunk [read $fp]
close $fp
}
}
end_chunked

View File

@@ -1,23 +0,0 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
puts "Content-Type: text/html"
puts ""
cgi_input
#cgi_dump
set file [cgi_get file "/tmp/testfile"]
if {$file eq "-"} { exit }
set data [cgi_get data]
if {[catch {set fp [open $file w]} msg]} {
puts "Error, $msg"
} else {
$fp puts -nonewline $data
close $fp
puts "File saved."
}

View File

@@ -1,107 +0,0 @@
$(function() {
var file = null;
var changed = false;
$('button').button();
$('button.editactive').disable();
$('#editor').tabsupport().disable();
function loadfile(f)
{
if (!f)
f = file;
$('button.editactive').disable();
$('#editor').disable().val('');
$('#msg').text('Loading ' + f);
$.get('get.jim?file=' + encodeURIComponent(f), function(data) {
if (data.match('^>>>'))
{
$('#msg').text(data);
file = null;
changed = false;
}
else
{
$('#editor').val(data).enable();
$('button.editactive').enable();
$('#msg').html('Editing <i>' + f + '</i>');
file = f;
changed = false;
}
});
}
function result(msg)
{
$('#result')
.html(msg)
.slideDown('slow')
.delay(5000)
.slideUp('slow');
}
$('#chooser').fileTree({
root: '/',
script: 'files.jim',
multiFolder: false
}, function(file) {
$('#chooserd').dialog('close');
loadfile(file);
});
$('#chooserd').dialog({
title: "Choose File to Edit",
modal: true, autoOpen: false,
height: '500', width: '600',
draggable: true, resizable: true,
closeOnEscape: true,
buttons: {
"Cancel" : function() {$(this).dialog('close');}
}
});
$('#open').click(function() {
$('#chooserd').dialog('open');
});
$('#editor').change(function() {
changed = true;
});
$('#save').click(function() {
if (!changed)
{
result('No changes to save.');
return;
}
if (!confirm('Save file?'))
return;
$.post('put.jim', {
'file': file,
'data': $('#editor').val()
}, function(data) {
result(data);
});
});
$('#revert').click(function() {
if (!changed)
{
result('No changes to revert.');
return;
}
if (!confirm('Discard changes and re-load file?'))
return;
loadfile();
});
$('#back').click(function() {
window.location = '/diag/diag.jim';
});
});

View File

@@ -1,24 +0,0 @@
textarea
{
background: white;
color: black;
}
#filename
{
font-style: italic;
}
.loading
{
font-style: italic;
color: #aaa;
background: white;
}
#chooser
{
border: solid 1px #bbb;
padding: 5px;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

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

View File

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

Some files were not shown because too many files have changed in this diff Show More