improve media rename, require HMT 1.1.7

git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1231 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2012-11-18 12:07:53 +00:00
parent d4dc56b816
commit 775add8c04
7 changed files with 72 additions and 47 deletions

View File

@ -1,9 +1,9 @@
Package: webif
Priority: optional
Section: web
Version: 0.10.0-4
Version: 0.10.1
Architecture: mipsel
Maintainer: af123@hummypkg.org.uk
Depends: webif-channelicons(>=1.0.3),mongoose(>=3.0-7),jim(>=0.73-1),jim-oo,jim-sqlite3(>=0.73),jim-cgi(>=0.5),service-control(>=1.2),busybox(>=1.19.3-1),lsof,epg(>=1.0.9),hmt(>=1.1.6),ssmtp,anacron,trm,openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2),stripts(>=1.1.2),smartmontools
Depends: webif-channelicons(>=1.0.3),mongoose(>=3.0-7),jim(>=0.73-1),jim-oo,jim-sqlite3(>=0.73),jim-cgi(>=0.5),service-control(>=1.2),busybox(>=1.19.3-1),lsof,epg(>=1.0.9),hmt(>=1.1.7),ssmtp,anacron,trm,openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2),stripts(>=1.1.2),smartmontools
Suggests: ffmpeg
Description: An evolving web interface for the Humax.

View File

@ -67,8 +67,7 @@ puts {
<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="">
<input type=hidden name="renamefile" id="renamefile" value="">
<table border=0>
<tr>
<th>
@ -82,21 +81,46 @@ puts {
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">
<label for="rename_title" style="padding-top: 0.5em">
<b>New Medialist Title</b>
</label>
</th>
<td>
<input type=text name="renametitle" id="renametitle"
<input type=text name="rename_title" id="rename_title"
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>
<th>
<label for="rename_synopsis" style="padding-top: 0.5em">
<b>New Synopsis</b>
</label>
</th>
<td>
<textarea name="rename_synopsis" id="rename_synopsis"
value="" cols=70 rows=4
class="text ui-widget-content ui-corner-all"></textarea>
</td>
</tr>
<tr style="display: none" class=tstype>
<th>
<label for="rename_guidance" style="padding-top: 0.5em">
<b>New Guidance Text</b>
</label>
</th>
<td>
<input type=text name="rename_guidance" id="rename_guidance"
value="" size=70 maxlength=74
class="text ui-widget-content ui-corner-all">
</td>
</tr>
</table>
</form>
</div>

View File

@ -74,19 +74,16 @@ $('#paste').button()
function epginfo_callback(data, status, xhr)
{
var width = 85;
//console.log(status);
//console.dir(data);
if (status != 'success')
return;
//console.log(status);
//console.dir(data);
$('#rename_title').val(data.title);
$('#rename_synopsis').val(data.synopsis);
$('#rename_guidance').val(data.guidance);
$('#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');
}
@ -183,7 +180,7 @@ function new_callback(file, type, id)
function rename_submit()
{
var s = $('#renameform_form').serialize();
$.get('/cgi-bin/browse/rename.jim?' + s,
$.post('/cgi-bin/browse/rename.jim', s,
function() { window.location.reload(true); });
}
@ -394,11 +391,11 @@ var menuclick = function(action, el, pos)
case 'rename':
$('#rename').val(decodeURIComponent(bfile));
$('#renameorig').val(decodeURIComponent(file));
$('#renamefile').val(decodeURIComponent(file));
$('#titleorig').val('');
$('#renametitle').val('');
$('#synopsis').val('');
$('#rename_title').val('');
$('#rename_synopsis').val('');
$('#rename_guidance').val('');
$('tr.tstype').css('display', 'none');
if (type == 'ts')
@ -827,7 +824,7 @@ var dmenuclick = function(action, el, pos)
function checkstream()
{
$.get('/cgi-bin/streamsize.jim', function(size) {
console.log('Stream size: %o', size);
//console.log('Stream size: %o', size);
var mb = size / (1024 * 1024);
mb = mb|0;
if (streamsize && size > streamsize)

View File

@ -17,6 +17,7 @@ set ts [ts fetch $file]
puts "{"
puts "\"title\" : \"[$ts get title]\","
puts "\"synopsis\" : \"[$ts get synopsis]\""
puts "\"synopsis\" : \"[$ts get synopsis]\","
puts "\"guidance\" : \"[$ts get guidance]\""
puts "}"

View File

@ -10,43 +10,34 @@ puts ""
cgi_input
#cgi_dump
#renameorig
#titleorig
#rename
#renametitle
set file [cgi_get renamefile "-"]
if {$file eq "-"} exit
#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 ""
}
set newfile [string trim [cgi_get rename]]
set dir [file dirname $file]
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
foreach attr {title synopsis guidance} {
if {[catch {
set new [string trim [cgi_get "rename_$attr"]]
set old [$ts get $attr]
if {[string length $new] > 0 && $new ne $old} {
$ts set$attr $new
}
} msg]} {
puts "$attr: $msg"
}
}
if {$newfile ne ""} { ts renamegroup $file $newfile }
if {"$dir/$newfile.ts" ne "$file"} { ts renamegroup $file $newfile }
} else {
#puts "Normal file."
if {$newfile ne ""} { ts renamegroup $file $newfile }

View File

@ -76,7 +76,7 @@ proc do_shrink {ts} {
puts " Estimate $perc% saving."
puts " Shrinking..."
if {[catch {
puts [exec /mod/bin/stripts -fq $file $tmp/shrunk]
puts [exec /mod/bin/stripts -q $file $tmp/shrunk]
} msg]} {
puts "Error during shrink: $msg"
return

View File

@ -169,6 +169,18 @@ ts method settitle {newtitle} {
exec /mod/bin/hmt "+settitle=${newtitle}" $file
}
ts method setsynopsis {newsynopsis} {
if {[string length newsynopsis] > 48} { return }
exec /mod/bin/hmt "+setsynopsis=${newsynopsis}" $file
}
ts method setguidance {newguidance} {
if {[string length newguidance] > 48} { return }
exec /mod/bin/hmt "+setguidance=${newguidance}" $file
}
ts method dlnaloc {{urlbase 0}} {
set mime "video/ts"
if {![file exists $::dmsfile]} { return {} }