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