diff --git a/jobs/refresh-ffxiv/refresh-ffxiv.go b/jobs/refresh-ffxiv/refresh-ffxiv.go new file mode 100644 index 00000000..c8fc34ee --- /dev/null +++ b/jobs/refresh-ffxiv/refresh-ffxiv.go @@ -0,0 +1,41 @@ +package main + +import ( + "time" + + "github.com/animenotifier/arn" + "github.com/animenotifier/arn/stringutils" + "github.com/fatih/color" +) + +var ticker = time.NewTicker(1100 * time.Millisecond) + +func main() { + color.Yellow("Refreshing FFXIV information") + + defer color.Green("Finished.") + defer arn.Node.Close() + + for user := range arn.StreamUsers() { + if user.Accounts.FinalFantasyXIV.Nick == "" || user.Accounts.FinalFantasyXIV.Server == "" { + continue + } + + // Fetch new info + err := user.RefreshFFXIVInfo() + + if err != nil { + color.Red(err.Error()) + continue + } + + // Log it + stringutils.PrettyPrint(user.Accounts.FinalFantasyXIV) + + // Save in database + user.Save() + + // Wait for rate limiter + <-ticker.C + } +} diff --git a/pages/users/ranking.scarlet b/pages/users/ranking.scarlet index daa9ff3f..4221e0e6 100644 --- a/pages/users/ranking.scarlet +++ b/pages/users/ranking.scarlet @@ -22,5 +22,6 @@ margin-left 0.8rem .ranking-score, -.ranking-accuracy +.ranking-accuracy, +.ranking-level text-align right \ No newline at end of file