From 509c98ee74cad4ab393fad372e8ea5c265cfa331 Mon Sep 17 00:00:00 2001 From: hummypkg Date: Wed, 14 Dec 2011 13:55:58 +0000 Subject: [PATCH] update git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@564 2a923420-c742-0410-a762-8d5b09965624 --- CONTROL/control | 4 +-- var/mongoose/cgi-bin/browse.jim | 6 ++-- var/mongoose/cgi-bin/browse/audio.jim | 13 ++++++-- var/mongoose/cgi-bin/browse/browse.js | 46 +++++++++++++-------------- var/mongoose/lib/escape | 8 +++++ 5 files changed, 47 insertions(+), 30 deletions(-) create mode 100644 var/mongoose/lib/escape diff --git a/CONTROL/control b/CONTROL/control index 745d0c2..6207c57 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,9 +1,9 @@ Package: webif Priority: optional Section: web -Version: 0.8.6-2 +Version: 0.8.7 Architecture: mipsel Maintainer: af123@hummypkg.org.uk Depends: mongoose(>=3.0-2),jim(>=0.71-1),jim-sqlite3(>=0.71-1),jim-cgi(>=0.4-1),jim-oo,jim-pack,service-control,busybox(>=1.19.3-1),lsof,epg(>=1.0.8),hmt(>=1.1.2),ssmtp,anacron -Suggests: ffmpeg,webif-iphone,nicesplice +Suggests: ffmpeg,webif-iphone,nicesplice,id3v2 Description: An evolving web interface for the Humax. diff --git a/var/mongoose/cgi-bin/browse.jim b/var/mongoose/cgi-bin/browse.jim index 6da354b..30b9c9c 100755 --- a/var/mongoose/cgi-bin/browse.jim +++ b/var/mongoose/cgi-bin/browse.jim @@ -2,7 +2,7 @@ package require cgi source /mod/var/mongoose/lib/setup -require ts.class pretty_size system.class settings.class +require ts.class pretty_size system.class settings.class escape puts "Content-Type: text/html" puts "" @@ -40,7 +40,7 @@ proc directory {file bfile} { puts "" puts "" + file=\"[cgi_quote_url $file]\">" puts "$bfile " @@ -117,7 +117,7 @@ proc entry {file} {{i 0}} {
- + $bfile " diff --git a/var/mongoose/cgi-bin/browse/audio.jim b/var/mongoose/cgi-bin/browse/audio.jim index 199a699..959164e 100755 --- a/var/mongoose/cgi-bin/browse/audio.jim +++ b/var/mongoose/cgi-bin/browse/audio.jim @@ -3,7 +3,7 @@ package require sqlite3 package require cgi source /mod/var/mongoose/lib/setup -require ts.class +require ts.class system.class puts "Content-Type: text/html\r\n\r\n" @@ -23,9 +23,18 @@ if {[cgi_get do] eq "it"} { puts "Processing $shname" puts [exec /mod/bin/ffmpeg -y -benchmark -v 0 \ - -i $rfile -f mp2 \ + -i $rfile -f mp3 \ -vn -acodec copy "${base}.mp3"] + if {[system pkginst id3v2]} { + puts [exec /mod/bin/id3v2 \ + --song "[$ts get title]" \ + --comment "[$ts get synopsis]" \ + --album "[$ts get channel_name]" \ + --year "[clock format [$ts get start] -format {%Y}]" \ + "${base}.mp3"] + } + set xtime [expr [expr [clock milliseconds] - $xstart] / 1000.0] puts "Time taken: $xtime" diff --git a/var/mongoose/cgi-bin/browse/browse.js b/var/mongoose/cgi-bin/browse/browse.js index 5044b1c..ff54321 100755 --- a/var/mongoose/cgi-bin/browse/browse.js +++ b/var/mongoose/cgi-bin/browse/browse.js @@ -79,8 +79,8 @@ 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; + var url = '/cgi-bin/browse/delete.jim?file=' + file + + '&type=' + type; $(results) .html('Deleting, please wait...') .slideDown('slow') @@ -93,19 +93,19 @@ function delete_callback(file, type, id) function lock_callback(file, type, id) { - var url = '/cgi-bin/browse/lock.jim?file=' + encodeURIComponent(file); + var url = '/cgi-bin/browse/lock.jim?file=' + file; $.get(url, function() { window.location.reload(true); }); } function enc_callback(file, type, id) { - var url = '/cgi-bin/browse/enc.jim?file=' + encodeURIComponent(file); + var url = '/cgi-bin/browse/enc.jim?file=' + file; $.get(url, function() { window.location.reload(true); }); } function new_callback(file, type, id) { - var url = '/cgi-bin/browse/new.jim?file=' + encodeURIComponent(file); + var url = '/cgi-bin/browse/new.jim?file=' + file; $.get(url, function() { window.location.reload(true); }); } @@ -148,7 +148,7 @@ function confirm_action(action, callback, file, type, id) }); $('#confirm').empty().html( 'Are you sure you wish to ' + action + '
' + - '' + bfile + ' ?' + '' + decodeURIComponent(bfile) + ' ?' ); $confirm.dialog('open'); } @@ -261,8 +261,8 @@ var menuclick = function(action, el, pos) break; case 'rename': - $('#rename').val(bfile); - $('#renameorig').val(file); + $('#rename').val(decodeURIComponent(bfile)); + $('#renameorig').val(decodeURIComponent(file)); $('#titleorig').val(''); $('#renametitle').val(''); @@ -272,7 +272,7 @@ var menuclick = function(action, el, pos) if (type == 'ts') { $.getJSON('/cgi-bin/browse/epgtitle.jim?file=' + - encodeURIComponent(file), epginfo_callback); + file, epginfo_callback); } $('#renameform').dialog('open'); @@ -280,22 +280,22 @@ var menuclick = function(action, el, pos) case 'download': window.location.href = '/cgi-bin/browse/download.jim?file=' + - encodeURIComponent(file); + file; break; case 'crop': window.location.href = '/cgi-bin/browse/crop.jim?file=' + - encodeURIComponent(file); + file; break; case 'decrypt': window.location.href = '/cgi-bin/browse/decrypt.jim?file=' + - encodeURIComponent(file); + file; break; case 'audio': window.location.href = '/cgi-bin/browse/audio.jim?file=' + - encodeURIComponent(file); + file; break; default: @@ -315,10 +315,11 @@ var dmenuclick = function(action, el, pos) switch (action) { case 'delete': - var url = '/cgi-bin/browse/delete.jim?file=' + - encodeURIComponent(file) + '&type=dir'; + var url = '/cgi-bin/browse/delete.jim?file=' + file + + '&type=dir'; - if (confirm('Are you sure you wish to delete "' + file + + if (confirm('Are you sure you wish to delete "' + + decodeURIComponent(file) + '" and all files within it?')) { $(results) @@ -334,14 +335,13 @@ var dmenuclick = function(action, el, pos) break; case 'rename': - $('#drename').val(bfile); - $('#drenameorig').val(file); + $('#drename').val(decodeURIComponent(bfile)); + $('#drenameorig').val(decodeURIComponent(file)); $('#drenameform').dialog('open'); break; case 'flat': - var url = '/cgi-bin/browse/flat.jim?file=' + - encodeURIComponent(file); + var url = '/cgi-bin/browse/flat.jim?file=' + file; $.get(url, function() { window.location.reload(true); }); break; @@ -394,8 +394,8 @@ var dmenuclick = function(action, el, pos) e.preventDefault(); var file = $(this).attr('file'); var type = $(this).attr('type'); - var url = '/cgi-bin/browse/file.jim?file=' + - encodeURIComponent(file) + '&type=' + type; + var url = '/cgi-bin/browse/file.jim?file=' + file + + '&type=' + type; $('#dialogue').load(url); $dialog.dialog('open'); }); @@ -499,7 +499,7 @@ var dmenuclick = function(action, el, pos) .click(function() { var files = new Array(); var els = $('input.fs:checked + a').each(function() { - files.push(encodeURIComponent($(this).attr('file'))); + files.push($(this).attr('file')); }); //console.log("%o", files); var str = 'Are you sure you want to delete ' + files.length + diff --git a/var/mongoose/lib/escape b/var/mongoose/lib/escape new file mode 100644 index 0000000..1ba6dc2 --- /dev/null +++ b/var/mongoose/lib/escape @@ -0,0 +1,8 @@ + +if {[expr ! [exists -proc escape]]} { + proc escape {str} { + regsub -all -- {"} "$str" "\\\"" str + return $str + } +} +