New images

This commit is contained in:
Eduard Urbach 2017-11-09 18:31:32 +01:00
parent 4558939bff
commit d07ae4ebf6
8 changed files with 71 additions and 30 deletions

View File

@ -10,7 +10,7 @@ component SoundTrackContent(track *arn.SoundTrack, media *arn.ExternalMedia)
.sound-track-content
if track.MainAnime() != nil
a.sound-track-anime-link.ajax(href="/anime/" + track.MainAnime().ID)
img.sound-track-anime-image.lazy(data-src=track.MainAnime().Image.Small, alt=track.MainAnime().Title.Canonical, title=track.MainAnime().Title.Canonical)
img.sound-track-anime-image.lazy(data-src=track.MainAnime().Image("medium"), alt=track.MainAnime().Title.Canonical, title=track.MainAnime().Title.Canonical)
ExternalMedia(media)

View File

@ -149,7 +149,7 @@ component AnimeRelations(anime *arn.Anime, user *arn.User)
.anime-relations
each relation in anime.Relations().Items
a.anime-relation.mountable.ajax(href=relation.Anime().Link(), title=relation.Anime().Title.ByUser(user), data-mountable-type="relation")
img.anime-relation-image.lazy(data-src=relation.Anime().Image.Tiny, alt=relation.Anime().Title.ByUser(user))
img.anime-relation-image.lazy(data-src=relation.Anime().Image("small"), alt=relation.Anime().Title.ByUser(user))
.anime-relation-type= relation.HumanReadableType()
.anime-relation-year
if relation.Anime().StartDate != ""

View File

@ -45,7 +45,7 @@ component AnimeList(animeList *arn.AnimeList, viewUser *arn.User, user *arn.User
tr.anime-list-item.mountable(title=item.Notes, data-api="/api/animelist/" + animeList.UserID + "/field/Items[AnimeID=\"" + item.AnimeID + "\"]")
td.anime-list-item-image-container
a.ajax(href=item.Anime().Link())
img.anime-list-item-image.lazy(data-src=item.Anime().Image.Tiny, alt=item.Anime().Title.ByUser(user))
img.anime-list-item-image.lazy(data-src=item.Anime().Image("small"), alt=item.Anime().Title.ByUser(user))
td.anime-list-item-name
a.ajax(href=item.Link(animeList.User().Nick))= item.Anime().Title.ByUser(user)

View File

@ -83,12 +83,7 @@ func getMatches(ctx *aero.Context) ([]*arn.AniListMatch, string) {
return nil, ctx.Error(http.StatusBadRequest, "Couldn't authorize the Anime Notifier app on AniList", authErr)
}
allAnime, allErr := arn.AllAnime()
if allErr != nil {
return nil, ctx.Error(http.StatusBadRequest, "Couldn't load notify.moe list of all anime", allErr)
}
allAnime := arn.AllAnime()
anilistAnimeList, err := anilist.GetAnimeList(user.Accounts.AniList.Nick)
if err != nil {

View File

@ -111,7 +111,7 @@ component Profile(viewUser *arn.User, user *arn.User, animeList *arn.AnimeList,
each item in animeList.Items
if item.Status == arn.AnimeListStatusWatching || item.Status == arn.AnimeListStatusCompleted
a.profile-watching-list-item.ajax(href=item.Anime().Link(), title=item.Anime().Title.ByUser(user) + " (" + toString(item.Episodes) + " / " + arn.EpisodesToString(item.Anime().EpisodeCount) + ")")
img.profile-watching-list-item-image.lazy(data-src=item.Anime().Image.Tiny, alt=item.Anime().Title.ByUser(user))
img.profile-watching-list-item-image.lazy(data-src=item.Anime().Image("small"), alt=item.Anime().Title.ByUser(user))
if user != nil && (user.Role == "admin" || user.Role == "editor")
.footer

View File

@ -31,7 +31,7 @@ func Edit(ctx *aero.Context) string {
}
if track.MainAnime() != nil {
ctx.Data.(*arn.OpenGraph).Tags["og:image"] = track.MainAnime().Image.Large
ctx.Data.(*arn.OpenGraph).Tags["og:image"] = track.MainAnime().Image("large")
}
return ctx.HTML(components.SoundTrackTabs(track, user) + editform.Render(track, "Edit soundtrack", user))

View File

@ -29,7 +29,7 @@ func Get(ctx *aero.Context) string {
}
if track.MainAnime() != nil {
openGraph.Tags["og:image"] = track.MainAnime().Image.Large
openGraph.Tags["og:image"] = track.MainAnime().Image("large")
}
// Set video so that it can be played

View File

@ -0,0 +1,46 @@
package main
import (
"os"
"path"
"github.com/animenotifier/arn"
)
func main() {
defer arn.Node.Close()
for anime := range arn.StreamAnime() {
base := path.Join(os.Getenv("GOPATH"), "/src/github.com/animenotifier/notify.moe/images/anime/original/", anime.ID)
if _, err := os.Stat(base + ".png"); err == nil {
anime.ImageExtension = ".png"
anime.Save()
continue
}
if _, err := os.Stat(base + ".jpg"); err == nil {
anime.ImageExtension = ".jpg"
anime.Save()
continue
}
if _, err := os.Stat(base + ".jpeg"); err == nil {
anime.ImageExtension = ".jpeg"
anime.Save()
continue
}
if _, err := os.Stat(base + ".gif"); err == nil {
anime.ImageExtension = ".gif"
anime.Save()
continue
}
if _, err := os.Stat(base + ".webp"); err == nil {
anime.ImageExtension = ".webp"
anime.Save()
continue
}
}
}