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 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 Episodes // 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 type EpisodeCount struct {
92 // Convenience method that runs AnimeByID on the result of
94 func (adb *AniDB) AnimeByName(name string) <-chan *Anime {
95 return adb.AnimeByID(SearchAnime(name))
98 // Convenience method that runs AnimeByID on the result of
100 func (adb *AniDB) AnimeByNameFold(name string) <-chan *Anime {
101 return adb.AnimeByID(SearchAnimeFold(name))
104 // Returns a list of all Episodes in this Anime's Episodes list
105 // that are contained by the given EpisodeContainer.
106 func (a *Anime) EpisodeList(c misc.EpisodeContainer) (eps []*Episode) {
107 if a == nil || c == nil {
111 for i, e := range a.Episodes {
112 if c.ContainsEpisodes(&e.Episode) {
113 eps = append(eps, a.Episodes[i])
119 // Searches for the given Episode in this Anime's Episodes list
120 // and returns the match.
122 // Returns nil if there is no match.
123 func (a *Anime) Episode(ep *misc.Episode) *Episode {
124 switch list := a.EpisodeList(ep); len(list) {
130 panic("Single episode search returned more than one result")
134 // Convenience method that parses the string into an Episode
135 // before doing the Episode search.
136 func (a *Anime) EpisodeByString(name string) *Episode {
137 return a.Episode(misc.ParseEpisode(name))
140 // Convenience method that parses the int into an Episode
141 // before doing the Episode search.
143 // Only works with regular (i.e. not special, etc) episodes.
144 func (a *Anime) EpisodeByNumber(number int) *Episode {
145 return a.EpisodeByString(strconv.Itoa(number))