Expire lone .hmt files from failed recordings

This commit is contained in:
prpr 2023-01-23 14:18:09 +00:00
parent b63a268dac
commit d3d1755e98
2 changed files with 17 additions and 10 deletions

View File

@ -22,8 +22,13 @@ proc ::expire::directory {dir} {
set entries [lsort \
-command [lambda {a b} {upvar getter g; expr {[$g $a] - [$g $b]}}]\
[lmap i [readdir -nocomplain $dir] {
if {![string match {*.ts} $i]} continue
if {[catch {set ts [ts fetch "$dir/$i"]}]} continue
if {[string match {*.hmt} $i]} {
if {[file exists "[file rootname $i].ts"]} continue
if {[catch {set ts [ts parse "$dir/$i" [ts exec "$dir/$i"]]}]}\
continue
} elseif {[string match {*.ts} $i]} {
if {[catch {set ts [ts fetch "$dir/$i"]}]} continue
} else continue
if {$ts == 0} continue
list $ts
}]]
@ -43,13 +48,15 @@ proc ::expire::directory {dir} {
break
}
log " [file tail $file]"
if {[::auto::inuse $ts]} {
log " In use, skipping."
continue
}
if {$ax(keepnew) ne "0" && [$ts flag New]} {
log " Unwatched, skipping."
continue
if {[string match {*.ts} $file]} {
if {[::auto::inuse $ts]} {
log " In use, skipping."
continue
}
if {$ax(keepnew) ne "0" && [$ts flag New]} {
log " Unwatched, skipping."
continue
}
}
if {$ax(days) > 0} {
# Calculate age in days

View File

@ -271,7 +271,7 @@ proc {ts fetch} {file {checked 0}} {
ts method delete {} {
foreach f [$self fileset] {
file tdelete $f
puts "Removed $f<br>"
#puts "Removed $f<br>"
}
return 1
}