2024-05-15 01:39:21 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"slices"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Book struct {
|
|
|
|
Name string
|
|
|
|
Length time.Duration
|
|
|
|
}
|
|
|
|
|
|
|
|
var stormlight []Book = []Book{
|
|
|
|
{
|
|
|
|
Name: "The Way of Kings Part 1",
|
|
|
|
Length: 26966 * time.Second,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "The Way of Kings Part 2",
|
|
|
|
Length: 25887 * time.Second,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "The Way of Kings Part 3",
|
|
|
|
Length: 27645 * time.Second,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "The Way of Kings Part 4",
|
|
|
|
Length: 26077 * time.Second,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "The Way of Kings Part 5",
|
|
|
|
Length: 27181 * time.Second,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "Words of Radiance Part 1",
|
|
|
|
Length: 27556 * time.Second,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "Words of Radiance Part 2",
|
|
|
|
Length: 27416 * time.Second,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "Words of Radiance Part 3",
|
|
|
|
Length: 26568 * time.Second,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "Words of Radiance Part 4",
|
|
|
|
Length: 26130 * time.Second,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "Words of Radiance Part 5",
|
|
|
|
Length: 27726 * time.Second,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "Oathbringer Part 1",
|
|
|
|
Length: 24407 * time.Second,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "Oathbringer Part 2",
|
|
|
|
Length: 24467 * time.Second,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "Oathbringer Part 3",
|
|
|
|
Length: 24482 * time.Second,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "Oathbringer Part 4",
|
|
|
|
Length: 22930 * time.Second,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "Oathbringer Part 5",
|
|
|
|
Length: 24122 * time.Second,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "Oathbringer Part 6",
|
|
|
|
Length: 25034 * time.Second,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "Rhythm of War Part 1",
|
|
|
|
Length: 25655 * time.Second,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "Rhythm of War Part 2",
|
|
|
|
Length: 24470 * time.Second,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "Rhythm of War Part 3",
|
|
|
|
Length: 23996 * time.Second,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "Rhythm of War Part 4",
|
|
|
|
Length: 27610 * time.Second,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "Rhythm of War Part 5",
|
|
|
|
Length: 28758 * time.Second,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "Rhythm of War Part 6",
|
|
|
|
Length: 29142 * time.Second,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
func getBookWithTimestamp(timeRemaining time.Duration) (string, time.Duration) {
|
2024-05-18 17:40:48 +00:00
|
|
|
timeRemaining = time.Duration(timeRemaining.Hours()/24) * 45 * time.Minute
|
2024-05-20 01:41:39 +00:00
|
|
|
|
|
|
|
stormlight := slices.Clone(stormlight)
|
2024-05-15 01:39:21 +00:00
|
|
|
slices.Reverse(stormlight)
|
|
|
|
|
|
|
|
for _, book := range stormlight {
|
|
|
|
if timeRemaining < book.Length {
|
|
|
|
return book.Name, book.Length - timeRemaining
|
|
|
|
}
|
|
|
|
|
|
|
|
timeRemaining = timeRemaining - book.Length
|
|
|
|
}
|
|
|
|
|
|
|
|
if timeRemaining > 0 {
|
|
|
|
return "The Way of Kings Part 1", 0
|
|
|
|
}
|
|
|
|
|
|
|
|
return "YOU SHOULD BE DONE", 0
|
|
|
|
}
|