diff options
Diffstat (limited to 'modules/grils/gril.go')
| -rw-r--r-- | modules/grils/gril.go | 63 |
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 @@ | |||
| 1 | package grils | ||
| 2 | |||
| 3 | import ( | ||
| 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 | |||
| 15 | type DataSource int | ||
| 16 | |||
| 17 | const ( | ||
| 18 | DataSourceACD DataSource = iota | ||
| 19 | DataSourceAniDB | ||
| 20 | DataSourceAnilist | ||
| 21 | ) | ||
| 22 | |||
| 23 | type Trait struct { | ||
| 24 | Name string | ||
| 25 | Value string | ||
| 26 | OfficialValue string | ||
| 27 | } | ||
| 28 | |||
| 29 | type 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 | |||
| 44 | func (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 | |||
| 54 | func 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 | |||
| 61 | func (g *Gril) ImagePath(prioritizeThumbnail bool) string { | ||
| 62 | return ImagePath(g.ID, prioritizeThumbnail) | ||
| 63 | } | ||
