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,8 +10,8 @@ component SoundTrackContent(track *arn.SoundTrack, media *arn.ExternalMedia)
.sound-track-content .sound-track-content
if track.MainAnime() != nil if track.MainAnime() != nil
a.sound-track-anime-link.ajax(href="/anime/" + track.MainAnime().ID) 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) ExternalMedia(media)
component SoundTrackFooter(track *arn.SoundTrack) component SoundTrackFooter(track *arn.SoundTrack)
@ -20,9 +20,9 @@ component SoundTrackFooter(track *arn.SoundTrack)
a.ajax(href=track.Link() + "/edit") untitled a.ajax(href=track.Link() + "/edit") untitled
else else
a.ajax(href=track.Link())= track.Title a.ajax(href=track.Link())= track.Title
span posted span posted
span.utc-date(data-date=track.Created) span.utc-date(data-date=track.Created)
span by span by
a.ajax(href=track.Creator().Link())= track.Creator().Nick + " " a.ajax(href=track.Creator().Link())= track.Creator().Nick + " "
component ExternalMedia(media *arn.ExternalMedia) component ExternalMedia(media *arn.ExternalMedia)

View File

@ -149,7 +149,7 @@ component AnimeRelations(anime *arn.Anime, user *arn.User)
.anime-relations .anime-relations
each relation in anime.Relations().Items 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") 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-type= relation.HumanReadableType()
.anime-relation-year .anime-relation-year
if relation.Anime().StartDate != "" if relation.Anime().StartDate != ""

View File

@ -45,11 +45,11 @@ 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 + "\"]") 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 td.anime-list-item-image-container
a.ajax(href=item.Anime().Link()) 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 td.anime-list-item-name
a.ajax(href=item.Link(animeList.User().Nick))= item.Anime().Title.ByUser(user) a.ajax(href=item.Link(animeList.User().Nick))= item.Anime().Title.ByUser(user)
td.anime-list-item-actions td.anime-list-item-actions
if user != nil && item.Status == arn.AnimeListStatusWatching && item.Anime().EpisodeByNumber(item.Episodes + 1) != nil if user != nil && item.Status == arn.AnimeListStatusWatching && item.Anime().EpisodeByNumber(item.Episodes + 1) != nil
for _, link := range item.Anime().EpisodeByNumber(item.Episodes + 1).Links for _, link := range item.Anime().EpisodeByNumber(item.Episodes + 1).Links
@ -57,20 +57,20 @@ component AnimeList(animeList *arn.AnimeList, viewUser *arn.User, user *arn.User
RawIcon("eye") RawIcon("eye")
//- a(href=arn.Nyaa.GetLink(item.Anime()), title="Search on Nyaa", target="_blank", rel="noopener") //- a(href=arn.Nyaa.GetLink(item.Anime()), title="Search on Nyaa", target="_blank", rel="noopener")
//- RawIcon("download") //- RawIcon("download")
td.anime-list-item-airing-date td.anime-list-item-airing-date
if (item.Status == arn.AnimeListStatusWatching || item.Status == arn.AnimeListStatusPlanned) && item.Anime().UpcomingEpisode() != nil if (item.Status == arn.AnimeListStatusWatching || item.Status == arn.AnimeListStatusPlanned) && item.Anime().UpcomingEpisode() != nil
span.utc-airing-date(data-start-date=item.Anime().UpcomingEpisode().Episode.AiringDate.Start, data-end-date=item.Anime().UpcomingEpisode().Episode.AiringDate.End, data-episode-number=item.Anime().UpcomingEpisode().Episode.Number) span.utc-airing-date(data-start-date=item.Anime().UpcomingEpisode().Episode.AiringDate.Start, data-end-date=item.Anime().UpcomingEpisode().Episode.AiringDate.End, data-episode-number=item.Anime().UpcomingEpisode().Episode.Number)
td.anime-list-item-episodes td.anime-list-item-episodes
.anime-list-item-episodes-watched .anime-list-item-episodes-watched
.action(contenteditable=utils.SameUser(user, viewUser), data-field="Episodes", data-type="number", data-trigger="focusout", data-action="save")= item.Episodes .action(contenteditable=utils.SameUser(user, viewUser), data-field="Episodes", data-type="number", data-trigger="focusout", data-action="save")= item.Episodes
if item.Status == arn.AnimeListStatusWatching if item.Status == arn.AnimeListStatusWatching
.plus-episode.action(data-action="increaseEpisode", data-trigger="click") + .plus-episode.action(data-action="increaseEpisode", data-trigger="click") +
.anime-list-item-episodes-separator / .anime-list-item-episodes-separator /
.anime-list-item-episodes-max= item.Anime().EpisodeCountString() .anime-list-item-episodes-max= item.Anime().EpisodeCountString()
td.anime-list-item-rating(title="Overall rating") td.anime-list-item-rating(title="Overall rating")
.action(contenteditable=utils.SameUser(user, viewUser), data-field="Rating.Overall", data-type="number", data-trigger="focusout", data-action="save")= utils.FormatRating(item.Rating.Overall) .action(contenteditable=utils.SameUser(user, viewUser), data-field="Rating.Overall", data-type="number", data-trigger="focusout", data-action="save")= utils.FormatRating(item.Rating.Overall)
//- td.anime-list-item-rating(title="Story rating") //- td.anime-list-item-rating(title="Story rating")

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) return nil, ctx.Error(http.StatusBadRequest, "Couldn't authorize the Anime Notifier app on AniList", authErr)
} }
allAnime, allErr := arn.AllAnime() allAnime := arn.AllAnime()
if allErr != nil {
return nil, ctx.Error(http.StatusBadRequest, "Couldn't load notify.moe list of all anime", allErr)
}
anilistAnimeList, err := anilist.GetAnimeList(user.Accounts.AniList.Nick) anilistAnimeList, err := anilist.GetAnimeList(user.Accounts.AniList.Nick)
if err != nil { if err != nil {

View File

@ -43,13 +43,13 @@ component ProfileHeader(viewUser *arn.User, user *arn.User, uri string)
p.profile-field.role p.profile-field.role
Icon("rocket") Icon("rocket")
span= arn.Capitalize(viewUser.Role) span= arn.Capitalize(viewUser.Role)
if viewUser.IsPro() if viewUser.IsPro()
p.profile-field.profile-pro-status p.profile-field.profile-pro-status
a.ajax(href="/shop", title="PRO user") a.ajax(href="/shop", title="PRO user")
Icon("star") Icon("star")
span.profile-pro-status-text PRO span.profile-pro-status-text PRO
if user != nil if user != nil
.profile-actions .profile-actions
if user.ID != viewUser.ID if user.ID != viewUser.ID
@ -61,11 +61,11 @@ component ProfileHeader(viewUser *arn.User, user *arn.User, uri string)
button.profile-action.action(data-action="unfollowUser", data-trigger="click", data-api="/api/userfollows/" + user.ID + "/remove/" + viewUser.ID) button.profile-action.action(data-action="unfollowUser", data-trigger="click", data-api="/api/userfollows/" + user.ID + "/remove/" + viewUser.ID)
Icon("user-times") Icon("user-times")
span Unfollow span Unfollow
a.button.profile-action.ajax(href="/compare/animelist/" + user.Nick + "/" + viewUser.Nick) a.button.profile-action.ajax(href="/compare/animelist/" + user.Nick + "/" + viewUser.Nick)
Icon("exchange") Icon("exchange")
span Compare span Compare
ProfileNavigation(viewUser, uri) ProfileNavigation(viewUser, uri)
component ProfileNavigation(viewUser *arn.User, uri string) component ProfileNavigation(viewUser *arn.User, uri string)
@ -97,7 +97,7 @@ component ProfileNavigation(viewUser *arn.User, uri string)
a.tab.action(href="/+" + viewUser.Nick + "/followers", data-action="diff", data-trigger="click") a.tab.action(href="/+" + viewUser.Nick + "/followers", data-action="diff", data-trigger="click")
Icon("users") Icon("users")
span.tab-text Followers span.tab-text Followers
if strings.Contains(uri, "/animelist") if strings.Contains(uri, "/animelist")
StatusTabs("/+" + viewUser.Nick + "/animelist") StatusTabs("/+" + viewUser.Nick + "/animelist")
@ -111,15 +111,15 @@ component Profile(viewUser *arn.User, user *arn.User, animeList *arn.AnimeList,
each item in animeList.Items each item in animeList.Items
if item.Status == arn.AnimeListStatusWatching || item.Status == arn.AnimeListStatusCompleted 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) + ")") 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") if user != nil && (user.Role == "admin" || user.Role == "editor")
.footer .footer
.buttons .buttons
a.button.profile-action(href="/api/user/" + viewUser.ID, target="_blank", rel="noopener") a.button.profile-action(href="/api/user/" + viewUser.ID, target="_blank", rel="noopener")
Icon("search-plus") Icon("search-plus")
span JSON span JSON
//- .profile-category.mountable //- .profile-category.mountable
//- h3 //- h3
//- a.ajax(href="/+" + viewUser.Nick + "/threads", title="View all threads") Threads //- a.ajax(href="/+" + viewUser.Nick + "/threads", title="View all threads") Threads
@ -129,7 +129,7 @@ component Profile(viewUser *arn.User, user *arn.User, animeList *arn.AnimeList,
//- else //- else
//- each thread in threads //- each thread in threads
//- ThreadLink(thread) //- ThreadLink(thread)
//- .profile-category.mountable //- .profile-category.mountable
//- h3 //- h3
//- a.ajax(href="/+" + viewUser.Nick + "/posts", title="View all posts") Posts //- a.ajax(href="/+" + viewUser.Nick + "/posts", title="View all posts") Posts
@ -145,7 +145,7 @@ component Profile(viewUser *arn.User, user *arn.User, animeList *arn.AnimeList,
//- .post-toolbar.active //- .post-toolbar.active
//- .spacer //- .spacer
//- .post-likes= len(post.Likes) //- .post-likes= len(post.Likes)
//- .profile-category.mountable //- .profile-category.mountable
//- h3 //- h3
//- a.ajax(href="/+" + viewUser.Nick + "/tracks", title="View all tracks") Tracks //- a.ajax(href="/+" + viewUser.Nick + "/tracks", title="View all tracks") Tracks

View File

@ -31,7 +31,7 @@ func Edit(ctx *aero.Context) string {
} }
if track.MainAnime() != nil { 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)) 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 { 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 // 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
}
}
}