Added ultra low resolution filter for images

This commit is contained in:
Eduard Urbach 2018-03-20 16:27:01 +01:00
parent 65e7d4dab5
commit aa38a1461f
3 changed files with 19 additions and 6 deletions

View File

@ -27,7 +27,8 @@ component EditorTabs(url string)
Tab("Shoboi", "list", "/editor/anime/missing/shoboi") Tab("Shoboi", "list", "/editor/anime/missing/shoboi")
Tab("AniList", "list", "/editor/anime/missing/anilist") Tab("AniList", "list", "/editor/anime/missing/anilist")
Tab("Genres", "list", "/editor/anime/missing/genres") Tab("Genres", "list", "/editor/anime/missing/genres")
Tab("Hi-Res Image", "list", "/editor/anime/missing/hiresimage") Tab("Low-Res", "image", "/editor/anime/lowresimage")
Tab("Ultra Low-Res", "image", "/editor/anime/ultralowresimage")
//- a.tab.ajax(href="/admin", aria-label="Admin") //- a.tab.ajax(href="/admin", aria-label="Admin")
//- Icon("wrench") //- Icon("wrench")

View File

@ -10,6 +10,15 @@ const maxImageEntries = 70
// LowResolutionAnimeImages filters anime with low resolution images. // LowResolutionAnimeImages filters anime with low resolution images.
func LowResolutionAnimeImages(ctx *aero.Context) string { func LowResolutionAnimeImages(ctx *aero.Context) string {
return filterAnimeImages(ctx, "Anime with low resolution images", arn.AnimeImageLargeWidth, arn.AnimeImageLargeHeight)
}
// UltraLowResolutionAnimeImages filters anime with ultra low resolution images.
func UltraLowResolutionAnimeImages(ctx *aero.Context) string {
return filterAnimeImages(ctx, "Anime with ultra low resolution images", arn.AnimeImageLargeWidth/2, arn.AnimeImageLargeHeight/2)
}
func filterAnimeImages(ctx *aero.Context, title string, minExpectedWidth int, minExpectedHeight int) string {
year, _ := ctx.GetInt("year") year, _ := ctx.GetInt("year")
animeType := ctx.Get("type") animeType := ctx.Get("type")
@ -22,7 +31,7 @@ func LowResolutionAnimeImages(ctx *aero.Context) string {
return false return false
} }
return anime.Image.Width < arn.AnimeImageLargeWidth || anime.Image.Height < arn.AnimeImageLargeHeight return anime.Image.Width < minExpectedWidth || anime.Image.Height < minExpectedHeight
}) })
// Sort // Sort
@ -36,7 +45,7 @@ func LowResolutionAnimeImages(ctx *aero.Context) string {
} }
return ctx.HTML(components.AnimeEditorListFull( return ctx.HTML(components.AnimeEditorListFull(
"Anime with low resolution images", title,
lowResAnime, lowResAnime,
count, count,
"/editor/anime/missing/hiresimage", "/editor/anime/missing/hiresimage",

View File

@ -254,9 +254,12 @@ func Configure(app *aero.Application) {
l.Page("/editor/anime/missing/genres", editor.Genres) l.Page("/editor/anime/missing/genres", editor.Genres)
l.Page("/editor/anime/missing/genres/:year", editor.Genres) l.Page("/editor/anime/missing/genres/:year", editor.Genres)
l.Page("/editor/anime/missing/genres/:year/:type", editor.Genres) l.Page("/editor/anime/missing/genres/:year/:type", editor.Genres)
l.Page("/editor/anime/missing/hiresimage", editor.LowResolutionAnimeImages) l.Page("/editor/anime/lowresimage", editor.LowResolutionAnimeImages)
l.Page("/editor/anime/missing/hiresimage/:year", editor.LowResolutionAnimeImages) l.Page("/editor/anime/lowresimage/:year", editor.LowResolutionAnimeImages)
l.Page("/editor/anime/missing/hiresimage/:year/:type", editor.LowResolutionAnimeImages) l.Page("/editor/anime/lowresimage/:year/:type", editor.LowResolutionAnimeImages)
l.Page("/editor/anime/ultralowresimage", editor.UltraLowResolutionAnimeImages)
l.Page("/editor/anime/ultralowresimage/:year", editor.UltraLowResolutionAnimeImages)
l.Page("/editor/anime/ultralowresimage/:year/:type", editor.UltraLowResolutionAnimeImages)
// Editor - MALdiff // Editor - MALdiff
l.Page("/editor/anime/maldiff", editor.CompareMAL) l.Page("/editor/anime/maldiff", editor.CompareMAL)