diff options
Diffstat (limited to 'modules/grils/gril.go')
-rw-r--r-- | modules/grils/gril.go | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/modules/grils/gril.go b/modules/grils/gril.go index fe316cd..89dd7c4 100644 --- a/modules/grils/gril.go +++ b/modules/grils/gril.go | |||
@@ -3,9 +3,12 @@ package grils | |||
3 | import ( | 3 | import ( |
4 | "database/sql" | 4 | "database/sql" |
5 | "fmt" | 5 | "fmt" |
6 | "github.com/lib/pq" | ||
7 | "os" | 6 | "os" |
7 | "strconv" | ||
8 | "strings" | ||
8 | "time" | 9 | "time" |
10 | |||
11 | "github.com/lib/pq" | ||
9 | ) | 12 | ) |
10 | 13 | ||
11 | type DataSource int | 14 | type DataSource int |
@@ -28,6 +31,16 @@ type Gril struct { | |||
28 | Lists []int | 31 | Lists []int |
29 | } | 32 | } |
30 | 33 | ||
34 | func (g *Gril) Slug() string { | ||
35 | if g.RomajiName == "" { | ||
36 | return strconv.Itoa(g.ID) | ||
37 | } | ||
38 | return fmt.Sprintf( | ||
39 | "%d/%s", | ||
40 | g.ID, | ||
41 | strings.Replace(g.RomajiName, " ", "", -1)) | ||
42 | } | ||
43 | |||
31 | func (g *Gril) ImagePath(prioritizeThumbnail bool) string { | 44 | func (g *Gril) ImagePath(prioritizeThumbnail bool) string { |
32 | var big string | 45 | var big string |
33 | exts := []string{"png", "jpg", "gif", "jpeg"} | 46 | exts := []string{"png", "jpg", "gif", "jpeg"} |