Added wikipedia links

This commit is contained in:
Eduard Urbach 2018-04-03 23:58:30 +02:00
parent 2010e9ed68
commit 518c7bbc61
2 changed files with 6 additions and 50 deletions

View File

@ -36,7 +36,7 @@ component AnimeSideColumn(anime *arn.Anime, friends []*arn.User, listItems map[*
AnimeRatings(anime, user) AnimeRatings(anime, user)
AnimePopularity(anime) AnimePopularity(anime)
AnimeFriends(friends, listItems) AnimeFriends(friends, listItems)
AnimeLinks(anime) AnimeLinks(anime, user)
component AnimeActions(anime *arn.Anime, listItem *arn.AnimeListItem, user *arn.User) component AnimeActions(anime *arn.Anime, listItem *arn.AnimeListItem, user *arn.User)
if user != nil if user != nil
@ -118,7 +118,7 @@ component AnimePopularity(anime *arn.Anime)
td.anime-info-key Dropped: td.anime-info-key Dropped:
td.anime-info-value= anime.Popularity.Dropped td.anime-info-value= anime.Popularity.Dropped
component AnimeLinks(anime *arn.Anime) component AnimeLinks(anime *arn.Anime, user *arn.User)
section.anime-section.mountable section.anime-section.mountable
h3.anime-section-name Links h3.anime-section-name Links
.light-button-group .light-button-group
@ -135,6 +135,10 @@ component AnimeLinks(anime *arn.Anime)
a.light-button(href=mapping.Link(), target="_blank", rel="noopener") a.light-button(href=mapping.Link(), target="_blank", rel="noopener")
Icon("external-link") Icon("external-link")
span= mapping.Name() span= mapping.Name()
a.light-button(href="https://www.google.com/search?btnI=745&q=" + anime.Title.ByUser(user) + "+TV+series+site%3Aen.wikipedia.org", target="_blank", rel="noopener")
Icon("wikipedia-w")
span Wikipedia
component AnimeGenres(anime *arn.Anime) component AnimeGenres(anime *arn.Anime)
.anime-genres .anime-genres

View File

@ -1,48 +0,0 @@
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)
}