47 lines
822 B
Go
Raw Normal View History

2017-11-09 17:31:32 +00:00
package main
import (
"os"
"path"
"github.com/animenotifier/arn"
)
func main() {
defer arn.Node.Close()
for anime := range arn.StreamAnime() {
2018-03-16 21:40:38 +00:00
base := path.Join(arn.Root, "/images/anime/original/", anime.ID)
2017-11-09 17:31:32 +00:00
if _, err := os.Stat(base + ".png"); err == nil {
2018-03-16 21:40:38 +00:00
anime.Image.Extension = ".png"
2017-11-09 17:31:32 +00:00
anime.Save()
continue
}
if _, err := os.Stat(base + ".jpg"); err == nil {
2018-03-16 21:40:38 +00:00
anime.Image.Extension = ".jpg"
2017-11-09 17:31:32 +00:00
anime.Save()
continue
}
if _, err := os.Stat(base + ".jpeg"); err == nil {
2018-03-16 21:40:38 +00:00
anime.Image.Extension = ".jpg"
2017-11-09 17:31:32 +00:00
anime.Save()
continue
}
if _, err := os.Stat(base + ".gif"); err == nil {
2018-03-16 21:40:38 +00:00
anime.Image.Extension = ".gif"
2017-11-09 17:31:32 +00:00
anime.Save()
continue
}
if _, err := os.Stat(base + ".webp"); err == nil {
2018-03-16 21:40:38 +00:00
anime.Image.Extension = ".webp"
2017-11-09 17:31:32 +00:00
anime.Save()
continue
}
}
}