From 1b3aad52d15d98b296fcadcaf20b1beca7641acd Mon Sep 17 00:00:00 2001 From: hummypkg Date: Sun, 12 Feb 2017 14:48:46 +0000 Subject: [PATCH] add autoskipbin. Improve bin directory derivation git-svn-id: file:///root/webif/svn/pkg/webif/trunk@3736 2a923420-c742-0410-a762-8d5b09965624 --- CONTROL/control | 2 +- webif/html/settings/modules/auto/init.hook | 2 ++ webif/html/settings/modules/auto/settings.hook | 4 ++++ webif/lib/auto/plugin/decrypt/queue.hook | 2 +- webif/lib/auto/plugin/shrink/queue.hook | 6 +++++- webif/lib/safe_delete | 3 +-- webif/lib/settings.class | 5 +++++ 7 files changed, 19 insertions(+), 5 deletions(-) diff --git a/CONTROL/control b/CONTROL/control index 64d0b48..080beed 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,7 +1,7 @@ Package: webif Priority: optional Section: web -Version: 1.4.0-7 +Version: 1.4.0-8 Architecture: mipsel Maintainer: af123@hpkg.tv Depends: tcpfix,webif-channelicons(>=1.1.25),lighttpd(>=1.4.39-1),jim(>=0.77),jim-oo(>=0.77),jim-sqlite3(>=0.76),jim-cgi(>=0.7-1),jim-binary(>=0.76),service-control(>=2.3),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.5),hmt(>=2.0.10),ssmtp,cron-daemon(>=1.18.3-3),at(>=3.1.18),anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.1.10),webif-charts(>=1.2-1),stripts(>=1.2.5-3),tmenu(>=1.21-2),ffmpeg,id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,recmon(>=2.0.7),hwctl,nugget(>=0.95),sqlite3(>=3.15.1) diff --git a/webif/html/settings/modules/auto/init.hook b/webif/html/settings/modules/auto/init.hook index 5c6709b..9f695ca 100644 --- a/webif/html/settings/modules/auto/init.hook +++ b/webif/html/settings/modules/auto/init.hook @@ -10,6 +10,7 @@ set noautohours [$settings noautohours] set autofreq [$settings autofreq] if {$autofreq == 0} { set autofreq 10 } set toolbarqueue [$settings toolbarqueue] +set autoskipbin [$settings autoskipbin] handle_int_update autolog $autolog "Auto-processing log level" handle_int_update noautorec $noautorec "Auto-processing during recording" @@ -20,4 +21,5 @@ handle_int_update autokeep $autokeep "Auto-processing queue period" 1 1 365 handle_int_update autofreq $autofreq "Auto-processing frequency" 1 5 60 handle_str_update noautohours $noautohours "Auto processing hours" ascii handle_int_update toolbarqueue $toolbarqueue "Toolbar queue icon" +handle_int_update autoskipbin $autoskipbin "Auto-processing dustbin" diff --git a/webif/html/settings/modules/auto/settings.hook b/webif/html/settings/modules/auto/settings.hook index c08bac5..706cf57 100755 --- a/webif/html/settings/modules/auto/settings.hook +++ b/webif/html/settings/modules/auto/settings.hook @@ -82,6 +82,10 @@ setting_number autokeep \ 1 365 setting_toggle "Show queue icon in menu/toolbar?" "toolbarqueue" $toolbarqueue +if {[system pkginst undelete]} { + setting_toggle "Create backup files in dustbin for decrypt and shrink?" autoskipbin \ + $(!$autoskipbin) 1 +} puts { diff --git a/webif/lib/auto/plugin/decrypt/queue.hook b/webif/lib/auto/plugin/decrypt/queue.hook index 63a2577..ee61cbf 100644 --- a/webif/lib/auto/plugin/decrypt/queue.hook +++ b/webif/lib/auto/plugin/decrypt/queue.hook @@ -139,7 +139,7 @@ proc ::decrypt::dequeue {q ts} { log " Removing/binning old copy." 0 # Move the old recording to the bin if undelete is installed. - if {$::auto::dustbin ne ""} { + if {![$::auto::settings autoskipbin] && $::auto::dustbin ne ""} { log " finding bin for $file" 0 set bin [_del_bindir $file "webif_autodecrypt"] log " bin = ($bin)" 0 diff --git a/webif/lib/auto/plugin/shrink/queue.hook b/webif/lib/auto/plugin/shrink/queue.hook index 972a58a..c73e9fa 100644 --- a/webif/lib/auto/plugin/shrink/queue.hook +++ b/webif/lib/auto/plugin/shrink/queue.hook @@ -79,7 +79,11 @@ proc ::shrink::dequeue {q ts} { } # Remove the old recording (-> bin if undelete is installed) - safe_delete [$ts get file] "webif_autoshrink" + if {[$::auto::settings autoskipbin]} { + $ts delete + } else { + safe_delete [$ts get file] "webif_autoshrink" + } # Finally, rename the shrunken recording again. foreach ext $tsgroup { diff --git a/webif/lib/safe_delete b/webif/lib/safe_delete index 267d498..3e096ee 100755 --- a/webif/lib/safe_delete +++ b/webif/lib/safe_delete @@ -14,8 +14,7 @@ if {![exists -proc _del_bindir]} { global _del_dustbin set lbin $_del_dustbin if {$prefix ne ""} { append lbin "/$prefix" } - set dir [file dirname $file] - regsub "^[system mediaroot]" $dir $lbin ndir + set dir [file normalize [file dirname $file]] regsub "^[file normalize [system mediaroot]]" $dir $lbin ndir if {$dir eq $ndir} { set ndir $lbin } system mkdir_p $ndir diff --git a/webif/lib/settings.class b/webif/lib/settings.class index 85c2abe..f50afe5 100644 --- a/webif/lib/settings.class +++ b/webif/lib/settings.class @@ -40,6 +40,7 @@ class settings { noautorecimm 0 autorecperiod 10 autokeep 7 + autoskipbin 0 noautohours "" autofreq 20 autolast 0 @@ -254,6 +255,10 @@ settings method autokeep {{val -1}} { return [$self _nval_setting autokeep $val] } +settings method autoskipbin {{val -1}} { + return [$self _nval_setting autoskipbin $val] +} + settings method autofreq {{val -1}} { return [$self _nval_setting autofreq $val] }