Beispiel #1
0
// countEpisodes returns the number of episodes for the TV show given.
func countEpisodes(e imdb.Entity) int {
	assertDB()
	q := `
		SELECT COUNT(*)
		FROM episode
		WHERE tvshow_atom_id = $1 AND season > 0 AND episode_num > 0
	`
	return csql.Count(tplDB, q, e.Ident())
}
Beispiel #2
0
// countSeasons returns the number of seasons for the TV show given.
func countSeasons(e imdb.Entity) int {
	assertDB()
	q := `
		SELECT COUNT(*)
		FROM (
			SELECT season
			FROM episode
			WHERE tvshow_atom_id = $1 AND season > 0 AND episode_num > 0
			GROUP BY season
		) AS sub
	`
	return csql.Count(tplDB, q, e.Ident())
}