aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorjan <jan@ruken.pw>2016-10-09 19:00:11 (UTC)
committerjan <jan@ruken.pw>2016-10-09 19:00:11 (UTC)
commit908cfec0503d45ae73123e3a4640d513747b3fe7 (patch)
tree171be1e55b9cf41223d6988a7dcf637c6661bec7 /modules
parent5926a49f03db245ed3d920c2da4b4f814e6ba05f (diff)
bilder kommen jetzt wo anders her
Diffstat (limited to 'modules')
-rw-r--r--modules/grils/gril.go35
1 files changed, 4 insertions, 31 deletions
diff --git a/modules/grils/gril.go b/modules/grils/gril.go
index 0462e86..7b54ab1 100644
--- a/modules/grils/gril.go
+++ b/modules/grils/gril.go
@@ -3,7 +3,6 @@ package grils
3import ( 3import (
4 "database/sql" 4 "database/sql"
5 "fmt" 5 "fmt"
6 "os"
7 "strconv" 6 "strconv"
8 "strings" 7 "strings"
9 "time" 8 "time"
@@ -52,37 +51,11 @@ func (g *Gril) Slug() string {
52 strings.Replace(g.RomajiName, " ", "", -1)) 51 strings.Replace(g.RomajiName, " ", "", -1))
53} 52}
54 53
55func ImagePath(id int, prioritizeThumbnail bool) string { 54func ImagePath(id int, useThumbnail bool) string {
56 // Image Priority 55 if useThumbnail {
57 // without prioritizeThumbnail: Anilist > ACD (big) > ACD (thumbnail) 56 return fmt.Sprintf("http://img.grilist.moe/gril/thumb/%d.jpg", id)
58 // with prioritizeThumbnail: Anilist > ACD (thumbnail) > ACD (big)
59
60 anilistPath := fmt.Sprintf("assets/img/gril/%d/%d.jpg", DataSourceAnilist, id)
61 if _, err := os.Stat(anilistPath); err == nil {
62 return fmt.Sprintf(anilistPath)
63 }
64
65 var big string
66 exts := []string{"png", "jpg", "gif", "jpeg"}
67 for _, ext := range exts {
68 path := fmt.Sprintf("assets/img/gril/%d/%d/0.%s", DataSourceACD, id, ext)
69 if _, err := os.Stat(path); err == nil {
70 if prioritizeThumbnail {
71 big = path
72 } else {
73 return path
74 }
75 }
76 } 57 }
77 58 return fmt.Sprintf("http://img.grilist.moe/gril/full/%d.jpg", id)
78 for _, ext := range exts {
79 path := fmt.Sprintf("assets/img/gril/%d/%d/1.%s", DataSourceACD, id, ext)
80 if _, err := os.Stat(path); err == nil {
81 return path
82 }
83 }
84
85 return big
86} 59}
87 60
88func (g *Gril) ImagePath(prioritizeThumbnail bool) string { 61func (g *Gril) ImagePath(prioritizeThumbnail bool) string {