diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/grils/gril.go | 35 |
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 | |||
3 | import ( | 3 | import ( |
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 | ||
55 | func ImagePath(id int, prioritizeThumbnail bool) string { | 54 | func 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 | ||
88 | func (g *Gril) ImagePath(prioritizeThumbnail bool) string { | 61 | func (g *Gril) ImagePath(prioritizeThumbnail bool) string { |