Improved episode refresh
This commit is contained in:
@ -2,8 +2,8 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/animenotifier/arn"
|
"github.com/animenotifier/arn"
|
||||||
"github.com/fatih/color"
|
"github.com/fatih/color"
|
||||||
@ -50,6 +50,9 @@ func main() {
|
|||||||
func refreshQueue(queue []*arn.Anime) {
|
func refreshQueue(queue []*arn.Anime) {
|
||||||
for _, anime := range queue {
|
for _, anime := range queue {
|
||||||
refresh(anime)
|
refresh(anime)
|
||||||
|
|
||||||
|
// Lower the request interval
|
||||||
|
time.Sleep(5 * time.Second)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,6 +71,11 @@ func refresh(anime *arn.Anime) {
|
|||||||
|
|
||||||
color.Red(err.Error())
|
color.Red(err.Error())
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("+"+strconv.Itoa(len(anime.Episodes().Items)-episodeCount)+" airing", "|", "+"+strconv.Itoa(anime.Episodes().AvailableCount()-availableEpisodeCount)+" available")
|
faint := color.New(color.Faint).SprintFunc()
|
||||||
|
episodes := anime.Episodes()
|
||||||
|
|
||||||
|
fmt.Println(faint(episodes))
|
||||||
|
fmt.Printf("+%d airing | +%d available (%d total)\n", len(episodes.Items), len(episodes.Items)-episodeCount, episodes.AvailableCount()-availableEpisodeCount)
|
||||||
|
println()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,9 @@ func main() {
|
|||||||
if sync(anime) {
|
if sync(anime) {
|
||||||
count++
|
count++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Lower the request interval
|
||||||
|
time.Sleep(2 * time.Second)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log
|
// Log
|
||||||
@ -53,7 +56,6 @@ func sync(anime *arn.Anime) bool {
|
|||||||
// Did we get the ID?
|
// Did we get the ID?
|
||||||
if anime.GetMapping("shoboi/anime") != "" {
|
if anime.GetMapping("shoboi/anime") != "" {
|
||||||
println(color.GreenString("✔"))
|
println(color.GreenString("✔"))
|
||||||
time.Sleep(2 * time.Second)
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user