From 775add8c0420c49da1ea89fb53dc7e724ec5e3a9 Mon Sep 17 00:00:00 2001 From: hummypkg Date: Sun, 18 Nov 2012 12:07:53 +0000 Subject: [PATCH] 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 --- CONTROL/control | 4 +-- var/mongoose/cgi-bin/browse/assets.jim | 34 ++++++++++++++++++--- var/mongoose/cgi-bin/browse/browse.js | 25 +++++++-------- var/mongoose/cgi-bin/browse/epgtitle.jim | 3 +- var/mongoose/cgi-bin/browse/rename.jim | 39 +++++++++--------------- var/mongoose/lib/bin/auto | 2 +- var/mongoose/lib/ts.class | 12 ++++++++ 7 files changed, 72 insertions(+), 47 deletions(-) diff --git a/CONTROL/control b/CONTROL/control index edd8b50..fa3ba34 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -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. diff --git a/var/mongoose/cgi-bin/browse/assets.jim b/var/mongoose/cgi-bin/browse/assets.jim index 6fff7ce..21ecf95 100755 --- a/var/mongoose/cgi-bin/browse/assets.jim +++ b/var/mongoose/cgi-bin/browse/assets.jim @@ -67,8 +67,7 @@ puts { diff --git a/var/mongoose/cgi-bin/browse/browse.js b/var/mongoose/cgi-bin/browse/browse.js index 0882dda..a4efbea 100755 --- a/var/mongoose/cgi-bin/browse/browse.js +++ b/var/mongoose/cgi-bin/browse/browse.js @@ -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) diff --git a/var/mongoose/cgi-bin/browse/epgtitle.jim b/var/mongoose/cgi-bin/browse/epgtitle.jim index cc5d642..e4fdadd 100755 --- a/var/mongoose/cgi-bin/browse/epgtitle.jim +++ b/var/mongoose/cgi-bin/browse/epgtitle.jim @@ -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 "}" diff --git a/var/mongoose/cgi-bin/browse/rename.jim b/var/mongoose/cgi-bin/browse/rename.jim index d05be4d..868a3d3 100755 --- a/var/mongoose/cgi-bin/browse/rename.jim +++ b/var/mongoose/cgi-bin/browse/rename.jim @@ -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 } diff --git a/var/mongoose/lib/bin/auto b/var/mongoose/lib/bin/auto index 022c710..ddcd6a7 100755 --- a/var/mongoose/lib/bin/auto +++ b/var/mongoose/lib/bin/auto @@ -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 diff --git a/var/mongoose/lib/ts.class b/var/mongoose/lib/ts.class index 24cc809..66c074e 100644 --- a/var/mongoose/lib/ts.class +++ b/var/mongoose/lib/ts.class @@ -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 {} }