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 Package: webif
Priority: optional Priority: optional
Section: web Section: web
Version: 0.10.0-4 Version: 0.10.1
Architecture: mipsel Architecture: mipsel
Maintainer: af123@hummypkg.org.uk 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 Suggests: ffmpeg
Description: An evolving web interface for the Humax. 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"> <div id=renameform title="Rename media file" style="display: none">
<form id=renameform_form> <form id=renameform_form>
<input type=hidden name="renameorig" id="renameorig" value=""> <input type=hidden name="renamefile" id="renamefile" value="">
<input type=hidden name="titleorig" id="titleorig" value="">
<table border=0> <table border=0>
<tr> <tr>
<th> <th>
@ -82,21 +81,46 @@ puts {
class="text ui-widget-content ui-corner-all"> class="text ui-widget-content ui-corner-all">
</td> </td>
</tr> </tr>
<tr style="display: none" class=tstype> <tr style="display: none" class=tstype>
<th> <th>
<label for="renametitle" style="padding-top: 0.5em"> <label for="rename_title" style="padding-top: 0.5em">
<b>New Medialist Title</b> <b>New Medialist Title</b>
</label> </label>
</th> </th>
<td> <td>
<input type=text name="renametitle" id="renametitle" <input type=text name="rename_title" id="rename_title"
value="" size=70 maxlength=48 value="" size=70 maxlength=48
class="text ui-widget-content ui-corner-all"> class="text ui-widget-content ui-corner-all">
</td> </td>
</tr> </tr>
<tr style="display: none" class=tstype> <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>
<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> </table>
</form> </form>
</div> </div>

View File

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

View File

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

View File

@ -10,43 +10,34 @@ puts ""
cgi_input cgi_input
#cgi_dump #cgi_dump
#renameorig set file [cgi_get renamefile "-"]
#titleorig if {$file eq "-"} exit
#rename
#renametitle
#set _cgi(renameorig) "/media/My Video/The Walking Dead/The Walking Dead_20110521_2201.ts" set newfile [string trim [cgi_get rename]]
#set _cgi(rename) "Last Episode" set dir [file dirname $file]
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]} { if {[file isdirectory $file]} {
#puts "Directory." #puts "Directory."
if {$newfile ne ""} { if {$newfile ne ""} {
set dir [file dirname $file]
set newfile "${dir}/${newfile}" set newfile "${dir}/${newfile}"
file rename $file $newfile file rename $file $newfile
} }
} elseif {[set ts [ts fetch $file]] != 0} { } elseif {[set ts [ts fetch $file]] != 0} {
#puts "TS file." #puts "TS file."
catch { foreach attr {title synopsis guidance} {
set title [dict get $_cgi renametitle] if {[catch {
set titleorig [dict get $_cgi titleorig] set new [string trim [cgi_get "rename_$attr"]]
set old [$ts get $attr]
if {[string length [string trim $title]] > 0 && if {[string length $new] > 0 && $new ne $old} {
$title ne $titleorig} { $ts set$attr $new
$ts settitle $title }
} msg]} {
puts "$attr: $msg"
} }
} }
if {$newfile ne ""} { ts renamegroup $file $newfile }
if {"$dir/$newfile.ts" ne "$file"} { ts renamegroup $file $newfile }
} else { } else {
#puts "Normal file." #puts "Normal file."
if {$newfile ne ""} { ts renamegroup $file $newfile } if {$newfile ne ""} { ts renamegroup $file $newfile }

View File

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

View File

@ -169,6 +169,18 @@ ts method settitle {newtitle} {
exec /mod/bin/hmt "+settitle=${newtitle}" $file 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}} { ts method dlnaloc {{urlbase 0}} {
set mime "video/ts" set mime "video/ts"
if {![file exists $::dmsfile]} { return {} } if {![file exists $::dmsfile]} { return {} }