prpr
Well-Known Member
af123
There are a couple of horrid bugs in the notification log processing which causes it to display lines out of order (primarily because Jim arrays are not sequenced or sorted - they are just random), or missing altogether because they have a '-' in the name or elsewhere on the log line.
For example, this in /mod/tmp/notify.log:
turns into this:
Here is a fix:
There are a couple of horrid bugs in the notification log processing which causes it to display lines out of order (primarily because Jim arrays are not sequenced or sorted - they are just random), or missing altogether because they have a '-' in the name or elsewhere on the log line.
For example, this in /mod/tmp/notify.log:
Code:
12/01/2018 02:05:04 - Automatically upgraded package multimode from 1.0.1 to 1.0.2
12/01/2018 02:05:05 - Automatically upgraded package boot-settings from 1.0.2 to 1.0.3 (Update settings)<br><a href="https://hummy.tv/forum/threads/7678/">https://hummy.tv/forum/threads/7678/</a>
12/01/2018 02:05:05 - Automatically upgraded package tunefix-update from 1.0.32 to 1.0.33
Your Humax crashed and some packages may have been disabled as a precaution.
... view the crash.log for more details.
02/02/2018 01:31:09 - Automatically upgraded package boot-settings from 1.0.3 to 1.0.4 (Update settings)<br><a href="https://hummy.tv/forum/threads/7678/">https://hummy.tv/forum/threads/7678/</a>
02/02/2018 01:31:57 - Automatically upgraded package sweeper from 2.1.5-9 to 2.1.5-10 (Add %bfolder token)<br><a href="http://hummy.tv/forum/threads/5138/">http://hummy.tv/forum/threads/5138/</a>
02/02/2018 01:31:58 - Automatically upgraded package tunefix from 1.6.6 to 1.6.7
02/02/2018 01:31:58 - Automatically upgraded package epg from 1.2.7 to 1.2.8 (Fix disappearing EPG)
02/02/2018 01:31:58 - Automatically upgraded package webif from 1.4.2-8 to 1.4.2-10<br><a href="https://hummy.tv/forum/threads/7712/">https://hummy.tv/forum/threads/7712/</a>
Code:
02/02/2018 01:31:09 - Automatically upgraded package boot-settings from 1.0.3 to 1.0.4 (Update settings)<br><a href="https://hummy.tv/forum/threads/7678/">https://hummy.tv/forum/threads/7678/</a>
02/02/2018 01:31:58 - Automatically upgraded package epg from 1.2.7 to 1.2.8 (Fix disappearing EPG)
Your Humax crashed and some packages may have been disabled as a precaution.
... view the crash.log for more details.
12/01/2018 02:05:04 - Automatically upgraded package multimode from 1.0.1 to 1.0.2
02/02/2018 01:31:58 - Automatically upgraded package tunefix from 1.6.6 to 1.6.7
12/01/2018 02:05:05 - Automatically upgraded package boot-settings from 1.0.2 to 1.0.3 (Update settings)<br><a href="https://hummy.tv/forum/threads/7678/">https://hummy.tv/forum/threads/7678/</a>
12/01/2018 02:05:05 - Automatically upgraded package tunefix-update from 1.0.32 to 1.0.33
02/02/2018 01:31:58 - Automatically upgraded package webif from 1.4.2-8 to 1.4.2-10<br><a href="https://hummy.tv/forum/threads/7712/">https://hummy.tv/forum/threads/7712/</a>
02/02/2018 01:31:57 - Automatically upgraded package sweeper from 2.1.5-9 to 2.1.5-10 (Add %bfolder token)<br><a href="http://hummy.tv/forum/threads/5138/">http://hummy.tv/forum/threads/5138/</a>
Code:
humax /mnt/hd2/mod/webif/include # diff notify.jim~ notify.jim
--- notify.jim~
+++ notify.jim
@@ -16,23 +16,29 @@
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)
if {$mul > 1} {
- append lines($rest) " ($mul instances)"
+ append line " ($mul instances)"
}
+ incr i
+ set lines($rest) [list $i "$line"]
}
-foreach {line msg} $lines {
- puts $msg
+foreach {k v} $lines {
+ lappend logs $v
+}
+set logs [lsort -integer -index 0 $logs]
+foreach line $logs {
+ puts [lindex $line 1]
}
puts {
Last edited: