From d3d1755e988c8dc308ed0dc0c025dce6b66f54d4 Mon Sep 17 00:00:00 2001 From: prpr Date: Mon, 23 Jan 2023 14:18:09 +0000 Subject: [PATCH] Expire lone .hmt files from failed recordings --- webif/lib/auto/plugin/expire/auto.hook | 25 ++++++++++++++++--------- webif/lib/ts.class | 2 +- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/webif/lib/auto/plugin/expire/auto.hook b/webif/lib/auto/plugin/expire/auto.hook index 3645fd1..d4f69ed 100755 --- a/webif/lib/auto/plugin/expire/auto.hook +++ b/webif/lib/auto/plugin/expire/auto.hook @@ -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 diff --git a/webif/lib/ts.class b/webif/lib/ts.class index e60c103..0eb3357 100644 --- a/webif/lib/ts.class +++ b/webif/lib/ts.class @@ -271,7 +271,7 @@ proc {ts fetch} {file {checked 0}} { ts method delete {} { foreach f [$self fileset] { file tdelete $f - puts "Removed $f
" + #puts "Removed $f
" } return 1 }