Updated jobs
This commit is contained in:
parent
b5f6f2e448
commit
cbfc08a796
@ -1,41 +0,0 @@
|
||||
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
|
||||
}
|
||||
}
|
33
jobs/refresh-games/ffxiv.go
Normal file
33
jobs/refresh-games/ffxiv.go
Normal file
@ -0,0 +1,33 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/arn/stringutils"
|
||||
"github.com/fatih/color"
|
||||
)
|
||||
|
||||
var tickerFFXIV = time.NewTicker(1100 * time.Millisecond)
|
||||
|
||||
func ffxiv(user *arn.User) {
|
||||
fmt.Println("[FFXIV]", user.Nick, user.Accounts.FinalFantasyXIV.Nick, user.Accounts.FinalFantasyXIV.Server)
|
||||
|
||||
// Fetch new info
|
||||
err := user.RefreshFFXIVInfo()
|
||||
|
||||
if err != nil {
|
||||
color.Red(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Log it
|
||||
stringutils.PrettyPrint(user.Accounts.FinalFantasyXIV)
|
||||
|
||||
// Save in database
|
||||
user.Save()
|
||||
|
||||
// Wait for rate limiter
|
||||
<-tickerFFXIV.C
|
||||
}
|
33
jobs/refresh-games/osu.go
Normal file
33
jobs/refresh-games/osu.go
Normal file
@ -0,0 +1,33 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/arn/stringutils"
|
||||
"github.com/fatih/color"
|
||||
)
|
||||
|
||||
var tickerOsu = time.NewTicker(500 * time.Millisecond)
|
||||
|
||||
func osu(user *arn.User) {
|
||||
fmt.Println("[Osu]", user.Nick, user.Accounts.Osu.Nick)
|
||||
|
||||
// Fetch new info
|
||||
err := user.RefreshOsuInfo()
|
||||
|
||||
if err != nil {
|
||||
color.Red(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Log it
|
||||
stringutils.PrettyPrint(user.Accounts.Osu)
|
||||
|
||||
// Save in database
|
||||
user.Save()
|
||||
|
||||
// Wait for rate limiter
|
||||
<-tickerOsu.C
|
||||
}
|
33
jobs/refresh-games/overwatch.go
Normal file
33
jobs/refresh-games/overwatch.go
Normal file
@ -0,0 +1,33 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/arn/stringutils"
|
||||
"github.com/fatih/color"
|
||||
)
|
||||
|
||||
var tickerOW = time.NewTicker(1100 * time.Millisecond)
|
||||
|
||||
func overwatch(user *arn.User) {
|
||||
fmt.Println("[Overwatch]", user.Nick, user.Accounts.Overwatch.BattleTag)
|
||||
|
||||
// Fetch new info
|
||||
err := user.RefreshOverwatchInfo()
|
||||
|
||||
if err != nil {
|
||||
color.Red(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Log it
|
||||
stringutils.PrettyPrint(user.Accounts.Overwatch)
|
||||
|
||||
// Save in database
|
||||
user.Save()
|
||||
|
||||
// Wait for rate limiter
|
||||
<-tickerOW.C
|
||||
}
|
27
jobs/refresh-games/refresh-games.go
Normal file
27
jobs/refresh-games/refresh-games.go
Normal file
@ -0,0 +1,27 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/fatih/color"
|
||||
)
|
||||
|
||||
func main() {
|
||||
color.Yellow("Refreshing game information")
|
||||
|
||||
defer color.Green("Finished.")
|
||||
defer arn.Node.Close()
|
||||
|
||||
for user := range arn.StreamUsers() {
|
||||
if user.Accounts.Osu.Nick != "" {
|
||||
osu(user)
|
||||
}
|
||||
|
||||
if user.Accounts.Overwatch.BattleTag != "" {
|
||||
overwatch(user)
|
||||
}
|
||||
|
||||
if user.Accounts.FinalFantasyXIV.Nick != "" && user.Accounts.FinalFantasyXIV.Server != "" {
|
||||
ffxiv(user)
|
||||
}
|
||||
}
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/arn/stringutils"
|
||||
"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()
|
||||
|
||||
for user := range arn.StreamUsers() {
|
||||
if user.Accounts.Osu.Nick == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
// Fetch new info
|
||||
err := user.RefreshOsuInfo()
|
||||
|
||||
if err != nil {
|
||||
color.Red(err.Error())
|
||||
continue
|
||||
}
|
||||
|
||||
// Log it
|
||||
stringutils.PrettyPrint(user.Accounts.Osu)
|
||||
|
||||
// Save in database
|
||||
user.Save()
|
||||
|
||||
// Wait for rate limiter
|
||||
<-ticker.C
|
||||
}
|
||||
}
|
@ -18,17 +18,8 @@ var jobInfo = map[string]*utils.JobInfo{
|
||||
"twist": &utils.JobInfo{
|
||||
Name: "twist",
|
||||
},
|
||||
"refresh-osu": &utils.JobInfo{
|
||||
Name: "refresh-osu",
|
||||
},
|
||||
"mal-download": &utils.JobInfo{
|
||||
Name: "mal-download",
|
||||
},
|
||||
"mal-parse": &utils.JobInfo{
|
||||
Name: "mal-parse",
|
||||
},
|
||||
"mal-sync": &utils.JobInfo{
|
||||
Name: "mal-sync",
|
||||
"refresh-games": &utils.JobInfo{
|
||||
Name: "refresh-games",
|
||||
},
|
||||
"test": &utils.JobInfo{
|
||||
Name: "test",
|
||||
|
Loading…
Reference in New Issue
Block a user