Improved twist.moe job
This commit is contained in:
parent
b4ba7c3b4d
commit
06fddad8bd
@ -15,27 +15,25 @@ var rateLimiter = time.NewTicker(500 * time.Millisecond)
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// Replace this with ID list from twist.moe later
|
// Replace this with ID list from twist.moe later
|
||||||
currentAnime, err := arn.FilterAnime(func(anime *arn.Anime) bool {
|
twistAnime, err := twist.GetAnimeIndex()
|
||||||
return anime.Status == "current"
|
|
||||||
})
|
|
||||||
arn.PanicOnError(err)
|
arn.PanicOnError(err)
|
||||||
|
idList := twistAnime.KitsuIDs()
|
||||||
|
|
||||||
color.Yellow("Refreshing twist.moe links for %d anime", len(currentAnime))
|
color.Yellow("Refreshing twist.moe links for %d anime", len(idList))
|
||||||
|
|
||||||
for count, anime := range currentAnime {
|
for count, animeID := range idList {
|
||||||
// Wait for rate limiter
|
// Wait for rate limiter
|
||||||
<-rateLimiter.C
|
<-rateLimiter.C
|
||||||
|
|
||||||
// anime, animeErr := arn.GetAnime(animeID)
|
anime, animeErr := arn.GetAnime(animeID)
|
||||||
|
|
||||||
// if animeErr != nil {
|
if animeErr != nil {
|
||||||
// color.Red("Error fetching anime from the database with ID %s: %v", animeID, animeErr)
|
color.Red("Error fetching anime from the database with ID %s: %v", animeID, animeErr)
|
||||||
// continue
|
continue
|
||||||
// }
|
}
|
||||||
animeID := anime.ID
|
|
||||||
|
|
||||||
// Log
|
// Log
|
||||||
fmt.Fprintf(os.Stdout, "[%d / %d] ", count+1, len(currentAnime))
|
fmt.Fprintf(os.Stdout, "[%d / %d] ", count+1, len(idList))
|
||||||
|
|
||||||
// Get twist.moe feed
|
// Get twist.moe feed
|
||||||
feed, err := twist.GetFeedByKitsuID(animeID)
|
feed, err := twist.GetFeedByKitsuID(animeID)
|
||||||
|
Loading…
Reference in New Issue
Block a user