New anime images job

This commit is contained in:
Eduard Urbach 2017-11-09 20:17:05 +01:00
parent 27f04d6a2d
commit 18cdac251b

View File

@ -6,7 +6,7 @@ import (
"os" "os"
"path" "path"
"runtime" "runtime"
"sort" "strconv"
"time" "time"
_ "image/gif" _ "image/gif"
@ -37,21 +37,14 @@ func main() {
color.Yellow("Downloading anime images") color.Yellow("Downloading anime images")
defer arn.Node.Close() defer arn.Node.Close()
allAnime := arn.AllAnime()
sort.Slice(allAnime, func(i, j int) bool {
return allAnime[i].Title.Canonical < allAnime[j].Title.Canonical
})
if from < 0 { if from < 0 {
from = 0 from = 0
} }
if to > len(allAnime) { allAnime := arn.FilterAnime(func(anime *arn.Anime) bool {
to = len(allAnime) id, _ := strconv.Atoi(anime.ID)
} return id >= from && id <= to
})
allAnime = allAnime[from:to]
for index, anime := range allAnime { for index, anime := range allAnime {
fmt.Printf("%d / %d\n", index+1, len(allAnime)) fmt.Printf("%d / %d\n", index+1, len(allAnime))