aboutsummaryrefslogtreecommitdiff
path: root/modules/grils/gril.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/grils/gril.go')
-rw-r--r--modules/grils/gril.go63
1 files changed, 0 insertions, 63 deletions
diff --git a/modules/grils/gril.go b/modules/grils/gril.go
deleted file mode 100644
index 7b54ab1..0000000
--- a/modules/grils/gril.go
+++ /dev/null
@@ -1,63 +0,0 @@
1package grils
2
3import (
4 "database/sql"
5 "fmt"
6 "strconv"
7 "strings"
8 "time"
9
10 "fagott.pw/grilist/modules/series"
11
12 "github.com/lib/pq"
13)
14
15type DataSource int
16
17const (
18 DataSourceACD DataSource = iota
19 DataSourceAniDB
20 DataSourceAnilist
21)
22
23type Trait struct {
24 Name string
25 Value string
26 OfficialValue string
27}
28
29type Gril struct {
30 ID int
31 KanjiName string
32 RomajiName string
33 OtherNames []string
34 Age sql.NullInt64
35 Birthday pq.NullTime
36 Tags []string
37 Traits []Trait
38 ForeignIDs map[DataSource]int
39 UpdatedAt time.Time
40 Lists []int
41 Series []series.Series
42}
43
44func (g *Gril) Slug() string {
45 if g.RomajiName == "" {
46 return strconv.Itoa(g.ID)
47 }
48 return fmt.Sprintf(
49 "%d/%s",
50 g.ID,
51 strings.Replace(g.RomajiName, " ", "", -1))
52}
53
54func ImagePath(id int, useThumbnail bool) string {
55 if useThumbnail {
56 return fmt.Sprintf("http://img.grilist.moe/gril/thumb/%d.jpg", id)
57 }
58 return fmt.Sprintf("http://img.grilist.moe/gril/full/%d.jpg", id)
59}
60
61func (g *Gril) ImagePath(prioritizeThumbnail bool) string {
62 return ImagePath(g.ID, prioritizeThumbnail)
63}