5 "github.com/Kovensky/go-anidb/misc"
10 // See the constants list for the valid values.
14 AnimeTypeTVSeries = AnimeType("TV Series") // Anime was a regular TV broadcast series
15 AnimeTypeTVSpecial = AnimeType("TV Special") // Anime was broadcast on TV as a special
16 AnimeTypeMovie = AnimeType("Movie") // Anime was a feature film
17 AnimeTypeOVA = AnimeType("OVA") // Anime was released direct-to-video
18 AnimeTypeWeb = AnimeType("Web") // Anime was released through online streaming or downloads
19 AnimeTypeMusicVideo = AnimeType("Music Video")
27 type Resource []string
29 // Links to third party websites
30 type Resources struct {
46 type UniqueTitleMap map[Language]string
47 type TitleMap map[Language][]string
50 AID AID // The Anime ID.
51 R18 bool // Whether this anime is considered porn.
53 Type AnimeType // Production/distribution type.
54 TotalEpisodes int // Total number of regular episodes.
55 EpisodeCount misc.EpisodeCount // Known numbers of the various types of episodes.
57 StartDate time.Time // Date of first episode release, if available.
58 EndDate time.Time // Date of last episode release, if available.
60 PrimaryTitle string // The primary title in the database; almost always a romanization of the Japanese title.
61 OfficialTitles UniqueTitleMap // The official title for each language.
62 ShortTitles TitleMap // Shortcut titles used for searches
63 Synonyms TitleMap // Synonyms for each language, or unofficial titles
65 OfficialURL string // URL for original official website.
66 Picture string // URL for the page picture on AniDB.
70 Votes Rating // Votes from people who watched the whole thing.
71 TemporaryVotes Rating // Votes from people who are still watching this.
72 Reviews Rating // Votes from reviewers.
74 Episodes []*Episode // List of episodes.
79 Incomplete bool // Set if the UDP API part of the query failed.
80 Updated time.Time // When the data was last modified in the server.
81 Cached time.Time // When the data was retrieved from the server.
84 // Convenience method that runs AnimeByID on the result of
86 func (adb *AniDB) AnimeByName(name string) <-chan *Anime {
87 return adb.AnimeByID(SearchAnime(name))
90 // Convenience method that runs AnimeByID on the result of
92 func (adb *AniDB) AnimeByNameFold(name string) <-chan *Anime {
93 return adb.AnimeByID(SearchAnimeFold(name))
96 // Returns a list of all Episodes in this Anime's Episodes list
97 // that are contained by the given EpisodeContainer.
98 func (a *Anime) EpisodeList(c misc.EpisodeContainer) (eps []*Episode) {
99 if a == nil || c == nil {
103 for i, e := range a.Episodes {
104 if c.ContainsEpisodes(&e.Episode) {
105 eps = append(eps, a.Episodes[i])
111 // Searches for the given Episode in this Anime's Episodes list
112 // and returns the match.
114 // Returns nil if there is no match.
115 func (a *Anime) Episode(ep *misc.Episode) *Episode {
116 switch list := a.EpisodeList(ep); len(list) {
122 panic(fmt.Sprintf("Single episode search returned more than one result (wanted %v, got %v)", ep, list))
126 // Convenience method that parses the string into an Episode
127 // before doing the Episode search.
128 func (a *Anime) EpisodeByString(name string) *Episode {
129 return a.Episode(misc.ParseEpisode(name))
132 // Convenience method that parses the int into an Episode
133 // before doing the Episode search.
135 // Only works with regular (i.e. not special, etc) episodes.
136 func (a *Anime) EpisodeByNumber(number int) *Episode {
137 return a.EpisodeByString(strconv.Itoa(number))
140 func (a *Anime) EpisodeByEID(eid EID) *Episode {
144 for _, ep := range a.Episodes {