예제 #1
0
파일: helpers.go 프로젝트: BurntSushi/goim
// 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())
}
예제 #2
0
파일: helpers.go 프로젝트: BurntSushi/goim
// 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())
}