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 // Searches for the given Episode in this Anime's Episodes list
105 // and returns the match.
107 // Returns nil if there is no match.
108 func (a *Anime) Episode(ep *misc.Episode) *Episode {
109 for i, e := range a.Episodes {
110 if ep.ContainsEpisodes(&e.Episode) {
111 return &a.Episodes[i]
117 // Convenience method that parses the string into an Episode
118 // before doing the Episode search.
119 func (a *Anime) EpisodeByString(name string) *Episode {
120 return a.Episode(misc.ParseEpisode(name))
123 // Convenience method that parses the int into an Episode
124 // before doing the Episode search.
126 // Only works with regular (i.e. not special, etc) episodes.
127 func (a *Anime) EpisodeByNumber(number int) *Episode {
128 return a.EpisodeByString(strconv.Itoa(number))