Skip to content

Commit

Permalink
Add basic stats for #97
Browse files Browse the repository at this point in the history
  • Loading branch information
machawk1 committed Apr 18, 2024
1 parent 2e9d161 commit ec7c82e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,23 @@ func generateSummary(urir string, basetm *list.List, format string, dataCh chan
dataCh <- fmt.Sprintf(`%s %s`+"\n", lnk.Timeobj.Format(time.RFC3339), lnk.Href)
//dataCh <- fmt.Sprintf(`%s {"uri": "%s", "rel": "%s", "datetime": "%s"}`+"\n", lnk.Timestr, lnk.Href, rels, lnk.Datetime)
}
// Count total mementos in all archives
mcount := 0
dataCh <- fmt.Sprintf(`"archives": {` + "\n")
for host, archive := range archives {
mcount += archive.Count
dataCh <- fmt.Sprintf(` "%s":{`+"\n", host)
dataCh <- fmt.Sprintf(` "count": %d,"`+"\n", archive.Count)
dataCh <- fmt.Sprintf(` "first":{` + "\n")
dataCh <- fmt.Sprintf(` "datetime": %d,`+"\n", archive.First.Datetime)
dataCh <- fmt.Sprintf(` "uri": "%s",`+"\n }\n", archive.First.Urim)
dataCh <- fmt.Sprintf(` "last":{` + "\n")
dataCh <- fmt.Sprintf(` "datetime": %d,`+"\n", archive.Last.Datetime)
dataCh <- fmt.Sprintf(` "uri": "%s",`+"\n }\n", archive.Last.Urim)
dataCh <- fmt.Sprintf(" },\n")
}
dataCh <- fmt.Sprintf(`"total_mementos": %d`, mcount)
fmt.Printf("Total memento count: %d\n", mcount)
fmt.Println(archives)

}
Expand Down

0 comments on commit ec7c82e

Please sign in to comment.