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