Compare commits
13 Commits
0.8.3@2148
...
0.8.8@578
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
593b7dbb89 | ||
|
|
de47e46fe7 | ||
|
|
509c98ee74 | ||
|
|
ddb63e68b7 | ||
|
|
5de2ba1c37 | ||
|
|
43f6281410 | ||
|
|
8166af0f1b | ||
|
|
25344c5ff4 | ||
|
|
b6ce0e3b16 | ||
|
|
a189b524ab | ||
|
|
84b00010a8 | ||
|
|
993958d346 | ||
|
|
1045587fbd |
@@ -1,11 +1,9 @@
|
||||
Package: webif
|
||||
Priority: optional
|
||||
Section: web
|
||||
Version: 0.8.3
|
||||
Version: 0.8.8
|
||||
Architecture: mipsel
|
||||
Maintainer: af123@hummypkg.org.uk
|
||||
Depends: mongoose(>=3.0-2),jim(>=0.71-1),jim-sqlite3(>=0.71-1),jim-cgi(>=0.4-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
|
||||
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.2),ssmtp,anacron
|
||||
Suggests: ffmpeg,webif-iphone,nicesplice,id3v2
|
||||
Description: An evolving web interface for the Humax.
|
||||
|
||||
17
CONTROL/postinst
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
export tmpf=/tmp/cronf.$$
|
||||
|
||||
# Add anacron jobs
|
||||
|
||||
ana=$PKG_ROOT/etc/anacrontab
|
||||
grep -v 'backup/backup.jim' $ana > $tmpf
|
||||
(
|
||||
cat $tmpf
|
||||
echo "1 8 sched_backup /mod/var/mongoose/cgi-bin/backup/backup.jim"
|
||||
) > $ana
|
||||
|
||||
$PKG_ROOT/etc/init.d/S02anacron start < /dev/null > /dev/null 2>&1 &
|
||||
|
||||
exit 0
|
||||
|
||||
10
CONTROL/prerm
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
export tmpf=/tmp/cronf.$$
|
||||
|
||||
ana=/mod/etc/anacrontab
|
||||
grep -v 'backup/backup.jim' $ana > $tmpf
|
||||
cp $tmpf $ana
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -13,12 +13,23 @@ puts ""
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
if {![dict exists $_cgi file]} {
|
||||
puts "No filename supplied."
|
||||
exit
|
||||
set now [clock seconds]
|
||||
set file [file tail [cgi_get file \
|
||||
[clock format $now -format "auto-%Y-%b-%d-%H:%M"]]]
|
||||
|
||||
if {[string match {auto-*} $file]} {
|
||||
# Delete any automatic backups over 7 days old.
|
||||
set mt $(7 * 86400)
|
||||
foreach af [glob -nocomplain "$dir/auto-*"] {
|
||||
set aft [file mtime $af]
|
||||
set diff $($now - $aft)
|
||||
if {$diff > $mt} {
|
||||
puts "Removing $af"
|
||||
file delete $af
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
set file [file tail [dict get $_cgi file]]
|
||||
set ffile "/$dir/$file.rbk"
|
||||
|
||||
if {[file exists $ffile]} {
|
||||
|
||||
@@ -20,7 +20,18 @@ if {![file isdirectory $dir]} {
|
||||
exit
|
||||
}
|
||||
|
||||
set backups [glob -nocomplain "$dir/*.rbk"]
|
||||
proc s_time {a b} {
|
||||
file stat $a l
|
||||
set at $l(ctime)
|
||||
file stat $b l
|
||||
set bt $l(ctime)
|
||||
|
||||
if {$at < $bt} { return -1 }
|
||||
if {$at > $bt} { return 1 }
|
||||
return 0
|
||||
}
|
||||
|
||||
set backups [lsort -command s_time [glob -nocomplain "$dir/*.rbk"]]
|
||||
|
||||
if {![llength $backups]} {
|
||||
empty
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/setup
|
||||
require ts.class pretty_size system.class
|
||||
require ts.class pretty_size system.class settings.class escape
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
|
||||
set nicesplice [system pkginst nicesplice]
|
||||
set flatten [system pkginst flatten]
|
||||
|
||||
set ignore {.nts .thm .hmt .hmi}
|
||||
set include {.ts .avi .mpg .mpeg .wmv .mkv .mp3 .mp4 .mov}
|
||||
@@ -15,19 +16,60 @@ set include {.ts .avi .mpg .mpeg .wmv .mkv .mp3 .mp4 .mov}
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
#set env(REQUEST_URI) ''
|
||||
#set _cgi(dir) "/media/My Video/\[Don't Die Young\]"
|
||||
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
|
||||
}
|
||||
|
||||
proc directory {file bfile} {
|
||||
global flatten
|
||||
|
||||
regsub -all " +" $bfile "" tbfile
|
||||
puts "<div class=va>"
|
||||
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 href=\"$::env(REQUEST_URI)?dir=[cgi_quote_url $file]\"
|
||||
file=\"$file\">"
|
||||
puts "<a class=dbf
|
||||
href=\"$::env(REQUEST_URI)?dir=[cgi_quote_url $file]\"
|
||||
file=\"[cgi_quote_url $file]\">"
|
||||
puts "$bfile</a><span class=filesize id=\"$tbfile\">
|
||||
</span></div>"
|
||||
</span>"
|
||||
|
||||
set noflat 0
|
||||
if $flatten {
|
||||
if {[string match {\[*\]} [file tail $file]]} { set noflat 1 }
|
||||
if {[file exists "$file/.noflatten"]} {
|
||||
set noflat 1
|
||||
}
|
||||
|
||||
if $noflat {
|
||||
puts "<img alt=\"No-flatten\" title=\"No-flatten\"
|
||||
class=va src=/img/flat-tyre.png height=21>"
|
||||
}
|
||||
}
|
||||
|
||||
puts -nonewline "
|
||||
<a href=#>
|
||||
<img class=\"dopt va\" border=0 width=45 "
|
||||
if $flatten { puts -nonewline "noflat=$noflat " }
|
||||
puts "
|
||||
src=/images/181_1_00_Help5_OPT_Plus.png>
|
||||
</a>
|
||||
"
|
||||
|
||||
puts "
|
||||
<div class=\"results blood\" style=\"margin: 0 0 0 5em\"></div>
|
||||
"
|
||||
puts "</div>"
|
||||
}
|
||||
|
||||
proc entry {file} {{i 0}} {
|
||||
@@ -75,7 +117,7 @@ proc entry {file} {{i 0}} {
|
||||
<div class=\"va bf\" id=[incr i]>
|
||||
<img class=va border=0 src=/img/$img.png>
|
||||
<input class=\"$fscl\" type=checkbox>
|
||||
<a class=bf file=\"$file\" type=$type href=#>
|
||||
<a class=bf file=\"[cgi_quote_url $file]\" type=$type href=#>
|
||||
$bfile
|
||||
</a>
|
||||
"
|
||||
@@ -166,9 +208,24 @@ puts {
|
||||
if {[system model] eq "HDR"} {
|
||||
puts { <li class="separator"><a href=#decrypt>Decrypt</a></li> }
|
||||
}
|
||||
if {[system pkginst ffmpeg]} {
|
||||
puts { <li><a href=#audio>Extract Audio</a></li> }
|
||||
}
|
||||
if $nicesplice {
|
||||
puts { <li class="cut separator"><a href=#crop>Crop</a></li> }
|
||||
}
|
||||
puts {
|
||||
</ul>
|
||||
|
||||
<ul id=doptmenu class=contextMenu>
|
||||
<li class=delete><a href=#delete>Delete</a></li>
|
||||
<li><a href=#rename>Rename</a></li>
|
||||
}
|
||||
|
||||
if $flatten {
|
||||
puts { <li class="separator"><a href=#flat>No-Flatten</a></li> }
|
||||
}
|
||||
|
||||
puts {
|
||||
</ul>
|
||||
|
||||
@@ -192,7 +249,7 @@ puts {
|
||||
<tr style="display: none" class=tstype>
|
||||
<th>
|
||||
<label for="renametitle" style="padding-top: 0.5em">
|
||||
<b>New EPG Title</b>
|
||||
<b>New Medialist Title</b>
|
||||
</label>
|
||||
</th>
|
||||
<td>
|
||||
@@ -208,6 +265,26 @@ puts {
|
||||
</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>
|
||||
@@ -274,12 +351,59 @@ regsub -all -- {\/+} "$dir/*" "/" dir
|
||||
# Escape square brackets (for glob)
|
||||
regsub -all {([\\[])} $dir {\\\1} dir
|
||||
|
||||
foreach file [lsort [glob -nocomplain "$dir"]] {
|
||||
entry $file
|
||||
proc s_time {a b} {
|
||||
set ad [file isdirectory $a]
|
||||
set bd [file isdirectory $b]
|
||||
|
||||
if {$ad && !$bd} { return -1 }
|
||||
if {$bd && !$ad} { return 1 }
|
||||
if {$ad && $bd} {
|
||||
if {$a < $b} { return -1 }
|
||||
if {$a > $b} { return 1 }
|
||||
return 0
|
||||
}
|
||||
|
||||
file stat $a l
|
||||
set at $l(ctime)
|
||||
file stat $b l
|
||||
set bt $l(ctime)
|
||||
|
||||
if {$at < $bt} { return -1 }
|
||||
if {$at > $bt} { return 1 }
|
||||
return 0
|
||||
}
|
||||
|
||||
set files [glob -nocomplain $dir]
|
||||
switch $order {
|
||||
1 { set files [lsort -command s_time $files] }
|
||||
default { set files [lsort $files] }
|
||||
}
|
||||
|
||||
foreach file $files { entry $file }
|
||||
|
||||
puts "<a href=# id=selectall>Select all</a> | <a href=# id=deselectall>none</a>"
|
||||
|
||||
# Sort icons
|
||||
puts "<div id=sortdiv>"
|
||||
set sortlist {{0 sort_name name} {1 sort_date date}}
|
||||
foreach sl $sortlist {
|
||||
lassign $sl index img descr
|
||||
|
||||
if {$index} { puts " | " }
|
||||
|
||||
set tag "Currently sorting"
|
||||
if {$order != $index} {
|
||||
puts "
|
||||
<a href=$env(REQUEST_URI)?$env(QUERY_STRING)&order=$index>"
|
||||
set tag "Sort"
|
||||
}
|
||||
puts "<img class=va border=0 src=/img/$img.gif> $tag by $descr"
|
||||
if {$order != $index} {
|
||||
puts "</a>"
|
||||
}
|
||||
}
|
||||
puts "</div>"
|
||||
|
||||
puts "</fieldset>"
|
||||
|
||||
puts "<div class=brow>"
|
||||
|
||||
109
var/mongoose/cgi-bin/browse/audio.jim
Executable file
@@ -0,0 +1,109 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require sqlite3
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/setup
|
||||
require ts.class system.class
|
||||
|
||||
puts "Content-Type: text/html\r\n\r\n"
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
set rfile [cgi_get file]
|
||||
set ts [ts fetch $rfile]
|
||||
set dir [file dirname $rfile]
|
||||
set len [$ts duration 1]
|
||||
|
||||
if {[cgi_get do] eq "it"} {
|
||||
set xstart [clock milliseconds]
|
||||
|
||||
set base [file rootname $rfile]
|
||||
set shname [file tail $base]
|
||||
puts "Processing $shname"
|
||||
|
||||
puts [exec /mod/bin/ffmpeg -y -benchmark -v 0 \
|
||||
-i $rfile -f mp3 \
|
||||
-vn -acodec copy "${base}.mp3"]
|
||||
|
||||
if {[system pkginst id3v2]} {
|
||||
puts [exec /mod/bin/id3v2 \
|
||||
--song "[$ts get title]" \
|
||||
--comment "[$ts get synopsis]" \
|
||||
--album "[$ts get channel_name]" \
|
||||
--year "[clock format [$ts get start] -format {%Y}]" \
|
||||
"${base}.mp3"]
|
||||
}
|
||||
|
||||
set xtime [expr [expr [clock milliseconds] - $xstart] / 1000.0]
|
||||
puts "Time taken: $xtime"
|
||||
|
||||
exit
|
||||
}
|
||||
|
||||
header
|
||||
|
||||
puts "
|
||||
<link href=/css/jquery.progressbar.css rel=stylesheet type=text/css />
|
||||
<script type=\"text/javascript\" src=\"/js/jquery.progressbar.js\"></script>
|
||||
|
||||
<table class=keyval cellpadding=5>
|
||||
<tr><th>File:</th><td>$rfile</td></tr>
|
||||
<tr><th>Length:</th><td>[clock format $len -format "%T"]</td></tr>
|
||||
</table>
|
||||
"
|
||||
|
||||
puts {
|
||||
|
||||
<div style="margin-top: 10px"></div>
|
||||
<div id=audiodiv><button id=audioit>Perform audio extraction</button></div>
|
||||
<div id=progressdiv style="display: none">
|
||||
Extracting audio: <div id=progressbar></div>
|
||||
}
|
||||
puts "<button id=back
|
||||
dir=\"[cgi_quote_url $dir]\"
|
||||
rfile=\"[cgi_quote_url $rfile]\"
|
||||
style=\"display: none\">Back to media list</button>"
|
||||
puts {
|
||||
<div id=output class=pre style="margin-top: 10px"></div>
|
||||
</div>
|
||||
|
||||
<script type=text/javascript>
|
||||
|
||||
var handle = 0;
|
||||
|
||||
function update()
|
||||
{
|
||||
$.get('/cgi-bin/browse/audio_progress.jim?file='
|
||||
+ $('#back').attr('rfile'), function(data) {
|
||||
if (handle)
|
||||
$('#progressbar').reportprogress(data);
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#progressbar').reportprogress(0);
|
||||
|
||||
$('#back').button().click(function() {
|
||||
window.location = '/cgi-bin/browse.jim?dir=' + $(this).attr('dir');
|
||||
});
|
||||
|
||||
$('#audioit').button().click(function() {
|
||||
$('#audiodiv').hide('slow');
|
||||
$('#progressdiv').show('slow');
|
||||
handle = setInterval("update()", 1000);
|
||||
$('#output').load(document.URL + '&do=it', function() {
|
||||
clearInterval(handle);
|
||||
handle = 0;
|
||||
$('#back').show();
|
||||
$('#progressbar').reportprogress(100);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
}
|
||||
|
||||
26
var/mongoose/cgi-bin/browse/audio_progress.jim
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/setup
|
||||
require ts.class
|
||||
|
||||
puts "Content-Type: text/html\r\n\r\n"
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
set tsfile [cgi_get file]
|
||||
set rfile [file normalize $tsfile]
|
||||
set bfile [file rootname $rfile]
|
||||
|
||||
if {![file exists "${bfile}.mp3"]} {
|
||||
puts "0"
|
||||
} else {
|
||||
set sz [file size $rfile]
|
||||
set nsz [expr [file size "${bfile}.mp3"] / 0.3]
|
||||
|
||||
set perc [expr $nsz * 100 / $sz]
|
||||
if {$perc > 100} { set perc 100 }
|
||||
puts $perc
|
||||
}
|
||||
|
||||
@@ -79,8 +79,8 @@ 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;
|
||||
var url = '/cgi-bin/browse/delete.jim?file=' + file +
|
||||
'&type=' + type;
|
||||
$(results)
|
||||
.html('<img src=/img/loading.gif>Deleting, please wait...')
|
||||
.slideDown('slow')
|
||||
@@ -93,19 +93,19 @@ function delete_callback(file, type, id)
|
||||
|
||||
function lock_callback(file, type, id)
|
||||
{
|
||||
var url = '/cgi-bin/browse/lock.jim?file=' + encodeURIComponent(file);
|
||||
var url = '/cgi-bin/browse/lock.jim?file=' + file;
|
||||
$.get(url, function() { window.location.reload(true); });
|
||||
}
|
||||
|
||||
function enc_callback(file, type, id)
|
||||
{
|
||||
var url = '/cgi-bin/browse/enc.jim?file=' + encodeURIComponent(file);
|
||||
var url = '/cgi-bin/browse/enc.jim?file=' + file;
|
||||
$.get(url, function() { window.location.reload(true); });
|
||||
}
|
||||
|
||||
function new_callback(file, type, id)
|
||||
{
|
||||
var url = '/cgi-bin/browse/new.jim?file=' + encodeURIComponent(file);
|
||||
var url = '/cgi-bin/browse/new.jim?file=' + file;
|
||||
$.get(url, function() { window.location.reload(true); });
|
||||
}
|
||||
|
||||
@@ -116,6 +116,13 @@ 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 savestream_submit()
|
||||
{
|
||||
var s = $('#savestream_form').serialize();
|
||||
@@ -141,7 +148,7 @@ function confirm_action(action, callback, file, type, id)
|
||||
});
|
||||
$('#confirm').empty().html(
|
||||
'Are you sure you wish to ' + action + '<br>' +
|
||||
'<i>' + bfile + '</i> ?'
|
||||
'<i>' + decodeURIComponent(bfile) + '</i> ?'
|
||||
);
|
||||
$confirm.dialog('open');
|
||||
}
|
||||
@@ -186,9 +193,15 @@ function preparemenu(el, menu)
|
||||
}
|
||||
|
||||
if (el.attr('odencd') == 1)
|
||||
{
|
||||
$('#optmenu').enableContextMenuItems('#decrypt');
|
||||
$('#optmenu').disableContextMenuItems('#audio');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#optmenu').disableContextMenuItems('#decrypt');
|
||||
$('#optmenu').enableContextMenuItems('#audio');
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
@@ -198,11 +211,23 @@ function preparemenu(el, menu)
|
||||
$('#optmenu').disableContextMenuItems('#enc');
|
||||
$('#optmenu').disableContextMenuItems('#new');
|
||||
$('#optmenu').disableContextMenuItems('#decrypt');
|
||||
$('#optmenu').disableContextMenuItems('#audio');
|
||||
$('#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() {
|
||||
|
||||
@@ -236,8 +261,8 @@ var menuclick = function(action, el, pos)
|
||||
break;
|
||||
|
||||
case 'rename':
|
||||
$('#rename').val(bfile);
|
||||
$('#renameorig').val(file);
|
||||
$('#rename').val(decodeURIComponent(bfile));
|
||||
$('#renameorig').val(decodeURIComponent(file));
|
||||
|
||||
$('#titleorig').val('');
|
||||
$('#renametitle').val('');
|
||||
@@ -247,7 +272,7 @@ var menuclick = function(action, el, pos)
|
||||
if (type == 'ts')
|
||||
{
|
||||
$.getJSON('/cgi-bin/browse/epgtitle.jim?file=' +
|
||||
encodeURIComponent(file), epginfo_callback);
|
||||
file, epginfo_callback);
|
||||
}
|
||||
|
||||
$('#renameform').dialog('open');
|
||||
@@ -255,17 +280,69 @@ var menuclick = function(action, el, pos)
|
||||
|
||||
case 'download':
|
||||
window.location.href = '/cgi-bin/browse/download.jim?file=' +
|
||||
encodeURIComponent(file);
|
||||
file;
|
||||
break;
|
||||
|
||||
case 'crop':
|
||||
window.location.href = '/cgi-bin/browse/crop.jim?file=' +
|
||||
encodeURIComponent(file);
|
||||
file;
|
||||
break;
|
||||
|
||||
case 'decrypt':
|
||||
window.location.href = '/cgi-bin/browse/decrypt.jim?file=' +
|
||||
encodeURIComponent(file);
|
||||
file;
|
||||
break;
|
||||
|
||||
case 'audio':
|
||||
window.location.href = '/cgi-bin/browse/audio.jim?file=' +
|
||||
file;
|
||||
break;
|
||||
|
||||
default:
|
||||
alert('Unhandled action: ' + action);
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
var dmenuclick = function(action, el, pos)
|
||||
{
|
||||
var direl = $(el).parent().parent();
|
||||
var file = $(el).parent().prevAll('a.dbf').last().attr('file');
|
||||
var bfile = file.replace(/.*\//g, '');
|
||||
bfile = bfile.replace(/[\x00-\x1f]+/g, '');
|
||||
var results = $(el).parent().next('div.results');
|
||||
|
||||
switch (action)
|
||||
{
|
||||
case 'delete':
|
||||
var url = '/cgi-bin/browse/delete.jim?file=' + file +
|
||||
'&type=dir';
|
||||
|
||||
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(url, function() {
|
||||
$(direl).delay(3000).slideUp(300, function() {
|
||||
$(direl).remove();
|
||||
});
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
||||
case 'rename':
|
||||
$('#drename').val(decodeURIComponent(bfile));
|
||||
$('#drenameorig').val(decodeURIComponent(file));
|
||||
$('#drenameform').dialog('open');
|
||||
break;
|
||||
|
||||
case 'flat':
|
||||
var url = '/cgi-bin/browse/flat.jim?file=' + file;
|
||||
$.get(url, function() { window.location.reload(true); });
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -284,6 +361,15 @@ var menuclick = function(action, el, pos)
|
||||
menuclick
|
||||
);
|
||||
|
||||
$('img.dopt').contextMenu(
|
||||
{
|
||||
menu: 'doptmenu',
|
||||
leftButton: true,
|
||||
beforeShow: preparedmenu
|
||||
},
|
||||
dmenuclick
|
||||
);
|
||||
|
||||
// Disable items which are not yet implemented.
|
||||
$('#optmenu').disableContextMenuItems('#title');
|
||||
|
||||
@@ -308,8 +394,8 @@ var menuclick = function(action, el, pos)
|
||||
e.preventDefault();
|
||||
var file = $(this).attr('file');
|
||||
var type = $(this).attr('type');
|
||||
var url = '/cgi-bin/browse/file.jim?file=' +
|
||||
encodeURIComponent(file) + '&type=' + type;
|
||||
var url = '/cgi-bin/browse/file.jim?file=' + file
|
||||
+ '&type=' + type;
|
||||
$('#dialogue').load(url);
|
||||
$dialog.dialog('open');
|
||||
});
|
||||
@@ -327,6 +413,19 @@ var menuclick = function(action, el, pos)
|
||||
close: function() { $('#rename').val(''); }
|
||||
});
|
||||
|
||||
$('#drenameform').dialog({
|
||||
autoOpen: false,
|
||||
height: 'auto', width: 'auto',
|
||||
modal: true,
|
||||
buttons: {
|
||||
"Update": drename_submit,
|
||||
"Close": function() {
|
||||
$(this).dialog('close');
|
||||
}
|
||||
},
|
||||
close: function() { $('#drename').val(''); }
|
||||
});
|
||||
|
||||
$('#savestreamform').dialog({
|
||||
autoOpen: false,
|
||||
height: 'auto', width: 'auto',
|
||||
@@ -400,7 +499,7 @@ var menuclick = function(action, el, pos)
|
||||
.click(function() {
|
||||
var files = new Array();
|
||||
var els = $('input.fs:checked + a').each(function() {
|
||||
files.push(encodeURIComponent($(this).attr('file')));
|
||||
files.push($(this).attr('file'));
|
||||
});
|
||||
//console.log("%o", files);
|
||||
var str = 'Are you sure you want to delete ' + files.length +
|
||||
|
||||
@@ -9,8 +9,7 @@ puts "Content-Type: text/html\r\n\r\n"
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
set tsfile [cgi_get file]
|
||||
set rfile [file normalize $tsfile]
|
||||
set rfile [cgi_get file]
|
||||
set ts [ts fetch $rfile]
|
||||
set dir [file dirname $rfile]
|
||||
|
||||
|
||||
@@ -10,14 +10,14 @@ puts "Content-Type: text/html\r\n\r\n"
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
set tsfile [cgi_get file]
|
||||
set rfile [file normalize $tsfile]
|
||||
set rfile [cgi_get file]
|
||||
set ts [ts fetch $rfile]
|
||||
set dir [file dirname $rfile]
|
||||
set len [$ts duration 1]
|
||||
lassign [$ts dlnaloc] url
|
||||
|
||||
if {[cgi_get do] eq "it"} {
|
||||
set xstart [clock milliseconds]
|
||||
|
||||
set base [file rootname $rfile]
|
||||
set origdir "$dir/_original"
|
||||
@@ -51,6 +51,9 @@ if {[cgi_get do] eq "it"} {
|
||||
exec /mod/bin/hmt -encrypted "$dir/$shname.hmt"
|
||||
}
|
||||
|
||||
set xtime [expr [expr [clock milliseconds] - $xstart] / 1000.0]
|
||||
puts "Time taken: $xtime"
|
||||
|
||||
exit
|
||||
}
|
||||
|
||||
|
||||
@@ -20,9 +20,13 @@ if {$type eq "ts"} {
|
||||
puts "Problem deleting $file, [$ts get error]"
|
||||
}
|
||||
exit
|
||||
} elseif {$type eq "dir"} {
|
||||
puts -nonewline "Directory..."
|
||||
puts [exec /mod/bin/busybox/rm -rf $file]
|
||||
puts -nonewline "Done..."
|
||||
} else {
|
||||
file delete $file
|
||||
file delete "[file rootname $file].hmi"
|
||||
puts "Successfully deleted $file."
|
||||
}
|
||||
|
||||
file delete $file
|
||||
file delete "[file rootname $file].hmi"
|
||||
puts "Successfully deleted $file."
|
||||
|
||||
|
||||
@@ -11,20 +11,23 @@ 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 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 {[string match {*.ts} $file]} {
|
||||
if {![catch {set ts [ts fetch $file]}]} {
|
||||
|
||||
#puts "DLNA: $dlna"
|
||||
# If it's encrypted on disk and the DLNA option is available,
|
||||
# then use the server to perform decryption on the fly.
|
||||
if {[$ts flag "ODEncrypted"] > 0} {
|
||||
set dlna [$ts dlnaloc]
|
||||
if {[llength $dlna]} { lassign $dlna url mime }
|
||||
|
||||
#puts "DLNA: $dlna"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
puts "Content-Type: text/plain"
|
||||
|
||||
28
var/mongoose/cgi-bin/browse/flat.jim
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/ts.class
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
set dir [cgi_get file]
|
||||
if {![file isdirectory $dir]} { exit }
|
||||
set noflat 0
|
||||
if {[string match {\[*\]} [file tail $dir]]} {
|
||||
set ndir [string range [file tail $dir] 1 end-1]
|
||||
file rename $dir "[file dirname $dir]/$ndir"
|
||||
puts "Unflagged directory as noflatten."
|
||||
exit
|
||||
}
|
||||
if {[file exists "$dir/.noflatten"]} {
|
||||
file delete "$dir/.noflatten"
|
||||
puts "Unflagged directory as noflatten."
|
||||
} else {
|
||||
close [open "$dir/.noflatten" w]
|
||||
puts "Flagged directory as noflatten."
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ span.pl { padding-left: 2em; }
|
||||
|
||||
<link href=/css/jquery.progressbar.css rel=stylesheet type=text/css />
|
||||
<script type="text/javascript" src="/js/jquery.progressbar.js"></script>
|
||||
<script type="text/javascript" src="/js/touchbridge.js"></script>
|
||||
|
||||
<p><b>
|
||||
Drag the files below into order, enter a name for the resulting file and then
|
||||
|
||||
@@ -29,7 +29,7 @@ foreach file [split [cgi_get files] ","] {
|
||||
puts -nonewline "Done..."
|
||||
}
|
||||
} else {
|
||||
if {[catch {file delete $ts} msg]} {
|
||||
if {[catch {file delete $file} msg]} {
|
||||
puts -nonewline "Error: $msg"
|
||||
} else {
|
||||
catch {file delete "[file rootname $file].hmi"}
|
||||
|
||||
@@ -40,6 +40,7 @@ foreach file [lsort [glob -nocomplain "$sdir"]] {
|
||||
puts "<td nowrap>$base</td>"
|
||||
set syn [$ts get synopsis]
|
||||
regsub -nocase -all -- {^new series\.* *} $syn "" syn
|
||||
regsub -nocase -all -- {^cbeebies\. *} $syn "" syn
|
||||
regsub -all -- { *[:].*$} $syn "" syn
|
||||
if {[string length $syn] > 40} {
|
||||
lassign [split $syn "."] v w
|
||||
|
||||
@@ -17,12 +17,23 @@ set event [rsv slot $table $slot]
|
||||
|
||||
set rsvicon [$event icon]
|
||||
if {$rsvicon ne ""} {
|
||||
set rsvicon "<img src='images/$rsvicon' height=20>
|
||||
set rsvicon "<img src='images/$rsvicon' height=20>"
|
||||
if {[$event get ersvtype] == 3} {
|
||||
if {[$event padded]} {
|
||||
set padding "<- [expr [$event get ulPreOffset] / 60], [expr [$event get ulPostOffset] / 60] ->"
|
||||
append rsvicon \
|
||||
"<img src=/img/pad.png height=20
|
||||
title=\"$padding\" alt=\"$padding\">"
|
||||
} else {
|
||||
append rsvicon \
|
||||
"<img src=/img/ar.png height=20>"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
set RKIcon [$event RKIcon]
|
||||
if {$RKIcon ne ""} {
|
||||
set RKIcon "<img src='images/$RKIcon' height=20>
|
||||
set RKIcon "<img src='images/$RKIcon' height=20>"
|
||||
}
|
||||
|
||||
if {[$event get ucRecKind] == 4} {
|
||||
@@ -115,7 +126,7 @@ foreach ev [split [$event get szEventToRecord] "|"] {
|
||||
}
|
||||
puts "</td></tr>"
|
||||
puts "<tr><th>Accepted</th><td>"
|
||||
if {[$event get aulEventToRecordInfo] != ""} {
|
||||
if {[$event get aulEventToRecordInfo] ne ""} {
|
||||
puts "Yes"
|
||||
}
|
||||
puts "</td></tr>"
|
||||
|
||||
@@ -10,6 +10,16 @@ table.tablesorter .header {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
table.tablesorter .headerplain {
|
||||
background-image: url(/img/tsort/bgplain.png);
|
||||
background-repeat: no-repeat;
|
||||
border-left: 1px solid #FFF;
|
||||
border-right: 1px solid #000;
|
||||
border-top: 1px solid #FFF;
|
||||
padding-top: 8px;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
table.tablesorter .headerSortUp {
|
||||
background-image: url(/img/tsort/asc.png);
|
||||
background-repeat: no-repeat;
|
||||
|
||||
BIN
var/mongoose/html/img/ar.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
1
var/mongoose/html/img/channels/Channel 5 + 1.png
Symbolic link
@@ -0,0 +1 @@
|
||||
Channel 5 +1.png
|
||||
BIN
var/mongoose/html/img/channels/Channel 5 +1.png
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
1
var/mongoose/html/img/channels/Channel 5+1.png
Symbolic link
@@ -0,0 +1 @@
|
||||
Channel 5 +1.png
|
||||
1
var/mongoose/html/img/channels/Sports.png
Symbolic link
@@ -0,0 +1 @@
|
||||
blank.png
|
||||
1
var/mongoose/html/img/channels/TOPUP Anytime5.png
Symbolic link
@@ -0,0 +1 @@
|
||||
blank.png
|
||||
1
var/mongoose/html/img/channels/TOPUP Anytime6.png
Symbolic link
@@ -0,0 +1 @@
|
||||
blank.png
|
||||
@@ -1 +0,0 @@
|
||||
blank.png
|
||||
|
Before Width: | Height: | Size: 9 B After Width: | Height: | Size: 8.6 KiB |
BIN
var/mongoose/html/img/channels/The Jewellery Channel.png
Normal file
|
Before Width: | Height: | Size: 9 B After Width: | Height: | Size: 8.6 KiB |
BIN
var/mongoose/html/img/channels/The Zone.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
var/mongoose/html/img/flat-tyre.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
var/mongoose/html/img/pad.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
var/mongoose/html/img/sort_date.gif
Normal file
|
After Width: | Height: | Size: 609 B |
BIN
var/mongoose/html/img/sort_name.gif
Normal file
|
After Width: | Height: | Size: 384 B |
BIN
var/mongoose/html/img/tsort/bgplain.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
70
var/mongoose/html/js/touchbridge.js
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Content-Type:text/javascript
|
||||
*
|
||||
* A bridge between iPad and iPhone touch events and jquery draggable,
|
||||
* sortable etc. mouse interactions.
|
||||
* @author Oleg Slobodskoi
|
||||
*
|
||||
* modified by John Hardy to use with any touch device
|
||||
* fixed breakage caused by jquery.ui so that mouseHandled internal flag is reset
|
||||
* before each touchStart event
|
||||
*
|
||||
*/
|
||||
(function( $ ) {
|
||||
|
||||
$.support.touch = typeof Touch === 'object';
|
||||
|
||||
if (!$.support.touch) {
|
||||
return;
|
||||
}
|
||||
|
||||
var proto = $.ui.mouse.prototype,
|
||||
_mouseInit = proto._mouseInit;
|
||||
|
||||
$.extend( proto, {
|
||||
_mouseInit: function() {
|
||||
this.element
|
||||
.bind( "touchstart." + this.widgetName, $.proxy( this, "_touchStart" ) );
|
||||
_mouseInit.apply( this, arguments );
|
||||
},
|
||||
|
||||
_touchStart: function( event ) {
|
||||
if ( event.originalEvent.targetTouches.length != 1 ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.element
|
||||
.bind( "touchmove." + this.widgetName, $.proxy( this, "_touchMove" ) )
|
||||
.bind( "touchend." + this.widgetName, $.proxy( this, "_touchEnd" ) );
|
||||
|
||||
this._modifyEvent( event );
|
||||
|
||||
$( document ).trigger($.Event("mouseup")); //reset mouseHandled flag in ui.mouse
|
||||
this._mouseDown( event );
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
_touchMove: function( event ) {
|
||||
this._modifyEvent( event );
|
||||
this._mouseMove( event );
|
||||
},
|
||||
|
||||
_touchEnd: function( event ) {
|
||||
this.element
|
||||
.unbind( "touchmove." + this.widgetName )
|
||||
.unbind( "touchend." + this.widgetName );
|
||||
this._mouseUp( event );
|
||||
},
|
||||
|
||||
_modifyEvent: function( event ) {
|
||||
event.which = 1;
|
||||
var target = event.originalEvent.targetTouches[0];
|
||||
event.pageX = target.clientX;
|
||||
event.pageY = target.clientY;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
})( jQuery );
|
||||
|
||||
@@ -38,6 +38,8 @@ $(document).ready(function() {
|
||||
7: { sorter: false }
|
||||
}
|
||||
});
|
||||
$('table.tablesorter thead th').filter('[class!=header]')
|
||||
.addClass('headerplain');
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
@@ -133,10 +135,21 @@ proc eventrow {event {table TBL_RESERVATION}} {
|
||||
}
|
||||
|
||||
if {$rsvicon ne ""} {
|
||||
set rsvicon "<img src='/images/$rsvicon' height=20>
|
||||
set rsvicon "<img src='/images/$rsvicon' height=20>"
|
||||
if {[$event get ersvtype] == 3} {
|
||||
if {[$event padded]} {
|
||||
set padding "<- [expr [$event get ulPreOffset] / 60], [expr [$event get ulPostOffset] / 60] ->"
|
||||
append rsvicon \
|
||||
"<img src=/img/pad.png height=20
|
||||
title=\"$padding\" alt=\"$padding\">"
|
||||
} else {
|
||||
append rsvicon \
|
||||
"<img src=/img/ar.png height=20>"
|
||||
}
|
||||
}
|
||||
}
|
||||
if {$RKIcon ne ""} {
|
||||
set RKIcon "<img src='/images/$RKIcon' height=20>
|
||||
set RKIcon "<img src='/images/$RKIcon' height=20>"
|
||||
}
|
||||
|
||||
if {$table eq "pending"} {
|
||||
@@ -196,14 +209,13 @@ proc eventrow {event {table TBL_RESERVATION}} {
|
||||
puts "[clock format [$event get nduration] -format %T]</td>"
|
||||
}
|
||||
|
||||
puts "<td nowrap>$rsvicon $RKIcon</td>"
|
||||
puts "<td nowrap>$rsvicon $RKIcon</td><td>"
|
||||
if {[$event get aulEventToRecordInfo] != ""} {
|
||||
puts "<td><img src=/img/lightning.png
|
||||
puts "<img src=/img/lightning.png
|
||||
alt=\"Accepted by Humax\"
|
||||
title=\"Accepted by Humax\"></td>"
|
||||
} else {
|
||||
puts "<td> </td>"
|
||||
title=\"Accepted by Humax\">"
|
||||
}
|
||||
puts "</td>";
|
||||
puts "</tr>"
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
if {[expr ! [exists -proc cat ]]} {
|
||||
proc cat {file} {
|
||||
if {[catch {set fp [open $file r]]}} { return }
|
||||
if {[catch {set fp [open $file r}]} { return }
|
||||
puts [read $fp]
|
||||
close $fp
|
||||
}
|
||||
|
||||
9
var/mongoose/lib/classdump
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
if {[expr ! [exists -proc classdump]]} {
|
||||
proc classdump {o} {
|
||||
foreach var [$o vars] {
|
||||
puts [format {%20s %s} $var [$o get $var]]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
8
var/mongoose/lib/escape
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
if {[expr ! [exists -proc escape]]} {
|
||||
proc escape {str} {
|
||||
regsub -all -- {"} "$str" "\\\"" str
|
||||
return $str
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
source /mod/var/mongoose/lib/setup
|
||||
|
||||
if {![exists -proc class ]} { package require oo }
|
||||
if {![exists -proc sqlite3.open ]} { package require sqlite3 }
|
||||
if {![exists -proc class]} { package require oo }
|
||||
if {![exists -proc sqlite3.open]} { package require sqlite3 }
|
||||
require settings.class system.class
|
||||
|
||||
set rsvdb [sqlite3.open /var/lib/humaxtv/rsv.db]
|
||||
@@ -54,6 +54,17 @@ class rsv {
|
||||
action 0
|
||||
}
|
||||
|
||||
rsv method aul {} {
|
||||
if {![exists -proc binary]} { package require binary }
|
||||
set aul {}
|
||||
for {set i 0} {$i < [string length $aulEventToRecordInfo]} {incr i 16} {
|
||||
binary scan [string range $aulEventToRecordInfo $i $($i + 15)] \
|
||||
iiii service start end event_id
|
||||
lappend aul [list $service $start $end $event_id]
|
||||
}
|
||||
return $aul
|
||||
}
|
||||
|
||||
rsv method clear_ulslot {} {
|
||||
set ulslot -1
|
||||
}
|
||||
@@ -125,6 +136,16 @@ rsv method set_delete {} {
|
||||
set action 1
|
||||
}
|
||||
|
||||
rsv method set_unpad {} {
|
||||
set action 2
|
||||
}
|
||||
|
||||
rsv method set_pad {{pre 60} {post 60}} {
|
||||
set action 3
|
||||
set ulPreOffset $pre
|
||||
set ulPostOffset $post
|
||||
}
|
||||
|
||||
rsv method remove_pending {} {
|
||||
$::rsvdb query "delete from pending where ulslot = $ulslot"
|
||||
}
|
||||
@@ -338,6 +359,11 @@ proc {rsv construct} {event type} {
|
||||
|
||||
set ccrid [$event get channel_crid]
|
||||
|
||||
# Fallback from series to event if there is no series CRID.
|
||||
if {$type == 2 && [$event get series_crid] eq ""} {
|
||||
set type 1
|
||||
}
|
||||
|
||||
if {$type == 1} {
|
||||
# Event
|
||||
set args(ucCRIDType) 49
|
||||
|
||||
@@ -116,6 +116,10 @@ settings method pkgdev {{val -1}} {
|
||||
return [$self _nval_setting pkgdev $val]
|
||||
}
|
||||
|
||||
settings method sortorder {{val -1}} {
|
||||
return [$self _nval_setting sortorder $val]
|
||||
}
|
||||
|
||||
settings method channel_groups {} {
|
||||
set ret ""
|
||||
set db [sqlite3.open /var/lib/humaxtv/setup.db]
|
||||
|
||||