本文整理匯總了Golang中github.com/haarts/getme/store.Show.StoreSeasonSnippet方法的典型用法代碼示例。如果您正苦於以下問題:Golang Show.StoreSeasonSnippet方法的具體用法?Golang Show.StoreSeasonSnippet怎麽用?Golang Show.StoreSeasonSnippet使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/haarts/getme/store.Show
的用法示例。
在下文中一共展示了Show.StoreSeasonSnippet方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Search
func Search(show *store.Show) ([]Torrent, error) {
// torrents holds the torrents to complete a serie
var torrents []Torrent
// TODO perhaps mashing season and episode jobs together is a bad idea
queryJobs := createQueryJobs(show)
for _, queryJob := range queryJobs {
torrent, err := executeJob(queryJob)
if err != nil {
continue
}
torrent.AssociatedMedia = queryJob.media
queryJob.snippet.Score = torrent.seeds
// *ouch* this type switch is ugly
switch queryJob.media.(type) {
case *store.Season:
show.StoreSeasonSnippet(queryJob.snippet)
case *store.Episode:
show.StoreEpisodeSnippet(queryJob.snippet)
default:
panic("unknown media type")
}
torrents = append(torrents, *torrent)
}
return torrents, nil
}