From cfac7b62047270a698966f370df2e39b85459259 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Mon, 18 Nov 2019 18:58:30 +0900 Subject: [PATCH] Cleanup --- arn/Anime.go | 34 ------------------- jobs/anime-characters/anime-characters.go | 31 ----------------- layout/README.md | 2 +- .../{ => audioplayer}/audioplayer.pixy | 0 .../{ => audioplayer}/audioplayer.scarlet | 0 5 files changed, 1 insertion(+), 66 deletions(-) delete mode 100644 jobs/anime-characters/anime-characters.go rename layout/sidebar/{ => audioplayer}/audioplayer.pixy (100%) rename layout/sidebar/{ => audioplayer}/audioplayer.scarlet (100%) diff --git a/arn/Anime.go b/arn/Anime.go index 458f17aa..1546e666 100644 --- a/arn/Anime.go +++ b/arn/Anime.go @@ -714,40 +714,6 @@ func (anime *Anime) EpisodeByNumber(number int) *Episode { return nil } -// RefreshAnimeCharacters ... -func (anime *Anime) RefreshAnimeCharacters() (*AnimeCharacters, error) { - resp, err := kitsu.GetAnimeCharactersForAnime(anime.GetMapping("kitsu/anime")) - - if err != nil { - return nil, err - } - - animeCharacters := &AnimeCharacters{ - AnimeID: anime.ID, - Items: []*AnimeCharacter{}, - } - - for _, incl := range resp.Included { - if incl.Type != "animeCharacters" { - continue - } - - role := incl.Attributes["role"].(string) - characterID := incl.Relationships.Character.Data.ID - - animeCharacter := &AnimeCharacter{ - CharacterID: characterID, - Role: role, - } - - animeCharacters.Items = append(animeCharacters.Items, animeCharacter) - } - - animeCharacters.Save() - - return animeCharacters, nil -} - // String implements the default string serialization. func (anime *Anime) String() string { return anime.Title.Canonical diff --git a/jobs/anime-characters/anime-characters.go b/jobs/anime-characters/anime-characters.go deleted file mode 100644 index 4663712f..00000000 --- a/jobs/anime-characters/anime-characters.go +++ /dev/null @@ -1,31 +0,0 @@ -package main - -import ( - "fmt" - "time" - - "github.com/akyoto/color" - "github.com/animenotifier/notify.moe/arn" -) - -func main() { - color.Yellow("Refreshing anime characters...") - - defer color.Green("Finished.") - defer arn.Node.Close() - - rateLimiter := time.NewTicker(500 * time.Millisecond) - - for anime := range arn.StreamAnime() { - <-rateLimiter.C - - chars, err := anime.RefreshAnimeCharacters() - - if err != nil { - color.Red(err.Error()) - continue - } - - fmt.Printf("%s %s (%d characters)\n", anime.ID, anime.Title.Canonical, len(chars.Items)) - } -} diff --git a/layout/README.md b/layout/README.md index ffd722e3..f15dad67 100644 --- a/layout/README.md +++ b/layout/README.md @@ -1,3 +1,3 @@ # Layout -This directory contains the main template that is used for all HTML responses. \ No newline at end of file +This directory contains the main template that is used for all HTML responses. diff --git a/layout/sidebar/audioplayer.pixy b/layout/sidebar/audioplayer/audioplayer.pixy similarity index 100% rename from layout/sidebar/audioplayer.pixy rename to layout/sidebar/audioplayer/audioplayer.pixy diff --git a/layout/sidebar/audioplayer.scarlet b/layout/sidebar/audioplayer/audioplayer.scarlet similarity index 100% rename from layout/sidebar/audioplayer.scarlet rename to layout/sidebar/audioplayer/audioplayer.scarlet