From 7477fe1956e6057f6492bb8aff275e78d1022bd8 Mon Sep 17 00:00:00 2001 From: HummyPkg Date: Sun, 11 Feb 2018 13:46:00 +0000 Subject: [PATCH] Fix notify log display (from prpr) --- CONTROL/control | 2 +- webif/include/notify.jim | 18 +++++++----------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/CONTROL/control b/CONTROL/control index 223194c..a79faf7 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,7 +1,7 @@ Package: webif Priority: optional Section: web -Version: 1.4.2-11 +Version: 1.4.2-12 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.77),jim-cgi(>=0.7-1),jim-binary(>=0.76),service-control(>=2.3),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.8),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.11),webif-charts(>=1.2-1),stripts(>=1.3.1),tmenu(>=1.21-2),ffmpeg(>=2.8),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),jim-xconv diff --git a/webif/include/notify.jim b/webif/include/notify.jim index 376985f..300f7c1 100755 --- a/webif/include/notify.jim +++ b/webif/include/notify.jim @@ -16,23 +16,19 @@ You have pending system notifications: set lines {} set seen {} +set i 0 foreach line [split [file read /mod/tmp/notify.log] "\n"] { - set rest [lassign [split $line -] date] + set rest [join [lassign [split $line -] date] -] if {$rest eq ""} { set rest $date } - if {[dict exists $seen $rest]} { - incr seen($rest) - } else { - set seen($rest) 1 - } - set lines($rest) "$line" - set mul $seen($rest) + set mul [incr seen($rest)] if {$mul > 1} { - append lines($rest) " ($mul instances)" + append line " ($mul instances)" } + set lines($rest) [list [incr i] $line] } -foreach {line msg} $lines { - puts $msg +foreach line [lsort -integer -index 0 [dict values $lines]] { + puts [lindex $line 1] } puts {