Skip to content

Commit

Permalink
Slight cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
machawk1 committed Apr 18, 2024
1 parent b6e1f30 commit 2ceb332
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,7 @@ func generateSummary(urir string, basetm *list.List, format string, dataCh chan
Last Memento
Count int
}

//m := make(map[string]int)

archives := make(map[string]Archive)
for e := basetm.Front(); e != nil; e = e.Next() {
lnk := e.Value.(Link)
Expand All @@ -370,14 +369,11 @@ func generateSummary(urir string, basetm *list.List, format string, dataCh chan
i += 1
dataCh <- fmt.Sprintf(`%d`+"\n", i)

// TODO: create a hash table for each archive and its attributes
// NOTE that the temporally first for an archive is likely not the first memento in the whole TimeMap
hostbuck := strings.SplitN(lnk.Href, "/", 4)
// fmt.Printf(lnk.Timestr)
archive, exists := archives[hostbuck[2]]
dt, err := strconv.Atoi(lnk.Timestr)
if exists {
fmt.Printf("%s already exists, checking if first/last\n", hostbuck[2])
if err != nil {
fmt.Printf("Error converting the datetime to an int")
continue
Expand All @@ -397,7 +393,6 @@ func generateSummary(urir string, basetm *list.List, format string, dataCh chan
} else {
memento := Memento{lnk.Href, dt}
newarchive := Archive{memento, memento, 1}
fmt.Printf("Adding to archive, %d \n", archive.Count)
archives[hostbuck[2]] = newarchive
}
dataCh <- fmt.Sprintf(`%s %s`+"\n", lnk.Timeobj.Format(time.RFC3339), lnk.Href)
Expand Down

0 comments on commit 2ceb332

Please sign in to comment.