This repository has been archived by the owner on Jun 3, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathAnimeRelation.go
62 lines (56 loc) · 1.63 KB
/
AnimeRelation.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package arn
// Register a list of supported anime relation types.
func init() {
DataLists["anime-relation-types"] = []*Option{
{"prequel", HumanReadableAnimeRelation("prequel")},
{"sequel", HumanReadableAnimeRelation("sequel")},
{"alternative version", "Alternative version"},
{"alternative setting", "Alternative setting"},
{"side story", HumanReadableAnimeRelation("side story")},
{"parent story", HumanReadableAnimeRelation("parent story")},
{"full story", HumanReadableAnimeRelation("full story")},
{"spinoff", HumanReadableAnimeRelation("spinoff")},
{"summary", HumanReadableAnimeRelation("summary")},
{"other", HumanReadableAnimeRelation("other")},
}
}
// AnimeRelation ...
type AnimeRelation struct {
AnimeID string `json:"animeId" editable:"true"`
Type string `json:"type" editable:"true" datalist:"anime-relation-types"`
}
// Anime ...
func (relation *AnimeRelation) Anime() *Anime {
anime, _ := GetAnime(relation.AnimeID)
return anime
}
// HumanReadableType ...
func (relation *AnimeRelation) HumanReadableType() string {
return HumanReadableAnimeRelation(relation.Type)
}
// HumanReadableAnimeRelation ...
func HumanReadableAnimeRelation(relationName string) string {
switch relationName {
case "prequel":
return "Prequel"
case "sequel":
return "Sequel"
case "alternative version":
return "Alternative"
case "alternative setting":
return "Alternative"
case "side story":
return "Side story"
case "parent story":
return "Parent story"
case "full story":
return "Full story"
case "spinoff":
return "Spin-off"
case "summary":
return "Summary"
case "other":
return "Other"
}
return relationName
}