add ts iterate
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1833 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
parent
e0ac834c78
commit
5f473c9e72
@ -1,7 +1,7 @@
|
|||||||
Package: webif
|
Package: webif
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: web
|
Section: web
|
||||||
Version: 1.0.10-5
|
Version: 1.0.10-6
|
||||||
Architecture: mipsel
|
Architecture: mipsel
|
||||||
Maintainer: af123@hummypkg.org.uk
|
Maintainer: af123@hummypkg.org.uk
|
||||||
Depends: webif-channelicons(>=1.1.10),mongoose(>=3.0.11),jim(>=0.75-1),jim-oo,jim-sqlite3(>=0.75),jim-cgi(>=0.7),jim-binary(>=0.75),service-control(>=1.2),busybox(>=1.20.2-1),lsof,epg(>=1.0.13),hmt(>=1.1.14),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2),stripts(>=1.2.5-3),smartmontools,tmenu(>=1.05),ffmpeg,id3v2,multienv(>=1.6)
|
Depends: webif-channelicons(>=1.1.10),mongoose(>=3.0.11),jim(>=0.75-1),jim-oo,jim-sqlite3(>=0.75),jim-cgi(>=0.7),jim-binary(>=0.75),service-control(>=1.2),busybox(>=1.20.2-1),lsof,epg(>=1.0.13),hmt(>=1.1.14),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2),stripts(>=1.2.5-3),smartmontools,tmenu(>=1.05),ffmpeg,id3v2,multienv(>=1.6)
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
source /mod/webif/lib/setup
|
source /mod/webif/lib/setup
|
||||||
require system.class ts.class
|
require system.class ts.class
|
||||||
|
|
||||||
proc do_shrink {ts} {
|
ts iterate [lambda {ts} {
|
||||||
|
#puts " [$ts get file]"
|
||||||
if {[$ts flag "Shrunk"]} { return }
|
if {[$ts flag "Shrunk"]} { return }
|
||||||
|
|
||||||
set file [file rootname [$ts get file]]
|
set file [file rootname [$ts get file]]
|
||||||
@ -26,34 +27,5 @@ proc do_shrink {ts} {
|
|||||||
puts " Flagging $file as shrunk..."
|
puts " Flagging $file as shrunk..."
|
||||||
$ts set_shrunk
|
$ts set_shrunk
|
||||||
}
|
}
|
||||||
}
|
}] 1
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
|
@ -392,3 +392,28 @@ proc {ts resetnew} {dir} {
|
|||||||
close $fd
|
close $fd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
proc {ts iterate} {callback {verbose 0} {dir ""}} {{rootdev 0}} {
|
||||||
|
require system.class
|
||||||
|
if {$dir eq ""} {
|
||||||
|
set dir [system mediaroot]
|
||||||
|
file stat "$dir/" rootstat
|
||||||
|
set rootdev $rootstat(dev)
|
||||||
|
}
|
||||||
|
|
||||||
|
if {$verbose} { puts "Scanning directory ($dir)" }
|
||||||
|
|
||||||
|
file stat "$dir/" st
|
||||||
|
if {$st(dev) != $rootdev} return
|
||||||
|
|
||||||
|
foreach entry [readdir -nocomplain $dir] {
|
||||||
|
if {[file isdirectory "$dir/$entry"]} {
|
||||||
|
ts iterate $callback $verbose "$dir/$entry"
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if {![string match {*.ts} $entry]} continue
|
||||||
|
if {[catch {set ts [ts fetch "$dir/$entry"]}]} continue
|
||||||
|
if {$ts == 0} continue
|
||||||
|
$callback $ts
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user