Improved jobs
This commit is contained in:
parent
71d6ba9848
commit
18cca18ebe
@ -25,7 +25,7 @@ var colorPool = []*color.Color{
|
||||
|
||||
var jobs = map[string]time.Duration{
|
||||
"anime-ratings": 10 * time.Minute,
|
||||
// "test": 1 * time.Hour,
|
||||
"test": 1 * time.Hour,
|
||||
"twist": 4 * time.Hour,
|
||||
// "refresh-episodes": 10 * time.Hour,
|
||||
// "refresh-osu": 12 * time.Hour,
|
||||
|
@ -11,8 +11,8 @@ import (
|
||||
func main() {
|
||||
color.Yellow("Importing Kitsu anime")
|
||||
|
||||
defer arn.Node.Close()
|
||||
defer color.Green("Finished.")
|
||||
defer arn.Node.Close()
|
||||
|
||||
// In case we refresh only one anime
|
||||
if InvokeShellArgs() {
|
||||
|
@ -11,8 +11,8 @@ import (
|
||||
func main() {
|
||||
color.Yellow("Importing Kitsu mappings")
|
||||
|
||||
defer arn.Node.Close()
|
||||
defer color.Green("Finished.")
|
||||
defer arn.Node.Close()
|
||||
|
||||
// Iterate over all mappings
|
||||
for mapping := range kitsu.StreamMappings() {
|
||||
|
@ -16,8 +16,8 @@ import (
|
||||
func main() {
|
||||
color.Yellow("Importing MAL anime")
|
||||
|
||||
defer arn.Node.Close()
|
||||
defer color.Green("Finished.")
|
||||
defer arn.Node.Close()
|
||||
|
||||
// readFile("../mal-download/files/anime-31240.html")
|
||||
|
||||
|
@ -7,26 +7,34 @@ import (
|
||||
"github.com/fatih/color"
|
||||
)
|
||||
|
||||
var ticker = time.NewTicker(500 * time.Millisecond)
|
||||
|
||||
func main() {
|
||||
color.Yellow("Refreshing osu information")
|
||||
|
||||
defer color.Green("Finished.")
|
||||
defer arn.Node.Close()
|
||||
|
||||
ticker := time.NewTicker(500 * time.Millisecond)
|
||||
|
||||
for user := range arn.StreamUsers() {
|
||||
// Get osu info
|
||||
if user.RefreshOsuInfo() == nil {
|
||||
if user.Accounts.Osu.Nick == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
// Fetch new info
|
||||
err := user.RefreshOsuInfo()
|
||||
|
||||
if err != nil {
|
||||
color.Red(err.Error())
|
||||
continue
|
||||
}
|
||||
|
||||
// Log it
|
||||
arn.PrettyPrint(user.Accounts.Osu)
|
||||
|
||||
// Fetch user again to prevent writing old data
|
||||
updatedUser, _ := arn.GetUser(user.ID)
|
||||
updatedUser.Accounts.Osu = user.Accounts.Osu
|
||||
updatedUser.Save()
|
||||
}
|
||||
// Save in database
|
||||
user.Save()
|
||||
|
||||
// Wait for rate limiter
|
||||
<-ticker.C
|
||||
}
|
||||
|
||||
color.Green("Finished.")
|
||||
}
|
||||
|
@ -116,5 +116,5 @@ func search(anime *arn.Anime, title string) {
|
||||
}
|
||||
|
||||
// This will start a goroutine that saves the anime
|
||||
anime.SetMapping("shoboi/anime", shoboi.TID, "")
|
||||
anime.SetMapping("shoboi/anime", shoboi.TID)
|
||||
}
|
||||
|
@ -16,8 +16,8 @@ import (
|
||||
func main() {
|
||||
color.Yellow("Updating anime image average colors")
|
||||
|
||||
defer arn.Node.Close()
|
||||
defer color.Green("Finished.")
|
||||
defer arn.Node.Close()
|
||||
|
||||
// Parse flags
|
||||
var animeID string
|
||||
|
@ -14,8 +14,8 @@ import (
|
||||
func main() {
|
||||
color.Yellow("Updating anime thumbnails")
|
||||
|
||||
defer arn.Node.Close()
|
||||
defer color.Green("Finished.")
|
||||
defer arn.Node.Close()
|
||||
|
||||
// Parse flags
|
||||
var animeID string
|
||||
|
Loading…
Reference in New Issue
Block a user