commit
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif@179 2a923420-c742-0410-a762-8d5b09965624
|
@ -1,60 +1,165 @@
|
|||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/ts.class
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
|
||||
set ignore {nts thm hmt hmi}
|
||||
set standard {avi mpg wmv mkv}
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
#set _cgi(tsfile) "/media/My Video/Have I Got News for You_20110606_2247.ts"
|
||||
#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>
|
||||
"
|
||||
}
|
||||
|
||||
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>"
|
||||
}
|
||||
|
||||
proc entry {file} {
|
||||
set bfile [lindex [split $file /] end]
|
||||
if {[string index $bfile 0] == "\025"} {
|
||||
set bfile [string range $bfile 1 end]
|
||||
}
|
||||
if [file isdirectory "$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
|
||||
}
|
||||
}
|
||||
|
||||
if {[dict exists $_cgi tsfile]} {
|
||||
source /mod/var/mongoose/lib/epg.class
|
||||
set file [dict get $_cgi tsfile]
|
||||
set a [split [exec /mod/bin/hmt -p $file] "\t"]
|
||||
set ts [ts fetch $file]
|
||||
|
||||
# Need to fix 64-bit..
|
||||
set size "??"
|
||||
catch {
|
||||
file stat $file st
|
||||
set size [expr $st(size) / 1048576]
|
||||
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
|
||||
}
|
||||
|
||||
source /mod/var/mongoose/lib/epg.class
|
||||
|
||||
puts "
|
||||
<table class=keyval>
|
||||
<tr>
|
||||
<th>Title</th>
|
||||
<td>[lindex $a 0]</td>
|
||||
<td>[$ts get title]</td>
|
||||
</tr><tr>
|
||||
<th>Synopsis</th>
|
||||
<td>[lindex $a 1]</td>
|
||||
<td>[$ts get synopsis]</td>
|
||||
</tr><tr>
|
||||
<th>Definition</th>
|
||||
<td>[lindex $a 2]</td>
|
||||
<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 [lindex $a 4] 50 "vertical-align: middle"]
|
||||
[lindex $a 3] - [lindex $a 4]</td>
|
||||
<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 [lindex $a 5] -format "%c %Z"]
|
||||
puts [clock format [$ts get start] -format "%c %Z"]
|
||||
puts "</td>
|
||||
</tr><tr>
|
||||
<th>End Time</th>
|
||||
<td>"
|
||||
puts [clock format [lindex $a 6] -format "%c %Z"]
|
||||
puts [clock format [$ts get end] -format "%c %Z"]
|
||||
puts "</td>
|
||||
</tr><tr>
|
||||
<th>Duration</th>
|
||||
<td>[expr [expr [lindex $a 6] - [lindex $a 5]] / 60] minute(s).</td>
|
||||
<td>[$ts duration] minute(s).</td>
|
||||
</tr><tr>
|
||||
<th>Size</th>
|
||||
<td>$size MiB</td>
|
||||
<td>[$ts size] MiB</td>
|
||||
</tr><tr>
|
||||
<th>Flags</th>
|
||||
<td>[lindex $a 7]</td>
|
||||
<td>[$ts get flags]</td>
|
||||
</tr>
|
||||
</table>
|
||||
"
|
||||
|
@ -70,19 +175,85 @@ if {[dict exists $_cgi dir]} {
|
|||
source /mod/var/mongoose/html/lib/header.jim
|
||||
|
||||
puts {
|
||||
|
||||
<link href=/css/jquery.contextMenu.css rel=stylesheet type=text/css />
|
||||
<script type="text/javascript" src="/js/jquery.contextMenu.js"></script>
|
||||
|
||||
<ul id=optmenu class=contextMenu>
|
||||
<li><a href=#delete>Delete</a></li>
|
||||
<li><a href=#lock>Toggle Lock</a></li>
|
||||
<li><a href=#rename>Rename</a></li>
|
||||
<li><a href=#title>Change Title</a></li>
|
||||
</ul>
|
||||
|
||||
<div id=dialogue></div>
|
||||
<div id=confirm title="Confirmation Required"></div>
|
||||
|
||||
<script type=text/javascript>
|
||||
$(document).ready(function() {
|
||||
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">'); }
|
||||
|
||||
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();
|
||||
|
@ -92,39 +263,39 @@ puts {
|
|||
$('#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>
|
||||
}
|
||||
|
||||
proc tsfile {file bfile} {
|
||||
puts "
|
||||
<div style=\"vertical-align: middle\">
|
||||
<a class=ts file=\"$file\" href=#>
|
||||
<img style=\"vertical-align: middle\"
|
||||
border=0 width=45 src=/images/741_1_10_Video_Title.png>
|
||||
$bfile
|
||||
</a>
|
||||
<a class=tsopt file=\"$file\" href=#>
|
||||
<img style=\"vertical-align: middle\"
|
||||
border=0 width=45 src=/images/181_1_00_Help5_OPT_Plus.png>
|
||||
</a>
|
||||
</div>
|
||||
"
|
||||
}
|
||||
|
||||
proc genfile {file bfile} {
|
||||
puts "
|
||||
<div style=\"vertical-align: middle\">
|
||||
<a href=#>
|
||||
<img style=\"vertical-align: middle\"
|
||||
border=0 width=45 src=/images/743_4_10_Video_Xvid_File.png>
|
||||
$bfile
|
||||
</a>
|
||||
</div>
|
||||
"
|
||||
}
|
||||
|
||||
puts { <div style="border: 1px solid grey; padding: 1em"> }
|
||||
|
||||
# Breadcrumb path
|
||||
puts "<h1>"
|
||||
set stub ""
|
||||
foreach part [split $dir /] {
|
||||
|
@ -137,10 +308,9 @@ puts "</h1>"
|
|||
set parent [join [lrange [split $dir /] 0 end-1] /]
|
||||
if {$parent ne ""} {
|
||||
puts "
|
||||
<div style=\"vertical-align: middle\">
|
||||
<div class=va>
|
||||
<a href=$env(REQUEST_URI)?dir=[cgi_quote_url $parent]>
|
||||
<img src=/images/711_3_09_Media_Folder_UP.png
|
||||
style=\"vertical-align: middle\">
|
||||
<img src=/images/711_3_09_Media_Folder_UP.png class=va>
|
||||
\[parent directory\]</a>
|
||||
</div>
|
||||
"
|
||||
|
@ -149,31 +319,7 @@ if {$parent ne ""} {
|
|||
regsub -all -- {\/+} "$dir/*" "/" dir
|
||||
|
||||
foreach file [lsort [glob -nocomplain "$dir"]] {
|
||||
set bfile [lindex [split $file /] end]
|
||||
if {[string index $bfile 0] == "\025"} {
|
||||
set bfile [string range $bfile 1 end]
|
||||
}
|
||||
if [file isdirectory "$file"] {
|
||||
puts "<div style=\"vertical-align: middle\">"
|
||||
puts "<a href=$env(REQUEST_URI)?dir=[cgi_quote_url $file]>"
|
||||
puts "<img border=0
|
||||
style=\"vertical-align: middle\"
|
||||
src=/images/711_1_09_Media_Folder.png>"
|
||||
puts "$bfile</a><br>"
|
||||
continue
|
||||
}
|
||||
regexp -- {\.([^.]+)$} "$file" allmatch ext
|
||||
switch $ext {
|
||||
nts { continue }
|
||||
thm { continue }
|
||||
hmt { continue }
|
||||
hmi { continue }
|
||||
ts { tsfile $file $bfile }
|
||||
avi { genfile $file $bfile }
|
||||
mpg { genfile $file $bfile }
|
||||
wmv { genfile $file $bfile }
|
||||
mkv { genfile $file $bfile }
|
||||
}
|
||||
entry $file
|
||||
}
|
||||
|
||||
puts "</div>"
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
/* Generic context menu styles */
|
||||
.contextMenu {
|
||||
position: absolute;
|
||||
width: 120px;
|
||||
z-index: 99999;
|
||||
border: solid 1px #CCC;
|
||||
background: #EEE;
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.contextMenu LI {
|
||||
list-style: none;
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
.contextMenu A {
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
display: block;
|
||||
line-height: 20px;
|
||||
height: 20px;
|
||||
background-position: 6px center;
|
||||
background-repeat: no-repeat;
|
||||
outline: none;
|
||||
padding: 1px 5px;
|
||||
padding-left: 28px;
|
||||
}
|
||||
|
||||
.contextMenu LI.hover A {
|
||||
color: #FFF;
|
||||
background-color: #3399FF;
|
||||
}
|
||||
|
||||
.contextMenu LI.disabled A {
|
||||
color: #AAA;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.contextMenu LI.hover.disabled A {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.contextMenu LI.separator {
|
||||
border-top: solid 1px #CCC;
|
||||
}
|
||||
|
||||
/*
|
||||
Adding Icons
|
||||
|
||||
You can add icons to the context menu by adding
|
||||
classes to the respective LI element(s)
|
||||
*/
|
||||
|
||||
.contextMenu LI.edit A { background-image: url(images/page_white_edit.png); }
|
||||
.contextMenu LI.cut A { background-image: url(images/cut.png); }
|
||||
.contextMenu LI.copy A { background-image: url(images/page_white_copy.png); }
|
||||
.contextMenu LI.paste A { background-image: url(images/page_white_paste.png); }
|
||||
.contextMenu LI.delete A { background-image: url(images/page_white_delete.png); }
|
||||
.contextMenu LI.quit A { background-image: url(images/door.png); }
|
|
@ -220,3 +220,8 @@ img.progress
|
|||
background-position: 1px 0;
|
||||
}
|
||||
|
||||
.va
|
||||
{
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
303.png -
|
After Width: | Height: | Size: 5.1 KiB |
After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 7.3 KiB |
|
@ -0,0 +1 @@
|
|||
Alibi.png -
|
|
@ -0,0 +1 @@
|
|||
Alibi+1.png
|
After Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 7.9 KiB |
After Width: | Height: | Size: 5.9 KiB |
|
@ -0,0 +1 @@
|
|||
BBC 1 Cl.png
|
|
@ -0,0 +1 @@
|
|||
BBC 1 Cl.png
|
|
@ -0,0 +1 @@
|
|||
BBC 1 Cl.png
|
|
@ -0,0 +1 @@
|
|||
BBC 1 Cl.png
|
|
@ -0,0 +1 @@
|
|||
BBC 1 Cl.png
|
|
@ -0,0 +1 @@
|
|||
BBC 1 Cl.png
|
|
@ -0,0 +1 @@
|
|||
BBC 1 Cl.png
|
|
@ -0,0 +1 @@
|
|||
BBC 2 England.png
|
After Width: | Height: | Size: 5.0 KiB |
|
@ -0,0 +1 @@
|
|||
BBC Radio 7.png -
|
After Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 3.5 KiB |
|
@ -0,0 +1 @@
|
|||
BBC 1 Cl.png
|
|
@ -0,0 +1 @@
|
|||
BBC 1 Cl.png
|
After Width: | Height: | Size: 6.2 KiB |
|
@ -0,0 +1 @@
|
|||
BBC Radio Ulster.png -
|
After Width: | Height: | Size: 3.4 KiB |
|
@ -0,0 +1 @@
|
|||
BBC 1Xtra.png
|
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 4.5 KiB |
|
@ -0,0 +1 @@
|
|||
BBC R1.png
|
|
@ -0,0 +1 @@
|
|||
BBC R2.png
|
|
@ -0,0 +1 @@
|
|||
BBC R4 FM.png
|
After Width: | Height: | Size: 4.3 KiB |
|
@ -0,0 +1 @@
|
|||
BBC 7.png
|
|
@ -0,0 +1 @@
|
|||
BBC R Ulster.png
|
After Width: | Height: | Size: 3.5 KiB |
|
@ -0,0 +1 @@
|
|||
BBC 2 England.png
|
|
@ -0,0 +1 @@
|
|||
BBC World Sv..png -
|
After Width: | Height: | Size: 8.5 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 4.4 KiB |
|
@ -0,0 +1 @@
|
|||
ADULT Babestn.png
|
|
@ -0,0 +1 @@
|
|||
Baby TV.png
|
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 12 KiB |
|
@ -0,0 +1 @@
|
|||
Biography.png -
|
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 4.8 KiB |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 6.6 KiB |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 8.7 KiB |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 6.5 KiB |
After Width: | Height: | Size: 8.0 KiB |
After Width: | Height: | Size: 8.4 KiB |
After Width: | Height: | Size: 4.4 KiB |
|
@ -0,0 +1 @@
|
|||
CBeebies.png
|
After Width: | Height: | Size: 4.9 KiB |
|
@ -0,0 +1 @@
|
|||
Challenge +1.png
|
After Width: | Height: | Size: 4.2 KiB |
|
@ -0,0 +1 @@
|
|||
Channel 4 +1.png
|
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 5.1 KiB |
After Width: | Height: | Size: 5.9 KiB |
|
@ -0,0 +1 @@
|
|||
Climax3 - 1.png
|
|
@ -0,0 +1 @@
|
|||
Climax3 - 1.png
|
After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 13 KiB |
|
@ -0,0 +1 @@
|
|||
Comedy Central Extra.png
|
|
@ -0,0 +1 @@
|
|||
Comedy Central.png
|
|
@ -0,0 +1 @@
|
|||
Comedy Central Extra.png
|
|
@ -0,0 +1 @@
|
|||
COMMUNITY.png
|
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 9.5 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 6.8 KiB |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 4.8 KiB |
After Width: | Height: | Size: 5.6 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 5.1 KiB |
|
@ -0,0 +1 @@
|
|||
Discovery Channel.png
|
After Width: | Height: | Size: 8.0 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 4.1 KiB |