Display anime source

This commit is contained in:
Eduard Urbach 2018-03-10 23:24:23 +01:00
parent e3997a8f49
commit 796a9b2b96
2 changed files with 53 additions and 0 deletions

View File

@ -216,6 +216,11 @@ component AnimeInformation(anime *arn.Anime)
td.anime-info-key End date: td.anime-info-key End date:
td.anime-info-value= anime.EndDate td.anime-info-value= anime.EndDate
if anime.Source != "" && arn.AnimeSourceHumanReadable[anime.Source] != ""
tr.mountable(data-mountable-type="info")
td.anime-info-key Source:
td.anime-info-value= arn.AnimeSourceHumanReadable[anime.Source]
if anime.FirstChannel != "" if anime.FirstChannel != ""
tr.mountable(data-mountable-type="info") tr.mountable(data-mountable-type="info")
td.anime-info-key Channel: td.anime-info-key Channel:

View File

@ -0,0 +1,48 @@
package main
import (
"fmt"
"strings"
"github.com/animenotifier/arn"
"github.com/animenotifier/mal"
"github.com/fatih/color"
)
func main() {
defer arn.Node.Close()
count := 0
for anime := range arn.StreamAnime() {
malID := anime.GetMapping("myanimelist/anime")
if malID == "" {
continue
}
malAnimeObj, err := arn.MAL.Get("Anime", malID)
if err != nil {
continue
}
malAnime := malAnimeObj.(*mal.Anime)
fmt.Println(anime.Source)
anime.Source = strings.ToLower(malAnime.Source)
if anime.Source == "Unknown" {
anime.Source = ""
}
anime.Save()
count++
fmt.Println(anime.ID, anime, anime.Source)
}
color.Green("Processed %d anime", count)
}