Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7025cf09f5 | ||
|
|
32db0c900b | ||
|
|
d7dcb79dad | ||
|
|
04453c1815 | ||
|
|
3bc9f5217b | ||
|
|
8d67bb82bb | ||
|
|
9faac3c8fe | ||
|
|
0c858b3410 | ||
|
|
1cd0f96bf4 | ||
|
|
8e839121de | ||
|
|
7400437a1f | ||
|
|
26e90143bf | ||
|
|
884e17b3a7 | ||
|
|
7202b7e4f8 | ||
|
|
087532136c | ||
|
|
700306b3a8 |
1
CONTROL/conffiles
Normal file
1
CONTROL/conffiles
Normal file
@@ -0,0 +1 @@
|
||||
etc/webif.db
|
||||
@@ -1,10 +1,11 @@
|
||||
Package: webif
|
||||
Priority: optional
|
||||
Section: web
|
||||
Version: 0.5.1
|
||||
Version: 0.5.6
|
||||
Architecture: mipsel
|
||||
Maintainer: af123@hummypkg.org.uk
|
||||
Depends: mongoose(>=2.11-4),jim-sqlite3,jim-cgi,service-control,busybox,lsof,jim-oo,epg(>=1.0.2)
|
||||
Depends: mongoose(>=2.11-5),jim(>=0.71-1),jim-sqlite3(>=0.71-1),jim-cgi(>=0.2),jim-oo,service-control,busybox(>=1.18.3-1),lsof,epg(>=1.0.2),hmt(>=1.0.6),ssmtp
|
||||
Replaces: af123-webif
|
||||
Conflicts: af123-webif
|
||||
Suggests: ffmpeg
|
||||
Description: A web interface for the Humax. In development.
|
||||
|
||||
BIN
etc/webif.db
Normal file
BIN
etc/webif.db
Normal file
Binary file not shown.
@@ -2,72 +2,31 @@
|
||||
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/ts.class
|
||||
source /mod/var/mongoose/lib/pretty_size
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
|
||||
set ignore {nts thm hmt hmi}
|
||||
set standard {avi mpg wmv mkv}
|
||||
set ignore {.nts .thm .hmt .hmi}
|
||||
set include {.ts .avi .mpg .wmv .mkv}
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
#set _cgi(tsfile) "/media/My Video/Family Guy/2.19._Excellence_in_Broadcasting.ts"
|
||||
#set _cgi(action) "lock"
|
||||
#set env(REQUEST_URI) ''
|
||||
|
||||
proc tsfile {file bfile} {{i 0}} {
|
||||
set ts [ts fetch $file]
|
||||
puts "
|
||||
<div class=\"va tsfile\" id=[incr i]>
|
||||
<a class=ts file=\"$file\" href=#>
|
||||
<img class=va border=0 width=45
|
||||
src=/images/741_1_10_Video_Title.png>
|
||||
$bfile
|
||||
</a>
|
||||
"
|
||||
if {[$ts get definition] eq "HD"} {
|
||||
puts "<img class=va src=/images/172_1_00_HD.png height=21>"
|
||||
} else {
|
||||
puts "<img class=va src=/images/172_1_26_SD.png height=21>"
|
||||
}
|
||||
if {[$ts flag "Locked"] > 0} {
|
||||
puts "<img class=va src=/images/178_1_00_Icon_Lock.png
|
||||
height=21>"
|
||||
|
||||
}
|
||||
|
||||
puts "
|
||||
<a class=tsopt file=\"$file\" href=#>
|
||||
<img class=\"opt va\" border=0 width=45 did=$i
|
||||
src=/images/181_1_00_Help5_OPT_Plus.png>
|
||||
</a>
|
||||
<div class=\"results blood\" style=\"margin: 0 0 0 5em\"></div>
|
||||
</div>
|
||||
"
|
||||
}
|
||||
|
||||
proc genfile {file bfile} {
|
||||
puts "
|
||||
<div class=va>
|
||||
<a href=#>
|
||||
<img class=va border=0 width=45 style=\"padding: 0.3em 0\"
|
||||
src=/images/743_4_10_Video_Xvid_File.png>
|
||||
$bfile
|
||||
</a>
|
||||
</div>
|
||||
"
|
||||
}
|
||||
#set _cgi(dir) "/media/My Video/Chuggington"
|
||||
|
||||
proc directory {file bfile} {
|
||||
puts "<div class=va>"
|
||||
puts "<a href=$::env(REQUEST_URI)?dir=[cgi_quote_url $file]>"
|
||||
puts "<img border=0 class=va src=/images/711_1_09_Media_Folder.png>"
|
||||
puts "$bfile</a></div>"
|
||||
regsub -all " +" $bfile "" tbfile
|
||||
puts "$bfile</a><span class=filesize id=\"$tbfile\">
|
||||
</span></div>"
|
||||
}
|
||||
|
||||
proc entry {file} {
|
||||
set bfile [lindex [split $file /] end]
|
||||
proc entry {file} {{i 0}} {
|
||||
set bfile [file tail $file]
|
||||
if {[string index $bfile 0] == "\025"} {
|
||||
set bfile [string range $bfile 1 end]
|
||||
}
|
||||
@@ -75,95 +34,114 @@ proc entry {file} {
|
||||
directory $file $bfile
|
||||
continue
|
||||
}
|
||||
regexp -- {\.([^.]+)$} "$file" allmatch ext
|
||||
if {$ext eq "ts"} {
|
||||
tsfile $file $bfile
|
||||
continue
|
||||
}
|
||||
if {$ext in $::ignore} { continue }
|
||||
if {$ext in $::standard} {
|
||||
genfile $file $bfile
|
||||
continue
|
||||
}
|
||||
}
|
||||
set ext [file extension $file]
|
||||
if {$ext in $::ignore || $ext ni $::include} { continue }
|
||||
|
||||
if {[dict exists $_cgi tsfile]} {
|
||||
set file [dict get $_cgi tsfile]
|
||||
set ts [ts fetch $file]
|
||||
file stat $file st
|
||||
set sz [pretty_size $st(size)]
|
||||
|
||||
if {[dict exists $_cgi action]} {
|
||||
switch [dict get $_cgi action] {
|
||||
entry {
|
||||
entry $file
|
||||
}
|
||||
delete {
|
||||
if {[$ts delete]} {
|
||||
puts "Successfully deleted $file."
|
||||
} else {
|
||||
puts "Problem deleting $file, [$ts get error]"
|
||||
}
|
||||
}
|
||||
lock {
|
||||
set action lock
|
||||
if {[$ts flag "Locked"]} { set action unlock }
|
||||
if {[$ts $action]} {
|
||||
puts "Successfully [set action]ed $file."
|
||||
} else {
|
||||
puts "Problem [set action]ing $file,
|
||||
[$ts get error]"
|
||||
}
|
||||
}
|
||||
}
|
||||
exit
|
||||
set base [file rootname $file]
|
||||
|
||||
if {$ext eq ".ts" && [file exists "${base}.nts"]} {
|
||||
set type ts
|
||||
set ts [ts fetch $file 1]
|
||||
set img 741_1_10_Video_Title.png
|
||||
set pad 0
|
||||
set newpad "top: -6; left: 4;"
|
||||
} else {
|
||||
set type gen
|
||||
set ts 0
|
||||
set img 743_4_10_Video_Xvid_File.png
|
||||
set pad "2"
|
||||
set newpad "top: -2; left: 2;"
|
||||
}
|
||||
|
||||
source /mod/var/mongoose/lib/epg.class
|
||||
|
||||
puts "
|
||||
<table class=keyval>
|
||||
<tr>
|
||||
<th>Title</th>
|
||||
<td>[$ts get title]</td>
|
||||
</tr><tr>
|
||||
<th>Synopsis</th>
|
||||
<td>[$ts get synopsis]</td>
|
||||
</tr><tr>
|
||||
<th>Definition</th>
|
||||
<td>
|
||||
<div class=\"va bf\" id=[incr i]>
|
||||
<a class=bf file=\"$file\" type=$type href=#>
|
||||
"
|
||||
if {[$ts get definition] eq "HD"} {
|
||||
puts "<img class=va src=/images/172_1_00_HD.png height=21>"
|
||||
|
||||
set new 0
|
||||
if {$type eq "ts"} {
|
||||
if {[$ts flag "New"] > 0} { set new 1 }
|
||||
} else {
|
||||
puts "<img class=va src=/images/172_1_26_SD.png height=21>"
|
||||
if {![file exists "[file rootname $file].hmi"]} { set new 1 }
|
||||
}
|
||||
puts "</td>
|
||||
</tr><tr>
|
||||
<th>Channel</th>
|
||||
<td>[epg channelicon [$ts get channel_name] 50 "vertical-align: middle"]
|
||||
[$ts get channel_num] - [$ts get channel_name]</td>
|
||||
</tr><tr>
|
||||
<th>Start Time</th>
|
||||
<td>"
|
||||
puts [clock format [$ts get start] -format "%c %Z"]
|
||||
puts "</td>
|
||||
</tr><tr>
|
||||
<th>End Time</th>
|
||||
<td>"
|
||||
puts [clock format [$ts get end] -format "%c %Z"]
|
||||
puts "</td>
|
||||
</tr><tr>
|
||||
<th>Duration</th>
|
||||
<td>[$ts duration] minute(s).</td>
|
||||
</tr><tr>
|
||||
<th>Size</th>
|
||||
<td>[$ts size] MiB</td>
|
||||
</tr><tr>
|
||||
<th>Flags</th>
|
||||
<td>[$ts get flags]</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
if {$new} {
|
||||
# Overlay the new image over the media one.
|
||||
puts "
|
||||
<span style=\"position: relative; left: 0; top 0;
|
||||
padding: $pad\">
|
||||
<img class=va border=0 width=45 src=/images/$img
|
||||
style=\"padding: $pad;
|
||||
position: relative; top: 0; left: 0\">
|
||||
<img class=va border=0
|
||||
src=/images/743_1_10_Video_New.png
|
||||
style=\"position: absolute; $newpad
|
||||
width: 18\">
|
||||
</span>
|
||||
"
|
||||
} else {
|
||||
puts "
|
||||
<img class=va border=0 width=45 src=/images/$img
|
||||
style=\"padding:$pad\">
|
||||
"
|
||||
}
|
||||
|
||||
puts "
|
||||
$bfile
|
||||
</a>
|
||||
"
|
||||
exit
|
||||
|
||||
# Size
|
||||
puts "<span class=filesize> ($sz) </span>"
|
||||
|
||||
# Icons
|
||||
|
||||
set locked 0
|
||||
if {$type eq "ts"} {
|
||||
# HD / SD
|
||||
if {[$ts get definition] eq "HD"} {
|
||||
set img "172_1_00_HD"
|
||||
} else {
|
||||
set img "172_1_26_SD"
|
||||
}
|
||||
puts "<img class=va src=/images/$img.png height=21>"
|
||||
|
||||
# Locked
|
||||
if {[$ts flag "Locked"] > 0} {
|
||||
set locked 1
|
||||
puts "<img class=va src=/images/178_1_00_Icon_Lock.png
|
||||
height=21>"
|
||||
}
|
||||
|
||||
# Encrypted
|
||||
if {[$ts flag "Encrypted"] > 0} {
|
||||
puts "<img class=va
|
||||
src=/images/749_1_26_Video_Encryption.png
|
||||
height=21>"
|
||||
}
|
||||
|
||||
# Guidance
|
||||
if {[$ts flag "Guidance"] > 0} {
|
||||
puts "<img class=va
|
||||
src=/images/174_1_26_GuidancePolicy.png
|
||||
height=21>"
|
||||
}
|
||||
}
|
||||
|
||||
# Opt+ button
|
||||
|
||||
puts "
|
||||
<a href=#>
|
||||
<img class=\"opt va\" border=0 width=45 type=$type did=$i
|
||||
locked=$locked
|
||||
src=/images/181_1_00_Help5_OPT_Plus.png>
|
||||
</a>
|
||||
<div class=\"results blood\" style=\"margin: 0 0 0 5em\"></div>
|
||||
"
|
||||
puts "</div>"
|
||||
}
|
||||
|
||||
if {[dict exists $_cgi dir]} {
|
||||
@@ -172,139 +150,80 @@ if {[dict exists $_cgi dir]} {
|
||||
set dir "/media/My Video"
|
||||
}
|
||||
|
||||
######################################################################
|
||||
# Render web page
|
||||
|
||||
source /mod/var/mongoose/html/lib/header.jim
|
||||
|
||||
puts {
|
||||
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.contextMenu.css rel=stylesheet type=text/css />
|
||||
<script type="text/javascript" src="/js/jquery.contextMenu.js"></script>
|
||||
<ul id=optmenu class=contextMenu>
|
||||
<li><a href=#delete>Delete</a></li>
|
||||
<li><a href=#lock>Toggle Lock</a></li>
|
||||
<li><a href=#rename>Rename</a></li>
|
||||
<li><a href=#download>Download</a></li>
|
||||
</ul>
|
||||
|
||||
<ul id=optmenu class=contextMenu>
|
||||
<li><a href=#delete>Delete</a></li>
|
||||
<li><a href=#lock>Toggle Lock</a></li>
|
||||
<li><a href=#rename>Rename</a></li>
|
||||
<li><a href=#title>Change Title</a></li>
|
||||
</ul>
|
||||
<div id=renameform title="Rename media file" style="display: none">
|
||||
<form id=renameform_form>
|
||||
<input type=hidden name="renameorig" id="renameorig" value="">
|
||||
<input type=hidden name="titleorig" id="titleorig" value="">
|
||||
<table border=0>
|
||||
<tr>
|
||||
<th>
|
||||
<label for="rename">
|
||||
<b>New Filename</b>
|
||||
</label>
|
||||
</th>
|
||||
<td>
|
||||
<input type=text name="rename" id="rename"
|
||||
value="" size=70 maxlength=255
|
||||
class="text ui-widget-content ui-corner-all">
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="display: none" class=tstype>
|
||||
<th>
|
||||
<label for="renametitle" style="padding-top: 0.5em">
|
||||
<b>New EPG Title</b>
|
||||
</label>
|
||||
</th>
|
||||
<td>
|
||||
<input type=text name="renametitle" id="renametitle"
|
||||
value="" size=70 maxlength=48
|
||||
class="text ui-widget-content ui-corner-all">
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="display: none" class=tstype>
|
||||
<td colspan=2 id=synopsis style="font-style: italic"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div id=dialogue></div>
|
||||
<div id=confirm title="Confirmation Required"></div>
|
||||
<div id=dialogue></div>
|
||||
<div id=confirm title="Confirmation Required"></div>
|
||||
|
||||
<script type=text/javascript>
|
||||
|
||||
var $confirm = $('#confirm').dialog({
|
||||
modal: true, autoOpen: false,
|
||||
height: 160, width: 500,
|
||||
show: 'fade', hide: 'fade',
|
||||
draggable: false, resizable: false
|
||||
});
|
||||
|
||||
var confirm_action = function(action, callback, ts, id) {
|
||||
var bts = ts.replace(/.*\/|\.[^.]*$/g, '');
|
||||
$confirm.dialog('option', 'buttons', {
|
||||
'Yes': function() { $(this).dialog('close');
|
||||
callback(ts, id); },
|
||||
'No': function() {$(this).dialog('close');}
|
||||
|
||||
});
|
||||
$('#confirm').empty().html(
|
||||
'Are you sure you wish to ' + action + '<br>' +
|
||||
'<i>' + bts + '</i> ?'
|
||||
);
|
||||
$confirm.dialog('open');
|
||||
}
|
||||
|
||||
var delete_callback = function(ts, id) {
|
||||
var el = 'div.tsfile#' + id;
|
||||
var results = el + ' .results';
|
||||
var url = window.location.pathname + '?tsfile=' +
|
||||
encodeURIComponent(ts) + '&action=delete';
|
||||
$(results).load(url, function() {
|
||||
$(el).delay(3000).slideUp(300, function() {
|
||||
$(el).remove();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
var lock_callback = function(ts, id) {
|
||||
var el = 'div.tsfile#' + id;
|
||||
var results = el + ' .results';
|
||||
var url = window.location.pathname + '?tsfile=' +
|
||||
encodeURIComponent(ts) + '&action=';
|
||||
|
||||
$(results).load(url + 'lock', function() {
|
||||
$(results).delay(3000).slideUp(150,
|
||||
function() {
|
||||
$(el).load(url + 'entry');
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
// Dialogue init
|
||||
var $dialog = $('#dialogue').dialog({
|
||||
title: "Recording Details",
|
||||
modal: false, autoOpen: false,
|
||||
height: 600, width: 700,
|
||||
show: 'scale', hide: 'fade',
|
||||
draggable: true, resizable: true,
|
||||
buttons: { "Close":
|
||||
function() {$(this).dialog('close');}},
|
||||
close: function(e,u) { $('#dialogue').empty().html(
|
||||
'<img src="/img/loading.gif" alt="loading">'); }
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('a.ts').click(function(e) {
|
||||
e.preventDefault();
|
||||
var file = $(this).attr('file');
|
||||
var url = window.location.pathname + '?tsfile=' +
|
||||
encodeURIComponent(file);
|
||||
$('#dialogue').load(url);
|
||||
$dialog.dialog('open');
|
||||
});
|
||||
|
||||
$('img.opt').contextMenu(
|
||||
{
|
||||
menu: 'optmenu',
|
||||
leftButton: true,
|
||||
},
|
||||
function (action, el, pos)
|
||||
{
|
||||
var ts = $(el).parent().prevAll('a.ts').last().attr('file');
|
||||
var did = $(el).attr('did');
|
||||
switch (action)
|
||||
{
|
||||
case 'delete':
|
||||
confirm_action('delete', delete_callback, ts, did);
|
||||
break;
|
||||
|
||||
case 'lock':
|
||||
confirm_action('change the lock on', lock_callback, ts, did);
|
||||
break;
|
||||
|
||||
default:
|
||||
alert('Unhandled action: ' + action);
|
||||
break;
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
</script>
|
||||
<script type=text/javascript src=/cgi-bin/browse/browse.js></script>
|
||||
}
|
||||
|
||||
puts { <div style="border: 1px solid grey; padding: 1em"> }
|
||||
puts "<span style=\"display:none\" id=dir>$dir</span>"
|
||||
|
||||
# Breadcrumb path
|
||||
puts "<h1>"
|
||||
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" }
|
||||
append stub $name
|
||||
puts "<a href=$env(REQUEST_URI)?dir=[cgi_quote_url $stub]>$name</a>
|
||||
}
|
||||
puts "</h1>"
|
||||
puts "</legend>"
|
||||
|
||||
# Parent directory
|
||||
set parent [join [lrange [split $dir /] 0 end-1] /]
|
||||
if {$parent ne ""} {
|
||||
puts "
|
||||
@@ -316,13 +235,14 @@ if {$parent ne ""} {
|
||||
"
|
||||
}
|
||||
|
||||
# Strip double slashes
|
||||
regsub -all -- {\/+} "$dir/*" "/" dir
|
||||
|
||||
foreach file [lsort [glob -nocomplain "$dir"]] {
|
||||
entry $file
|
||||
}
|
||||
|
||||
puts "</div>"
|
||||
puts "</fieldset>"
|
||||
|
||||
source /mod/var/mongoose/html/lib/footer.jim
|
||||
|
||||
|
||||
217
var/mongoose/cgi-bin/browse/browse.js
Executable file
217
var/mongoose/cgi-bin/browse/browse.js
Executable file
@@ -0,0 +1,217 @@
|
||||
|
||||
function epginfo_callback(data, status, xhr)
|
||||
{
|
||||
var width = 85;
|
||||
|
||||
if (status != 'success')
|
||||
return;
|
||||
|
||||
//console.log(status);
|
||||
//console.dir(data);
|
||||
|
||||
$('#titleorig').val(data.title);
|
||||
$('#renametitle').val(data.title);
|
||||
if (data.synopsis.length > width)
|
||||
data.synopsis = data.synopsis.substring(0, width) + '...';
|
||||
$('#synopsis').html(data.synopsis);
|
||||
$('tr.tstype').show('slow');
|
||||
}
|
||||
|
||||
function insert_folder_size(folder, size)
|
||||
{
|
||||
folder = folder.replace(/ /g, '');
|
||||
//console.log("Folder: (%s) = (%s)", folder, size);
|
||||
$('#' + folder).text(' (' + size + 'iB)');
|
||||
}
|
||||
|
||||
function folder_size_callback(data, status, xhr)
|
||||
{
|
||||
//console.log("Status: %s", status);
|
||||
$.each(data, insert_folder_size);
|
||||
}
|
||||
|
||||
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).load(url, function() {
|
||||
$(el).delay(3000).slideUp(300, function() {
|
||||
$(el).remove();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function lock_callback(file, type, id)
|
||||
{
|
||||
var url = '/cgi-bin/browse/lock.jim?file=' + encodeURIComponent(file);
|
||||
$.get(url, function() { window.location.reload(true); });
|
||||
}
|
||||
|
||||
function rename_submit()
|
||||
{
|
||||
var s = $('#renameform_form').serialize();
|
||||
$.get('/cgi-bin/browse/rename.jim?' + s,
|
||||
function() { window.location.reload(true); });
|
||||
}
|
||||
|
||||
var $confirm; // Populated after DOM is loaded.
|
||||
|
||||
function confirm_action(action, callback, file, type, id)
|
||||
{
|
||||
var bfile = file.replace(/.*\/|\.[^.]*$/g, '');
|
||||
$confirm.dialog('option', 'buttons', {
|
||||
'Yes': function() { $(this).dialog('close');
|
||||
callback(file, type, id); },
|
||||
'No': function() {$(this).dialog('close');}
|
||||
|
||||
});
|
||||
$('#confirm').empty().html(
|
||||
'Are you sure you wish to ' + action + '<br>' +
|
||||
'<i>' + bfile + '</i> ?'
|
||||
);
|
||||
$confirm.dialog('open');
|
||||
}
|
||||
|
||||
function preparemenu(el, menu)
|
||||
{
|
||||
if (el.attr('type') == 'ts')
|
||||
{
|
||||
$('#optmenu').enableContextMenuItems('#lock');
|
||||
if (el.attr('locked') == 1)
|
||||
{
|
||||
$(menu).changeContextMenuItem('#lock', 'Unlock');
|
||||
$('#optmenu').disableContextMenuItems('#delete');
|
||||
}
|
||||
else
|
||||
{
|
||||
$(menu).changeContextMenuItem('#lock', 'Lock');
|
||||
$('#optmenu').enableContextMenuItems('#delete');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#optmenu').enableContextMenuItems('#delete');
|
||||
$('#optmenu').disableContextMenuItems('#lock');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var menuclick = function(action, el, pos)
|
||||
{
|
||||
var file = $(el).parent().prevAll('a.bf').last().attr('file');
|
||||
var bfile = file.replace(/.*\/|\.[^.]*$/g, '');
|
||||
bfile = bfile.replace(/[\x00-\x1f]+/g, '');
|
||||
var type = $(el).attr('type');
|
||||
var id = $(el).attr('did');
|
||||
switch (action)
|
||||
{
|
||||
case 'delete':
|
||||
confirm_action('delete', delete_callback, file,
|
||||
type, id);
|
||||
break;
|
||||
|
||||
case 'lock':
|
||||
confirm_action('change the lock on', lock_callback,
|
||||
file, type, id);
|
||||
break;
|
||||
|
||||
case 'rename':
|
||||
$('#rename').val(bfile);
|
||||
$('#renameorig').val(file);
|
||||
|
||||
$('#titleorig').val('');
|
||||
$('#renametitle').val('');
|
||||
$('#synopsis').val('');
|
||||
$('tr.tstype').css('display', 'none');
|
||||
|
||||
if (type == 'ts')
|
||||
{
|
||||
$.getJSON('/cgi-bin/browse/epgtitle.jim?file=' +
|
||||
encodeURIComponent(file), epginfo_callback);
|
||||
}
|
||||
|
||||
$('#renameform').dialog('open');
|
||||
break;
|
||||
|
||||
case 'download':
|
||||
window.location.href = file;
|
||||
break;
|
||||
|
||||
default:
|
||||
alert('Unhandled action: ' + action);
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
// Bind context menu to opt+ image
|
||||
$('img.opt').contextMenu(
|
||||
{
|
||||
menu: 'optmenu',
|
||||
leftButton: true,
|
||||
beforeShow: preparemenu
|
||||
},
|
||||
menuclick
|
||||
);
|
||||
|
||||
// Disable items which are not yet implemented.
|
||||
$('#optmenu').disableContextMenuItems('#title');
|
||||
|
||||
// Create reusable dialogue.
|
||||
var $dialog = $('#dialogue').dialog({
|
||||
title: "Media Details",
|
||||
modal: false, autoOpen: false,
|
||||
height: 600, width: 700,
|
||||
show: 'scale', hide: 'fade',
|
||||
draggable: true, resizable: true,
|
||||
buttons: {
|
||||
"Close": function() {
|
||||
$(this).dialog('close');
|
||||
}
|
||||
},
|
||||
close: function(e,u) { $('#dialogue').empty().html(
|
||||
'<img src="/img/loading.gif" alt="loading">'); }
|
||||
});
|
||||
|
||||
// Bind dialogue open to filenames.
|
||||
$('a.bf').click(function(e) {
|
||||
e.preventDefault();
|
||||
var file = $(this).attr('file');
|
||||
var type = $(this).attr('type');
|
||||
var url = '/cgi-bin/browse/file.jim?file=' +
|
||||
encodeURIComponent(file) + '&type=' + type;
|
||||
$('#dialogue').load(url);
|
||||
$dialog.dialog('open');
|
||||
});
|
||||
|
||||
$('#renameform').dialog({
|
||||
autoOpen: false,
|
||||
height: 'auto', width: 'auto',
|
||||
modal: true,
|
||||
buttons: {
|
||||
"Update": rename_submit,
|
||||
"Close": function() {
|
||||
$(this).dialog('close');
|
||||
}
|
||||
},
|
||||
close: function() { $('#rename').val(''); }
|
||||
});
|
||||
|
||||
// Create re-usable confirmation dialogue.
|
||||
$confirm = $('#confirm').dialog({
|
||||
modal: true, autoOpen: false,
|
||||
height: 160, width: 500,
|
||||
show: 'fade', hide: 'fade',
|
||||
draggable: false, resizable: false
|
||||
});
|
||||
|
||||
var dir = $('#dir').text();
|
||||
|
||||
// Load folder sizes
|
||||
$.getJSON('/cgi-bin/browse/sizes.jim?dir=' + encodeURIComponent(dir),
|
||||
folder_size_callback);
|
||||
});
|
||||
|
||||
27
var/mongoose/cgi-bin/browse/delete.jim
Executable file
27
var/mongoose/cgi-bin/browse/delete.jim
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/ts.class
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
set file [dict get $_cgi file]
|
||||
set type [dict get $_cgi type]
|
||||
|
||||
if {$type eq "ts"} {
|
||||
set ts [ts fetch $file]
|
||||
if {[$ts delete]} {
|
||||
puts "Successfully deleted $file."
|
||||
} else {
|
||||
puts "Problem deleting $file, [$ts get error]"
|
||||
}
|
||||
exit
|
||||
}
|
||||
|
||||
file delete $file
|
||||
puts "Successfully deleted $file."
|
||||
|
||||
22
var/mongoose/cgi-bin/browse/epgtitle.jim
Executable file
22
var/mongoose/cgi-bin/browse/epgtitle.jim
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/ts.class
|
||||
|
||||
puts "Content-Type: application/json"
|
||||
puts ""
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
#set _cgi(file) "/media/My Video/Doctor Who/6.13._The_Almost_People.ts"
|
||||
|
||||
if {![dict exists $_cgi file]} { exit }
|
||||
|
||||
set file [dict get $_cgi file]
|
||||
set ts [ts fetch $file]
|
||||
|
||||
puts "{"
|
||||
puts "\"title\" : \"[$ts get title]\","
|
||||
puts "\"synopsis\" : \"[$ts get synopsis]\""
|
||||
puts "}"
|
||||
|
||||
17
var/mongoose/cgi-bin/browse/ffmpeg.jim
Executable file
17
var/mongoose/cgi-bin/browse/ffmpeg.jim
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
if [file exists /mod/bin/ffmpeg] {
|
||||
set file [dict get $_cgi file]
|
||||
puts [exec /mod/var/mongoose/lib/ffmpeg -i $file]
|
||||
} else {
|
||||
puts "Install ffmpeg package for more information..."
|
||||
}
|
||||
|
||||
115
var/mongoose/cgi-bin/browse/file.jim
Executable file
115
var/mongoose/cgi-bin/browse/file.jim
Executable file
@@ -0,0 +1,115 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/pretty_size
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
#set _cgi(file) "/media/My Video/Dangermouse/Series 1/01_rogue_robots.avi"
|
||||
|
||||
if {![dict exists $_cgi file]} { exit }
|
||||
|
||||
set file [dict get $_cgi file]
|
||||
set type [dict get $_cgi type]
|
||||
|
||||
file stat $file st
|
||||
set sz [pretty_size $st(size)]
|
||||
|
||||
if {$type eq "ts"} {
|
||||
source /mod/var/mongoose/lib/epg.class
|
||||
source /mod/var/mongoose/lib/ts.class
|
||||
|
||||
set ts [ts fetch $file]
|
||||
|
||||
puts "
|
||||
<table class=keyval>
|
||||
<tr>
|
||||
<th>Title</th>
|
||||
<td>[$ts get title]</td>
|
||||
</tr><tr>
|
||||
<th>Synopsis</th>
|
||||
<td>[$ts get synopsis]</td>
|
||||
</tr><tr>
|
||||
"
|
||||
|
||||
if {[$ts flag "Guidance"] > 0} {
|
||||
puts "
|
||||
<th>Guidance</th>
|
||||
<td><img class=va
|
||||
src=/images/174_1_26_GuidancePolicy.png height=21>
|
||||
[$ts get guidance]
|
||||
</td>
|
||||
</tr><tr>
|
||||
"
|
||||
}
|
||||
|
||||
puts "
|
||||
<th>Definition</th>
|
||||
<td>
|
||||
"
|
||||
if {[$ts get definition] eq "HD"} {
|
||||
puts "<img class=va src=/images/172_1_00_HD.png height=21>"
|
||||
} else {
|
||||
puts "<img class=va src=/images/172_1_26_SD.png height=21>"
|
||||
}
|
||||
puts "</td>
|
||||
</tr><tr>
|
||||
<th>Channel</th>
|
||||
<td>[epg channelicon [$ts get channel_name] 50 "vertical-align: middle"]
|
||||
[$ts get channel_num] - [$ts get channel_name]</td>
|
||||
</tr><tr>
|
||||
<th>Start Time</th>
|
||||
<td>"
|
||||
puts [clock format [$ts get start] -format "%c %Z"]
|
||||
puts "</td>
|
||||
</tr><tr>
|
||||
<th>End Time</th>
|
||||
<td>"
|
||||
puts [clock format [$ts get end] -format "%c %Z"]
|
||||
puts "</td>
|
||||
</tr><tr>
|
||||
<th>Duration</th>
|
||||
<td>[$ts duration] minute(s).</td>
|
||||
</tr><tr>
|
||||
<th>Size</th>
|
||||
<td>$sz</td>
|
||||
</tr><tr>
|
||||
<th>Flags</th>
|
||||
<td>[$ts get flags]</td>
|
||||
</tr>
|
||||
</table>
|
||||
"
|
||||
exit
|
||||
}
|
||||
|
||||
# Otherwise, for a general file.
|
||||
|
||||
puts "
|
||||
<table class=keyval>
|
||||
<tr>
|
||||
<th>File</th>
|
||||
<td>$file</td>
|
||||
</tr><tr>
|
||||
<th>Size</th>
|
||||
<td>$sz</td>
|
||||
</tr><tr>
|
||||
<th>Info</th>
|
||||
<td class=pre id=ffmpeg>
|
||||
<img src=/img/loading.gif><i>Loading...</i>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
"
|
||||
|
||||
set url "/cgi-bin/browse/ffmpeg.jim?file=[cgi_quote_url $file]"
|
||||
puts { <script type="text/javascript"> }
|
||||
puts "var url = \"$url\";"
|
||||
puts {
|
||||
$('#ffmpeg').load(url);
|
||||
</script>
|
||||
}
|
||||
|
||||
27
var/mongoose/cgi-bin/browse/lock.jim
Executable file
27
var/mongoose/cgi-bin/browse/lock.jim
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/ts.class
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
#set _cgi(file) "/media/My Video/The Walking Dead/The Walking Dead S01E06.ts"
|
||||
|
||||
set file [dict get $_cgi file]
|
||||
set ts [ts fetch $file]
|
||||
if {[set ts [ts fetch $file]] != 0} {
|
||||
set action lock
|
||||
if {[$ts flag "Locked"]} { set action unlock }
|
||||
|
||||
if {[$ts $action]} {
|
||||
puts "Successfully [set action]ed $file."
|
||||
} else {
|
||||
puts "Problem [set action]ing $file,
|
||||
[$ts get error]"
|
||||
}
|
||||
}
|
||||
|
||||
53
var/mongoose/cgi-bin/browse/rename.jim
Executable file
53
var/mongoose/cgi-bin/browse/rename.jim
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/ts.class
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
#renameorig
|
||||
#titleorig
|
||||
#rename
|
||||
#renametitle
|
||||
|
||||
#set _cgi(renameorig) "/media/My Video/The Walking Dead/The Walking Dead_20110521_2201.ts"
|
||||
#set _cgi(rename) "Last Episode"
|
||||
|
||||
if {![dict exists $_cgi renameorig]} { exit }
|
||||
|
||||
set file [dict get $_cgi renameorig]
|
||||
set newfile [dict get $_cgi rename]
|
||||
|
||||
if {[string length [string trim $newfile]] == 0 || $file eq $newfile} {
|
||||
set newfile ""
|
||||
}
|
||||
|
||||
if {[file isdirectory $file]} {
|
||||
#puts "Directory."
|
||||
if {$newfile ne ""} {
|
||||
set dir [file dirname $file]
|
||||
set newfile "${dir}/${newfile}"
|
||||
file rename $file $newfile
|
||||
}
|
||||
} elseif {[set ts [ts fetch $file]] != 0} {
|
||||
#puts "TS file."
|
||||
|
||||
catch {
|
||||
set title [dict get $_cgi renametitle]
|
||||
set titleorig [dict get $_cgi titleorig]
|
||||
|
||||
if {[string length [string trim $title]] > 0 &&
|
||||
$title ne $titleorig} {
|
||||
$ts settitle $title
|
||||
}
|
||||
}
|
||||
if {$newfile ne ""} { ts renamegroup $file $newfile }
|
||||
} else {
|
||||
#puts "Normal file."
|
||||
if {$newfile ne ""} { ts renamegroup $file $newfile }
|
||||
}
|
||||
|
||||
26
var/mongoose/cgi-bin/browse/sizes.jim
Executable file
26
var/mongoose/cgi-bin/browse/sizes.jim
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
|
||||
puts "Content-Type: application/json"
|
||||
puts ""
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
set _cgi(dir) "/media/My Video"
|
||||
|
||||
set dir [dict get $_cgi dir]
|
||||
|
||||
#9.4G /media/My Video/Archive
|
||||
#1.4G /media/My Video/CSI_ Crime Scene Investigation
|
||||
puts "{"
|
||||
foreach line [split [exec /mod/bin/busybox/du -h "$dir/"] "\n"] {
|
||||
set fields [split $line "\t"]
|
||||
set size [lindex $fields 0]
|
||||
set node [lindex [split [lindex $fields 1] '/'] end]
|
||||
puts "\"$node\" : \"$size\","
|
||||
}
|
||||
puts "\"dummy\" : \"\""
|
||||
puts "}"
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/epg.class
|
||||
source /mod/var/mongoose/lib/spinner.class
|
||||
source /mod/var/mongoose/lib/altrow
|
||||
source /mod/var/mongoose/lib/cat
|
||||
|
||||
@@ -32,13 +33,27 @@ catch { set scrid [dict get $_cgi scrid] }
|
||||
|
||||
puts "
|
||||
<form method=get action=/cgi-bin/epg_search.jim>
|
||||
Search EPG: <input name=term size=20 maxlength=255 value=\"$term\">
|
||||
<input type=checkbox name=full"
|
||||
if {[dict exists $_cgi full]} { puts " checked" }
|
||||
puts ">Search descriptions as well as titles.
|
||||
<fieldset>
|
||||
<legend>EPG Search</legend>
|
||||
<label for=term>Query</label>
|
||||
<input type=text name=term id=term size=20 maxlength=255 value=\"$term\"
|
||||
class=\"text ui-widget-content ui-corner-all\">
|
||||
<input type=submit value=Search>
|
||||
<input type=checkbox name=full id=full"
|
||||
if {[dict exists $_cgi full]} { puts -nonewline " checked" }
|
||||
puts ">
|
||||
<label for=full>Search descriptions as well as titles.</label>
|
||||
"
|
||||
|
||||
puts {
|
||||
<style type=text/css>
|
||||
.ui-button, .ui-button-text { padding: 0; font-size: 12px; }
|
||||
</style>
|
||||
<script type=text/javascript>
|
||||
$('input:submit').button();
|
||||
</script>
|
||||
}
|
||||
|
||||
set db [sqlite3.open /var/lib/humaxtv/setup.db]
|
||||
set res [$db query {
|
||||
select itemBlob from TBL_USERCONFIG
|
||||
@@ -53,7 +68,7 @@ proc cts {type img text} {
|
||||
puts {
|
||||
<br>
|
||||
<table>
|
||||
<tr><td rowspan=2>Content Type Searches</td>
|
||||
<tr><td rowspan=2 valign=top>Content Type Searches</td>
|
||||
<td>
|
||||
}
|
||||
|
||||
@@ -95,8 +110,15 @@ puts "</table>"
|
||||
|
||||
$db close
|
||||
|
||||
puts "</fieldset>"
|
||||
puts "</form>"
|
||||
|
||||
[spinner new {
|
||||
text "Loading EPG Data..."
|
||||
size "1.2em"
|
||||
style "margin: 1em;"
|
||||
}] start
|
||||
|
||||
if {$ct > 0 } {
|
||||
set records [epg fetch dump -type $ct]
|
||||
} elseif {$crid ne ""} {
|
||||
|
||||
@@ -12,10 +12,14 @@ cgi_input
|
||||
set settings [settings new]
|
||||
|
||||
set hostname [$settings hostname]
|
||||
set smtp_server [$settings smtp_server]
|
||||
set channel_group [$settings channel_group]
|
||||
|
||||
# Handle updates
|
||||
|
||||
#set _cgi(smtp_server) "fred.bob"
|
||||
#set env(REQUEST_URI) ''
|
||||
|
||||
proc _handle_update {class var old text} {
|
||||
global _cgi
|
||||
global settings
|
||||
@@ -43,12 +47,16 @@ proc handle_str_update {var old {text "Value"}} {
|
||||
}
|
||||
|
||||
handle_str_update hostname $hostname Hostname
|
||||
_handle_update ascii smtp_server $smtp_server "SMTP Server"
|
||||
handle_int_update channel_group $channel_group "Channel Group"
|
||||
|
||||
source /mod/var/mongoose/html/lib/header.jim
|
||||
puts {<script type="text/javascript" src="/js/jquery.form.js"></script>}
|
||||
|
||||
puts {
|
||||
<style type=text/css>
|
||||
.ui-button, .ui-button-text { padding: 0; font-size: 10px; }
|
||||
</style>
|
||||
<script type=text/javascript>
|
||||
$(document).ready(function () {
|
||||
$(":submit").button();
|
||||
@@ -69,12 +77,19 @@ puts {
|
||||
}
|
||||
|
||||
puts "
|
||||
<h1>Settings</h1>
|
||||
<table class=keyval>
|
||||
<fieldset style=\"display: inline\">
|
||||
<legend>
|
||||
General Settings
|
||||
</legend>
|
||||
<table>
|
||||
"
|
||||
|
||||
puts "
|
||||
<tr>
|
||||
<form id=hostname method=get action=$env(REQUEST_URI)>
|
||||
<th>Hostname</th>
|
||||
<th class=key>Hostname</th>
|
||||
<td><input name=hostname value=\"$hostname\"
|
||||
class=\"text ui-widget-content ui-corner-all\"
|
||||
length=20 maxlength=50>
|
||||
<input id=hostname_submit value=\"change\" type=submit>
|
||||
<div id=hostname_output></div>
|
||||
@@ -86,8 +101,9 @@ puts "
|
||||
puts "
|
||||
<tr>
|
||||
<form id=channel_group method=get action=$env(REQUEST_URI)>
|
||||
<th>Channel Group for EPG</th>
|
||||
<th class=key>Channel Group for EPG</th>
|
||||
<td><select id=channel_group name=channel_group
|
||||
class=\"text ui-widget-content ui-corner-all\"
|
||||
value=[$settings channel_group]>
|
||||
"
|
||||
|
||||
@@ -104,7 +120,7 @@ foreach grp [$settings channel_groups] {
|
||||
|
||||
puts "
|
||||
</select>
|
||||
<input name=channel_group value=\"change\" type=submit>
|
||||
<input name=channel_group value=\"set\" type=submit>
|
||||
<div id=channel_group_output></div>
|
||||
</td>
|
||||
</form>
|
||||
@@ -113,11 +129,31 @@ puts "
|
||||
|
||||
puts "
|
||||
</table>
|
||||
</form>
|
||||
<br>
|
||||
More coming soon...
|
||||
<br>
|
||||
<br>
|
||||
</fieldset>
|
||||
<br><br>
|
||||
<fieldset style=\"display: inline\">
|
||||
<legend> Email Settings </legend>
|
||||
<table>
|
||||
"
|
||||
|
||||
puts "
|
||||
<tr>
|
||||
<form id=smtp_server method=get action=$env(REQUEST_URI)>
|
||||
<th class=key>SMTP Server for outbound email</th>
|
||||
<td><input name=smtp_server value=\"$smtp_server\"
|
||||
class=\"text ui-widget-content ui-corner-all\"
|
||||
length=20 maxlength=50>
|
||||
<input id=smtp_server_submit value=\"change\" type=submit>
|
||||
<div id=smtp_server_output></div>
|
||||
</td>
|
||||
</form>
|
||||
</tr>
|
||||
"
|
||||
|
||||
puts "
|
||||
</table>
|
||||
</fieldset>
|
||||
"
|
||||
|
||||
source /mod/var/mongoose/html/lib/footer.jim
|
||||
|
||||
|
||||
@@ -43,9 +43,8 @@ foreach line $lines {
|
||||
|
||||
incr seen($name)
|
||||
|
||||
lappend output "<img style=\"vertical-align: middle\"
|
||||
src=/images/$icon><span
|
||||
style=\"vertical-align: middle\">$mode $name</span>"
|
||||
lappend output "<img class=va src=/images/$icon><span class=va>
|
||||
$mode $name</span><br>"
|
||||
}
|
||||
|
||||
if {[llength $output]} {
|
||||
|
||||
75
var/mongoose/html/css/iphone-style-checkboxes.css
Normal file
75
var/mongoose/html/css/iphone-style-checkboxes.css
Normal file
@@ -0,0 +1,75 @@
|
||||
.iPhoneCheckContainer {
|
||||
position: relative;
|
||||
height: 27px;
|
||||
cursor: pointer;
|
||||
overflow: hidden; }
|
||||
.iPhoneCheckContainer input {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
left: 30px;
|
||||
opacity: 0;
|
||||
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0);
|
||||
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); }
|
||||
.iPhoneCheckContainer label {
|
||||
white-space: nowrap;
|
||||
font-size: 17px;
|
||||
line-height: 17px;
|
||||
font-weight: bold;
|
||||
font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
|
||||
text-transform: uppercase;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
height: 27px;
|
||||
position: absolute;
|
||||
width: auto;
|
||||
top: 0;
|
||||
padding-top: 5px;
|
||||
overflow: hidden; }
|
||||
.iPhoneCheckContainer, .iPhoneCheckContainer label {
|
||||
user-select: none;
|
||||
-moz-user-select: none;
|
||||
-khtml-user-select: none; }
|
||||
|
||||
.iPhoneCheckDisabled {
|
||||
opacity: 0.5;
|
||||
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=50);
|
||||
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=50); }
|
||||
|
||||
label.iPhoneCheckLabelOn {
|
||||
color: white;
|
||||
background: url('/img/iphone-style-checkboxes/on.png?1282083753') no-repeat;
|
||||
text-shadow: 0px 0px 2px rgba(0, 0, 0, 0.6);
|
||||
left: 0;
|
||||
padding-top: 5px; }
|
||||
label.iPhoneCheckLabelOn span {
|
||||
padding-left: 8px; }
|
||||
label.iPhoneCheckLabelOff {
|
||||
color: #8b8b8b;
|
||||
background: url('/img/iphone-style-checkboxes/off.png?1282083753') no-repeat right 0;
|
||||
text-shadow: 0px 0px 2px rgba(255, 255, 255, 0.6);
|
||||
text-align: right;
|
||||
right: 0; }
|
||||
label.iPhoneCheckLabelOff span {
|
||||
padding-right: 8px; }
|
||||
|
||||
.iPhoneCheckHandle {
|
||||
display: block;
|
||||
height: 27px;
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 0;
|
||||
background: url('/img/iphone-style-checkboxes/slider_left.png?1282083753') no-repeat;
|
||||
padding-left: 3px; }
|
||||
|
||||
.iPhoneCheckHandleRight {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
padding-right: 3px;
|
||||
background: url('/img/iphone-style-checkboxes/slider_right.png?1282083753') no-repeat right 0; }
|
||||
|
||||
.iPhoneCheckHandleCenter {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
background: url('/img/iphone-style-checkboxes/slider_center.png?1282083753'); }
|
||||
@@ -63,13 +63,13 @@ table.borders, table.borders td, table.borders th
|
||||
empty-cells: show;
|
||||
}
|
||||
|
||||
table tr.odd
|
||||
table tr.odd, table td.odd, table th.odd
|
||||
{
|
||||
background: #ccff99;
|
||||
color: black;
|
||||
}
|
||||
|
||||
table tr.even
|
||||
table tr.even, table td.even, table th.even
|
||||
{
|
||||
background: #ffffcc;
|
||||
color: black;
|
||||
@@ -86,7 +86,7 @@ table th
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
table.keyval th
|
||||
table.keyval th, th.key
|
||||
{
|
||||
background: #ccff99;
|
||||
font-weight: bold;
|
||||
@@ -101,7 +101,7 @@ table.keyval td
|
||||
color: black;
|
||||
}
|
||||
|
||||
pre
|
||||
pre, .pre
|
||||
{
|
||||
font-family: Consolas, 'Courier New', Courier, monospace;
|
||||
color: black;
|
||||
@@ -174,6 +174,12 @@ pre
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.filesize
|
||||
{
|
||||
color: #6a6aff;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.footnote
|
||||
{
|
||||
color: #ff4000;
|
||||
@@ -225,3 +231,13 @@ img.progress
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.block
|
||||
{
|
||||
display: block;
|
||||
}
|
||||
|
||||
input.text
|
||||
{
|
||||
padding: .4em;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,27 @@
|
||||
<!--#include virtual="/lib/header.shtml" -->
|
||||
|
||||
<style type=text/css>
|
||||
.ui-button, .ui-button-text { padding: 0; font-size: 12px; }
|
||||
</style>
|
||||
|
||||
<div style="width: 75%">
|
||||
<form method=get action=/cgi-bin/epg_search.jim>
|
||||
Search EPG: <input name=term size=20 maxlength=255>
|
||||
<input type=checkbox name=full>Search descriptions as well as titles.
|
||||
<fieldset>
|
||||
<legend>EPG Search</legend>
|
||||
<label for=term>Query</label>
|
||||
<input type=text name=term id=term size=20 maxlength=255
|
||||
class="text ui-widget-content ui-corner-all">
|
||||
<input type=submit value=Search>
|
||||
<input type=checkbox name=full id=full>
|
||||
<label for=full>Search descriptions as well as titles.</label>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script type=text/javascript>
|
||||
$('input:submit').button();
|
||||
</script>
|
||||
|
||||
<!--#exec cmd="/mod/var/mongoose/include/epg.jim" -->
|
||||
<!--#include virtual="/lib/footer.shtml" -->
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
ADULT PARTY.png -
|
||||
BIN
var/mongoose/html/img/iphone-style-checkboxes/off.png
Normal file
BIN
var/mongoose/html/img/iphone-style-checkboxes/off.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
BIN
var/mongoose/html/img/iphone-style-checkboxes/on.png
Normal file
BIN
var/mongoose/html/img/iphone-style-checkboxes/on.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
BIN
var/mongoose/html/img/iphone-style-checkboxes/slider.png
Normal file
BIN
var/mongoose/html/img/iphone-style-checkboxes/slider.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
BIN
var/mongoose/html/img/iphone-style-checkboxes/slider_center.png
Normal file
BIN
var/mongoose/html/img/iphone-style-checkboxes/slider_center.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 260 B |
BIN
var/mongoose/html/img/iphone-style-checkboxes/slider_left.png
Normal file
BIN
var/mongoose/html/img/iphone-style-checkboxes/slider_left.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 324 B |
BIN
var/mongoose/html/img/iphone-style-checkboxes/slider_right.png
Normal file
BIN
var/mongoose/html/img/iphone-style-checkboxes/slider_right.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 321 B |
229
var/mongoose/html/js/iphone-style-checkboxes.js
Normal file
229
var/mongoose/html/js/iphone-style-checkboxes.js
Normal file
@@ -0,0 +1,229 @@
|
||||
/*!
|
||||
// iPhone-style Checkboxes jQuery plugin
|
||||
// Copyright Thomas Reynolds, licensed GPL & MIT
|
||||
*/
|
||||
;(function($, iphoneStyle) {
|
||||
|
||||
// Constructor
|
||||
$[iphoneStyle] = function(elem, options) {
|
||||
this.$elem = $(elem);
|
||||
|
||||
// Import options into instance variables
|
||||
var obj = this;
|
||||
$.each(options, function(key, value) {
|
||||
obj[key] = value;
|
||||
});
|
||||
|
||||
// Initialize the control
|
||||
this.wrapCheckboxWithDivs();
|
||||
this.attachEvents();
|
||||
this.disableTextSelection();
|
||||
|
||||
if (this.resizeHandle) { this.optionallyResize('handle'); }
|
||||
if (this.resizeContainer) { this.optionallyResize('container'); }
|
||||
|
||||
this.initialPosition();
|
||||
};
|
||||
|
||||
$.extend($[iphoneStyle].prototype, {
|
||||
// Wrap the existing input[type=checkbox] with divs for styling and grab DOM references to the created nodes
|
||||
wrapCheckboxWithDivs: function() {
|
||||
this.$elem.wrap('<div class="' + this.containerClass + '" />');
|
||||
this.container = this.$elem.parent();
|
||||
|
||||
this.offLabel = $('<label class="'+ this.labelOffClass +'">' +
|
||||
'<span>'+ this.uncheckedLabel +'</span>' +
|
||||
'</label>').appendTo(this.container);
|
||||
this.offSpan = this.offLabel.children('span');
|
||||
|
||||
this.onLabel = $('<label class="'+ this.labelOnClass +'">' +
|
||||
'<span>'+ this.checkedLabel +'</span>' +
|
||||
'</label>').appendTo(this.container);
|
||||
this.onSpan = this.onLabel.children('span');
|
||||
|
||||
this.handle = $('<div class="' + this.handleClass + '">' +
|
||||
'<div class="' + this.handleRightClass + '">' +
|
||||
'<div class="' + this.handleCenterClass + '" />' +
|
||||
'</div>' +
|
||||
'</div>').appendTo(this.container);
|
||||
},
|
||||
|
||||
// Disable IE text selection, other browsers are handled in CSS
|
||||
disableTextSelection: function() {
|
||||
if (!$.browser.msie) { return; }
|
||||
|
||||
// Elements containing text should be unselectable
|
||||
$.each([this.handle, this.offLabel, this.onLabel, this.container], function() {
|
||||
$(this).attr("unselectable", "on");
|
||||
});
|
||||
},
|
||||
|
||||
// Automatically resize the handle or container
|
||||
optionallyResize: function(mode) {
|
||||
var onLabelWidth = this.onLabel.width(),
|
||||
offLabelWidth = this.offLabel.width();
|
||||
|
||||
if (mode == 'container') {
|
||||
var newWidth = (onLabelWidth > offLabelWidth) ? onLabelWidth : offLabelWidth;
|
||||
newWidth += this.handle.width() + 15;
|
||||
} else {
|
||||
var newWidth = (onLabelWidth < offLabelWidth) ? onLabelWidth : offLabelWidth;
|
||||
}
|
||||
|
||||
this[mode].css({ width: newWidth });
|
||||
},
|
||||
|
||||
attachEvents: function() {
|
||||
var obj = this;
|
||||
|
||||
// A mousedown anywhere in the control will start tracking for dragging
|
||||
this.container
|
||||
.bind('mousedown touchstart', function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
if (obj.$elem.is(':disabled')) { return; }
|
||||
|
||||
var x = event.pageX || event.originalEvent.changedTouches[0].pageX;
|
||||
$[iphoneStyle].currentlyClicking = obj.handle;
|
||||
$[iphoneStyle].dragStartPosition = x;
|
||||
$[iphoneStyle].handleLeftOffset = parseInt(obj.handle.css('left'), 10) || 0;
|
||||
$[iphoneStyle].dragStartedOn = obj.$elem;
|
||||
})
|
||||
|
||||
// Utilize event bubbling to handle drag on any element beneath the container
|
||||
.bind('iPhoneDrag', function(event, x) {
|
||||
event.preventDefault();
|
||||
|
||||
if (obj.$elem.is(':disabled')) { return; }
|
||||
if (obj.$elem != $[iphoneStyle].dragStartedOn) { return; }
|
||||
|
||||
var p = (x + $[iphoneStyle].handleLeftOffset - $[iphoneStyle].dragStartPosition) / obj.rightSide;
|
||||
if (p < 0) { p = 0; }
|
||||
if (p > 1) { p = 1; }
|
||||
obj.handle.css({ left: p * obj.rightSide });
|
||||
obj.onLabel.css({ width: p * obj.rightSide + 4 });
|
||||
obj.offSpan.css({ marginRight: -p * obj.rightSide });
|
||||
obj.onSpan.css({ marginLeft: -(1 - p) * obj.rightSide });
|
||||
})
|
||||
|
||||
// Utilize event bubbling to handle drag end on any element beneath the container
|
||||
.bind('iPhoneDragEnd', function(event, x) {
|
||||
if (obj.$elem.is(':disabled')) { return; }
|
||||
|
||||
var checked;
|
||||
if ($[iphoneStyle].dragging) {
|
||||
var p = (x - $[iphoneStyle].dragStartPosition) / obj.rightSide;
|
||||
checked = (p < 0) ? Math.abs(p) < 0.5 : p >= 0.5;
|
||||
} else {
|
||||
checked = !obj.$elem.attr('checked');
|
||||
}
|
||||
|
||||
obj.$elem.attr('checked', checked);
|
||||
|
||||
$[iphoneStyle].currentlyClicking = null;
|
||||
$[iphoneStyle].dragging = null;
|
||||
obj.$elem.change();
|
||||
});
|
||||
|
||||
// Animate when we get a change event
|
||||
this.$elem.change(function() {
|
||||
if (obj.$elem.is(':disabled')) {
|
||||
obj.container.addClass(obj.disabledClass);
|
||||
return false;
|
||||
} else {
|
||||
obj.container.removeClass(obj.disabledClass);
|
||||
}
|
||||
|
||||
var new_left = obj.$elem.attr('checked') ? obj.rightSide : 0;
|
||||
|
||||
obj.handle.animate({ left: new_left }, obj.duration);
|
||||
obj.onLabel.animate({ width: new_left + 4 }, obj.duration);
|
||||
obj.offSpan.animate({ marginRight: -new_left }, obj.duration);
|
||||
obj.onSpan.animate({ marginLeft: new_left - obj.rightSide }, obj.duration);
|
||||
});
|
||||
},
|
||||
|
||||
// Setup the control's inital position
|
||||
initialPosition: function() {
|
||||
this.offLabel.css({ width: this.container.width() - 5 });
|
||||
|
||||
var offset = ($.browser.msie && $.browser.version < 7) ? 3 : 6;
|
||||
this.rightSide = this.container.width() - this.handle.width() - offset;
|
||||
|
||||
if (this.$elem.is(':checked')) {
|
||||
this.handle.css({ left: this.rightSide });
|
||||
this.onLabel.css({ width: this.rightSide + 4 });
|
||||
this.offSpan.css({ marginRight: -this.rightSide });
|
||||
} else {
|
||||
this.onLabel.css({ width: 0 });
|
||||
this.onSpan.css({ marginLeft: -this.rightSide });
|
||||
}
|
||||
|
||||
if (this.$elem.is(':disabled')) {
|
||||
this.container.addClass(this.disabledClass);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// jQuery-specific code
|
||||
$.fn[iphoneStyle] = function(options) {
|
||||
var checkboxes = this.filter(':checkbox');
|
||||
|
||||
// Fail early if we don't have any checkboxes passed in
|
||||
if (!checkboxes.length) { return this; }
|
||||
|
||||
// Merge options passed in with global defaults
|
||||
var opt = $.extend({}, $[iphoneStyle].defaults, options);
|
||||
|
||||
checkboxes.each(function() {
|
||||
$(this).data(iphoneStyle, new $[iphoneStyle](this, opt));
|
||||
});
|
||||
|
||||
if (!$[iphoneStyle].initComplete) {
|
||||
// As the mouse moves on the page, animate if we are in a drag state
|
||||
$(document)
|
||||
.bind('mousemove touchmove', function(event) {
|
||||
if (!$[iphoneStyle].currentlyClicking) { return; }
|
||||
event.preventDefault();
|
||||
|
||||
var x = event.pageX || event.originalEvent.changedTouches[0].pageX;
|
||||
if (!$[iphoneStyle].dragging &&
|
||||
(Math.abs($[iphoneStyle].dragStartPosition - x) > opt.dragThreshold)) {
|
||||
$[iphoneStyle].dragging = true;
|
||||
}
|
||||
|
||||
$(event.target).trigger('iPhoneDrag', [x]);
|
||||
})
|
||||
|
||||
// When the mouse comes up, leave drag state
|
||||
.bind('mouseup touchend', function(event) {
|
||||
if (!$[iphoneStyle].currentlyClicking) { return; }
|
||||
event.preventDefault();
|
||||
|
||||
var x = event.pageX || event.originalEvent.changedTouches[0].pageX;
|
||||
$($[iphoneStyle].currentlyClicking).trigger('iPhoneDragEnd', [x]);
|
||||
});
|
||||
|
||||
$[iphoneStyle].initComplete = true;
|
||||
}
|
||||
|
||||
return this;
|
||||
}; // End of $.fn[iphoneStyle]
|
||||
|
||||
$[iphoneStyle].defaults = {
|
||||
duration: 200, // Time spent during slide animation
|
||||
checkedLabel: 'ON', // Text content of "on" state
|
||||
uncheckedLabel: 'OFF', // Text content of "off" state
|
||||
resizeHandle: true, // Automatically resize the handle to cover either label
|
||||
resizeContainer: true, // Automatically resize the widget to contain the labels
|
||||
disabledClass: 'iPhoneCheckDisabled',
|
||||
containerClass: 'iPhoneCheckContainer',
|
||||
labelOnClass: 'iPhoneCheckLabelOn',
|
||||
labelOffClass: 'iPhoneCheckLabelOff',
|
||||
handleClass: 'iPhoneCheckHandle',
|
||||
handleCenterClass: 'iPhoneCheckHandleCenter',
|
||||
handleRightClass: 'iPhoneCheckHandleRight',
|
||||
dragThreshold: 5 // Pixels that must be dragged for a click to be ignored
|
||||
};
|
||||
|
||||
})(jQuery, 'iphoneStyle');
|
||||
@@ -13,8 +13,9 @@
|
||||
// (C)2008 by Cory S.N. LaViska.
|
||||
//
|
||||
// For details, visit http://creativecommons.org/licenses/by/3.0/us/
|
||||
//
|
||||
// Modified 11NOV08 By Bill Beckelman to include option to use left mouse button instead.
|
||||
|
||||
// Modified by Andy Fiddaman to support left click and
|
||||
// support modification of menu items.
|
||||
|
||||
if (jQuery) (function() {
|
||||
$.extend($.fn, {
|
||||
@@ -25,6 +26,7 @@ if (jQuery) (function() {
|
||||
if (o.inSpeed == undefined) o.inSpeed = 150;
|
||||
if (o.outSpeed == undefined) o.outSpeed = 75;
|
||||
if (o.leftButton == undefined) o.leftButton = false;
|
||||
if (o.beforeShow == undefined) o.beforeShow = false;
|
||||
// 0 needs to be -1 for expected results (no fade)
|
||||
if (o.inSpeed == 0) o.inSpeed = -1;
|
||||
if (o.outSpeed == 0) o.outSpeed = -1;
|
||||
@@ -34,8 +36,8 @@ if (jQuery) (function() {
|
||||
var offset = $(el).offset();
|
||||
// Add contextMenu class
|
||||
$('#' + o.menu).addClass('contextMenu');
|
||||
if (o.leftButton) $(this).bind('click', false);
|
||||
// Simulate a true right click
|
||||
$(this).bind('click', false);
|
||||
$(this).mousedown(function(e) {
|
||||
var evt = e;
|
||||
$(this).mouseup(function(e) {
|
||||
@@ -49,6 +51,8 @@ if (jQuery) (function() {
|
||||
|
||||
if ($(el).hasClass('disabled')) return false;
|
||||
|
||||
if (o.beforeShow) o.beforeShow(el, menu);
|
||||
|
||||
// Detect mouse position
|
||||
var d = {}, x, y;
|
||||
if (self.innerHeight) {
|
||||
@@ -185,6 +189,15 @@ if (jQuery) (function() {
|
||||
return ($(this));
|
||||
},
|
||||
|
||||
// Change context menu text on the fly
|
||||
changeContextMenuItem: function(d, t) {
|
||||
if (d == undefined) return;
|
||||
$(this).each(function() {
|
||||
$(this).find('A[href="' + d + '"]').text(t);
|
||||
});
|
||||
return ($(this));
|
||||
},
|
||||
|
||||
// Disable context menu(s)
|
||||
disableContextMenu: function() {
|
||||
$(this).each(function() {
|
||||
|
||||
@@ -1,40 +1,27 @@
|
||||
<!--#include virtual="/lib/header.shtml" -->
|
||||
<link href=/css/iphone-style-checkboxes.css rel=stylesheet type=text/css />
|
||||
<script type="text/javascript" src="/js/iphone-style-checkboxes.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
<script type=text/javascript src=/js/ajax.js></script>
|
||||
$(document).ready(function() {
|
||||
$('input:checkbox').iphoneStyle();
|
||||
// Don't allow turning off the web server from within the web server..
|
||||
$('input:checkbox[name=mongoose][class=toggle]').attr('disabled', true);
|
||||
|
||||
<script type=text/javascript>
|
||||
function updateResults()
|
||||
{
|
||||
var r = document.getElementById('results');
|
||||
if (r && request.readyState == 4 && request.status == 200)
|
||||
{
|
||||
r.style.display = 'block';
|
||||
var t = document.getElementById('result_txt');
|
||||
t.innerHTML = request.responseText;
|
||||
}
|
||||
}
|
||||
|
||||
function go(service, action)
|
||||
{
|
||||
if (service == null || service == "" ||
|
||||
action == null || action == "")
|
||||
return;
|
||||
|
||||
var url = "/cgi-bin/service.jim?service=" + escape(service) +
|
||||
"&action=" + escape(action);
|
||||
|
||||
request.open("GET", url, true);
|
||||
request.onreadystatechange = updateResults;
|
||||
request.send(null);
|
||||
}
|
||||
|
||||
function toggle(obj)
|
||||
{
|
||||
if (obj.src.search("on") > -1)
|
||||
obj.src = '/img/off.png';
|
||||
else
|
||||
obj.src = '/img/on.png';
|
||||
}
|
||||
$(':checkbox').change(function() {
|
||||
var url = '/cgi-bin/service.jim?action=' +
|
||||
escape($(this).attr('class')) +
|
||||
'&service=' +
|
||||
escape($(this).attr('name'));
|
||||
$('#result_txt').load(url, function() {
|
||||
if ($('#results').is(":visible") == false)
|
||||
{
|
||||
$('#results').show('slow');
|
||||
$('#results').delay(3000).hide('slow');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ if {[os.gethostname] eq "hosting"} {
|
||||
set used "100GB"
|
||||
set perc "10"
|
||||
} else {
|
||||
foreach df [split [exec df -h] "\n\r"] {
|
||||
foreach df [split [exec df -h 2>>/dev/null] "\n\r"] {
|
||||
if [string match *sd*2* $df] {
|
||||
regsub -all -- {[[:space:]]+} $df " " df
|
||||
set fields [split $df]
|
||||
|
||||
@@ -2,18 +2,6 @@
|
||||
|
||||
set services [split [exec /mod/bin/service mlist]]
|
||||
|
||||
proc button {state service action} {
|
||||
puts -nonewline "<a href=#>"
|
||||
puts -nonewline "<img border=0 src=/img/$state.png"
|
||||
puts -nonewline " onClick=\"go('$service', '$action'); "
|
||||
puts -nonewline "toggle(this); return false\">"
|
||||
puts "</a>"
|
||||
}
|
||||
|
||||
proc control {s a} {
|
||||
return "<a href=/cgi-bin/service.jim?action=$a&service=$s>"
|
||||
}
|
||||
|
||||
foreach service $services {
|
||||
set data [split $service ":"]
|
||||
set name [lindex $data 0]
|
||||
@@ -21,20 +9,19 @@ foreach service $services {
|
||||
set auto [lindex $data 2]
|
||||
set running [lindex $data 3]
|
||||
|
||||
puts "<tr class=even><td>$name</td>"
|
||||
puts "<tr><td class=even>$name</td>"
|
||||
if (!$installed) {
|
||||
puts "<td colspan=3><i>Not installed</i></td></tr>"
|
||||
continue
|
||||
}
|
||||
|
||||
puts "<td>"
|
||||
if ($auto) { button on $name auto } else { button off $name auto }
|
||||
puts "</td>"
|
||||
puts -nonewline "<td><input type=checkbox class=auto name=\"$name\""
|
||||
if ($auto) { puts -nonewline " checked" }
|
||||
puts "></td>"
|
||||
|
||||
puts "<td>"
|
||||
if ($running) { button on $name toggle } else {
|
||||
button off $name toggle }
|
||||
puts "</td>"
|
||||
puts -nonewline "<td><input type=checkbox class=toggle name=\"$name\"""
|
||||
if ($running) { puts -nonewline " checked" }
|
||||
puts "></td>"
|
||||
|
||||
puts "</tr>"
|
||||
}
|
||||
|
||||
@@ -10,6 +10,12 @@ source /mod/var/mongoose/lib/progressbar
|
||||
set channeldb 0
|
||||
catch { set channeldb [sqlite3.open /var/lib/humaxtv/channel.db] }
|
||||
|
||||
set epgpath /mnt/hd1/dvbepg/epg.dat
|
||||
set hdepgpath /media/drive1/epgsavedata
|
||||
if {![file exists $epgpath] && [file exists $hdepgpath]} {
|
||||
set epgpath $hdepgpath
|
||||
}
|
||||
|
||||
# * service_id, event_id, start, duration, encrypted, name, text
|
||||
# * warning, content code, content type,
|
||||
# * event CRID, series CRID, rec CRID
|
||||
@@ -210,7 +216,7 @@ proc {epg cleanup} {} {
|
||||
|
||||
proc {epg exec} {mode args} {
|
||||
set raw 0
|
||||
set cmd [list /mod/bin/epg]
|
||||
set cmd [list /mod/bin/epg -f $::epgpath]
|
||||
set extra ""
|
||||
foreach arg $args {
|
||||
if {[string first "-" $arg] == 0} {
|
||||
|
||||
8
var/mongoose/lib/ffmpeg
Executable file
8
var/mongoose/lib/ffmpeg
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
/mod/bin/ffmpeg "$@" 2>&1 | sed '
|
||||
1,8d
|
||||
$d
|
||||
'
|
||||
exit 0
|
||||
|
||||
15
var/mongoose/lib/pretty_size
Normal file
15
var/mongoose/lib/pretty_size
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
if {[expr ! [exists -proc pretty_size ]]} {
|
||||
proc pretty_size {size} {
|
||||
set units {bytes KiB MiB GiB TiB}
|
||||
|
||||
for {set i 0} {$size > 1023} {incr i} {
|
||||
set size $($size / 1024.0)
|
||||
}
|
||||
|
||||
set size [format "%.2f" $size]
|
||||
|
||||
return "$size [lindex $units $i]"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ set settingsdb [sqlite3.open /mod/etc/webif.db]
|
||||
class settings {
|
||||
hostname ""
|
||||
channel_group 0
|
||||
smtp_server ""
|
||||
}
|
||||
|
||||
settings method hostname {{name ""}} {
|
||||
@@ -30,6 +31,34 @@ settings method hostname {{name ""}} {
|
||||
}
|
||||
}
|
||||
|
||||
settings method smtp_server {{server ""}} {
|
||||
if {$server == ""} {
|
||||
# Get
|
||||
if {[catch {set fd [open "/mod/etc/ssmtp/ssmtp.conf" r]}]} {
|
||||
set server "mail"
|
||||
} else {
|
||||
foreach line [split [read $fd] "\n"] {
|
||||
set a [string first "mailhub=" $line]
|
||||
if {$a == 0} {
|
||||
set server [string range $line 8 end]
|
||||
set server [string trim $server]
|
||||
}
|
||||
}
|
||||
close $fd
|
||||
}
|
||||
return $server
|
||||
} else {
|
||||
# Set
|
||||
if {[string is ascii -strict $server]} {
|
||||
set fd [open "/mod/etc/ssmtp/ssmtp.conf" w]
|
||||
puts $fd "mailhub=$server"
|
||||
puts $fd "rewriteDomain=hummypkg.org.uk"
|
||||
puts $fd "hostname=[$self hostname].hummypkg.org.uk"
|
||||
close $fd
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
settings method _nval_setting {name {val -1}} {
|
||||
global settingsdb;
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ if {[expr ! [exists -proc class ]]} { package require oo }
|
||||
|
||||
class ts {
|
||||
file ""
|
||||
base ""
|
||||
title ""
|
||||
synopsis ""
|
||||
definition ""
|
||||
@@ -12,6 +13,7 @@ class ts {
|
||||
end 0
|
||||
flags ""
|
||||
error ""
|
||||
guidance ""
|
||||
}
|
||||
|
||||
ts method duration {} {
|
||||
@@ -19,11 +21,8 @@ ts method duration {} {
|
||||
}
|
||||
|
||||
ts method size {} {
|
||||
set sz "??"
|
||||
catch {
|
||||
file stat $file st
|
||||
set sz [expr $st(size) / 1048576]
|
||||
}
|
||||
file stat $file st
|
||||
return $st(size)
|
||||
}
|
||||
|
||||
ts method _parse {line} {
|
||||
@@ -37,6 +36,7 @@ ts method _parse {line} {
|
||||
set start [lindex $vars 5]
|
||||
set end [lindex $vars 6]
|
||||
set flags [split [string range [lindex $vars 7] 0 end-1] ,]
|
||||
set guidance [lindex $vars 8]
|
||||
}
|
||||
|
||||
ts method flag {f} {
|
||||
@@ -77,11 +77,47 @@ proc {ts exec} {file} {
|
||||
return [exec {*}$cmd]
|
||||
}
|
||||
|
||||
proc {ts fetch} {file} {
|
||||
proc {ts fetch} {file {checked 0}} {
|
||||
# Check that this is a .ts file which has at least one sidecar
|
||||
# file (.nts)
|
||||
if {!$checked} {
|
||||
if {[file extension $file] ne ".ts"} { return 0 }
|
||||
if {![file exists "[file rootname $file].nts"]} { return 0 }
|
||||
}
|
||||
|
||||
return [ts parse $file [ts exec $file]]
|
||||
}
|
||||
|
||||
ts method delete {} {
|
||||
# Extract file basename
|
||||
foreach f [glob -nocomplain "[file rootname $file].*"] {
|
||||
puts "Removed $f<br>"
|
||||
file delete $f
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
ts method settitle {newtitle} {
|
||||
if {[string length newtitle] > 48} { return }
|
||||
|
||||
exec /mod/bin/hmt "+settitle=${newtitle}" $file
|
||||
}
|
||||
|
||||
proc {ts renamegroup} {from to} {
|
||||
set dir [file dirname $from]
|
||||
set root [file rootname $from]
|
||||
|
||||
# Catch from string without a . character in it
|
||||
if {$root eq $from} { return }
|
||||
|
||||
# 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}.*"] {
|
||||
set ext [file extension $f]
|
||||
#puts "rename $f \"${dir}/${to}${ext}\""
|
||||
file rename $f "${dir}/${to}${ext}"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user