git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1436 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2013-03-05 00:10:38 +00:00
parent 2f570f6ea0
commit 070fd7a749
9 changed files with 126 additions and 36 deletions

View File

@ -1,7 +1,7 @@
Package: webif
Priority: optional
Section: web
Version: 0.13.1
Version: 0.13.2
Architecture: mipsel
Maintainer: af123@hummypkg.org.uk
Depends: webif-channelicons(>=1.0.4-1),mongoose(>=3.0-7),jim(>=0.73-1),jim-oo,jim-sqlite3(>=0.73-1),jim-cgi(>=0.7),jim-binary,service-control(>=1.2),busybox(>=1.20.2-1),lsof,epg(>=1.0.10),hmt(>=1.1.13),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2),stripts(>=1.1.2),smartmontools,tmenu(>=1.05)

View File

@ -1,5 +1,7 @@
#!/bin/sh
echo "Postinstall $*"
export tmpf=/tmp/cronf.$$
# Add cron jobs
@ -27,5 +29,14 @@ $PKG_ROOT/etc/init.d/S02anacron start < /dev/null > /dev/null 2>&1 &
[ -f /tmp/webif_auto.log ] && rm -f /tmp/webif_auto.log
if [ ! -f /mod/webif/.strip-updated ]; then
echo "*********************************"
echo "* Please wait while any shrunk recordings are flagged..."
echo "*********************************"
/mod/webif/lib/bin/strip-update
touch /mod/webif/.strip-updated
fi
exit 0

View File

@ -63,7 +63,10 @@ if {[llength $data]} {
foreach name [array names ndata] {
if {![dict exists $seen $name]} { set seen($name) 0 }
if {![dict exists $data $name]} { set data($name) 0 }
if {$ndata($name) == -1} {
if {[file exists "/mod/tmp/webif_auto/decrypting.$name.ts"]} {
set mode "Decrypting"
set icon "178_1_00_Icon_Lock.png style=\"padding: 0 0.2em 0 0.5em\""
} elseif {$ndata($name) == -1} {
incr rec
incr play
set mode "Chase Playing"

View File

@ -152,6 +152,7 @@ proc entry {file} {{i 0}} {
set def unknown
set bx 0
set dlna 0
set shrunk 0
if {$type eq "ts"} {
set genre [$ts get genre]
set glist [ts genrelist]
@ -204,12 +205,11 @@ proc entry {file} {{i 0}} {
set dlna 1
}
# Shrunk (shown when necessary via Ajax)
icon "/img/compress.png" "Shrunk" \
"id=\"sp_$tbfile\"" "va hidden"
# Timeshifted (shown when necessary via Ajax)
# icon "/img/clock.png" "Time-shifted Recording" \
# "id=\"tsr_$tbfile\"" "va hidden"
# Shrunk
if {[$ts flag Shrunk]} {
icon "/img/compress.png" "Shrunk"
set shrunk 1
}
set bx [$ts get bookmarks]
}
@ -220,7 +220,7 @@ proc entry {file} {{i 0}} {
<a href=#>
<img class=\"$omenu va\" border=0 width=45 type=$type did=$i
locked=$locked encd=$encd def=$def new=$new bx=$bx
rsize=$rsz
shrunk=$shrunk rsize=$rsz
odencd=$odencd dlna=$dlna
src=/images/181_1_00_Help5_OPT_Plus.png>
</a>

View File

@ -125,23 +125,23 @@ function new_folder_callback(data, status, xhr)
$.each(data, set_folder_new);
}
function insert_shrunk(file, perc)
{
if (perc == 0)
{
file = file.replace(/[ ]/g, '');
file = file.replace(/([ #;&,.+*~\':"!^$[\]()=>|\/@])/g, '\\$1');
//console.log("File: (%s) = (%s)", file, perc);
$('#sp_' + file).show();
}
}
//function insert_shrunk(file, perc)
//{
// if (perc == 0)
// {
// file = file.replace(/[ ]/g, '');
// file = file.replace(/([ #;&,.+*~\':"!^$[\]()=>|\/@])/g, '\\$1');
// //console.log("File: (%s) = (%s)", file, perc);
// $('#sp_' + file).show();
// }
//}
function shrunk_callback(data, status, xhr)
{
//console.log("Status: %s", status);
//console.dir(data);
$.each(data, insert_shrunk);
}
//function shrunk_callback(data, status, xhr)
//{
// //console.log("Status: %s", status);
// //console.dir(data);
// $.each(data, insert_shrunk);
//}
function delete_callback(file, dir, id)
{
@ -364,7 +364,6 @@ function preparedmenu(el, menu)
$(document).ready(function() {
dir = $('#dir').text();
mediaroot = $('#mediaroot').text();
var menuclick = function(action, el, pos)
{
@ -757,8 +756,8 @@ var dmenuclick = function(action, el, pos)
folder_size_callback);
// Flag shrunk recordings
$.getJSON('/browse/shrunk.jim?dir=' + encodeURIComponent(dir),
shrunk_callback);
// $.getJSON('/browse/shrunk.jim?dir=' + encodeURIComponent(dir),
// shrunk_callback);
// Flag folders with unwatched items
$.getJSON('/browse/newdir.jim?dir=' + encodeURIComponent(dir),

View File

@ -2,18 +2,29 @@
package require cgi
source /mod/webif/lib/setup
require ts.class
httpheader "application/json"
set dir [cgi_get dir "/media/My Video/Children"]
set dir [cgi_get dir "-"]
if {$dir eq "-"} exit
puts "{"
foreach file [readdir -nocomplain $dir] {
if {![string match {*.ts} $file]} { continue }
set xfile [file rootname $file]
if {[catch {set eit [exec /mod/bin/stripts -cq "$dir/$xfile"]}]} {
continue
if {[catch {set ts [ts fetch "$dir/$file"]}]} continue
set eit 1
if {[$ts flag "Shrunk"]} { set eit 0 }
if {$eit} {
set xfile [file rootname $file]
if {[catch {set eit [\
exec /mod/bin/stripts -cq "$dir/$xfile"]}]} {
continue
}
if {!$eit} { $ts set_shrunk }
}
puts " \"$file\": $eit,"

View File

@ -43,6 +43,7 @@ set newname "$shname-[clock seconds]"
puts "Renaming file group to $newname"
ts renamegroup "$dir/$shname.ts" $newname
exec /mod/bin/hmt "+setfilename=$newname" "$dir/$newname.hmt"
exec /mod/bin/hmt "+shrunk" "$dir/$newname.hmt"
set striptime [expr [expr [clock milliseconds] - $stripstart] / 1000.0]
puts "Time taken: $striptime"

View File

@ -134,6 +134,12 @@ proc do_shrink {ts} {
}
set file [file rootname [$ts get file]]
if {[$ts inuse]} {
log " $file - in use." 1
return
}
if {[catch {
set perc [exec /mod/bin/stripts -aq $file]
} msg]} {
@ -151,10 +157,6 @@ proc do_shrink {ts} {
$ts set_shrunk
return
}
if {[$ts inuse]} {
log " In use." 1
return
}
set size [$ts size]
dsc $size
startclock
@ -227,6 +229,8 @@ proc do_decrypt {ts} {
}
set size [$ts size]
dsc $size
set flagfile "$tmp/decrypting.$bfile"
exec /mod/bin/busybox/touch $flagfile
startclock
log " DECRYPT: $rfile" 1
log " DLNA: $url" 1
@ -234,6 +238,7 @@ proc do_decrypt {ts} {
if {[file size $file] != [file size "$tmp/$bfile"]} {
log " File size mismatch." 1
file delete $flagfile
return
}
@ -264,6 +269,7 @@ proc do_decrypt {ts} {
tdelete "$rfile.encrypted"
}
log "Done... [endclock $size]" 1
file delete $flagfile
}
proc do_mpg {ts} {

View File

@ -0,0 +1,59 @@
#!/mod/bin/jimsh
source /mod/webif/lib/setup
require system.class ts.class
proc do_shrink {ts} {
if {[$ts flag "Shrunk"]} { return }
set file [file rootname [$ts get file]]
if {[$ts inuse]} { return }
if {[catch {
set perc [exec /mod/bin/stripts -aq $file]
} msg]} {
return
}
if {[string match {*%} $perc]} {
set perc [string range $perc 0 end-1]
} else {
set perc 0
}
if {$perc == 0} {
puts " Flagging $file as shrunk..."
$ts set_shrunk
}
}
proc entries {dir callback} {
foreach entry [readdir -nocomplain $dir] {
if {![string match {*.ts} $entry} continue
if {[catch {set ts [ts fetch "$dir/$entry"]}]} continue
if {$ts == 0} continue
$callback $ts
}
}
proc scan {dir} {
puts "Scanning $dir..."
file stat "$dir/" st
if {$st(dev) != $::rootdev} { return }
entries $dir do_shrink
foreach entry [readdir -nocomplain $dir] {
if {[file isdirectory "$dir/$entry"]} {
scan "$dir/$entry"
}
}
}
set root [system mediaroot]
file stat "$root/" rootstat
set rootdev $rootstat(dev)
scan $root