summaryrefslogtreecommitdiff
path: root/doPlayback.go
diff options
context:
space:
mode:
authorCastor Gemini <[email protected]>2025-08-22 02:29:39 -0500
committerJeff Carr <[email protected]>2025-08-22 02:29:39 -0500
commit3d6f228b6e14d87795edf6bc0a8ec8930f34929f (patch)
treeb337f4f1a00551ea2dcade3d3b5fb8b9156644b7 /doPlayback.go
parent043386b95b7b6d44c98a47e40520626ce590d852 (diff)
feat(playback): Change playback to a concise summary view
- The 'playback' command now prints a one-line summary for each chat topic. - The summary includes the topic name, the number of entries, and the start time of the conversation.
Diffstat (limited to 'doPlayback.go')
-rw-r--r--doPlayback.go29
1 files changed, 27 insertions, 2 deletions
diff --git a/doPlayback.go b/doPlayback.go
index 46e7fcb..f39776c 100644
--- a/doPlayback.go
+++ b/doPlayback.go
@@ -1,11 +1,36 @@
package main
import (
+ "fmt"
+
"go.wit.com/log"
)
func doPlayback() {
- for i, chat := range me.chats.GetChats() {
- log.Info(i, chat.Uuid, chat.From)
+ log.Infof("Found %d chat topic(s) in the log.", len(me.chats.GetChats()))
+ fmt.Println("-------------------------------------------------")
+
+ // Iterate through the top-level Chat messages, which are now named groups.
+ for _, chat := range me.chats.GetChats() {
+
+ // Get the number of entries in the chat.
+ entryCount := len(chat.GetEntries())
+
+ // Get the timestamp of the first entry to represent the chat's start time.
+ var formattedTime string
+ if entryCount > 0 && chat.GetEntries()[0].GetCtime() != nil {
+ t := chat.GetEntries()[0].GetCtime().AsTime()
+ formattedTime = t.Format("2006-01-02 15:04:05") // YYYY-MM-DD HH:MM:SS
+ } else {
+ formattedTime = "No Timestamp"
+ }
+
+ // Print the formatted one-line summary.
+ fmt.Printf("Topic: %-25s | Entries: %-4d | Started: %s\n",
+ chat.GetChatName(),
+ entryCount,
+ formattedTime,
+ )
}
+ fmt.Println("-------------------------------------------------")
}