本文整理匯總了Golang中github.com/urandom/readeef/content.Feed.NewArticles方法的典型用法代碼示例。如果您正苦於以下問題:Golang Feed.NewArticles方法的具體用法?Golang Feed.NewArticles怎麽用?Golang Feed.NewArticles使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/urandom/readeef/content.Feed
的用法示例。
在下文中一共展示了Feed.NewArticles方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: FeedUpdated
func (t Thumbnailer) FeedUpdated(feed content.Feed) error {
t.logger.Debugln("Generating thumbnailer processors")
processors := t.generateProcessors(feed.NewArticles())
numProcessors := 20
done := make(chan struct{})
errc := make(chan error)
defer close(done)
var wg sync.WaitGroup
wg.Add(numProcessors)
for i := 0; i < numProcessors; i++ {
go func() {
err := t.process(done, processors)
if err != nil {
errc <- err
}
wg.Done()
}()
}
go func() {
wg.Wait()
close(errc)
}()
for err := range errc {
return err
}
return nil
}
示例2: processFeedUpdateMonitors
func (fm FeedManager) processFeedUpdateMonitors(f content.Feed) {
if len(f.NewArticles()) > 0 {
for _, m := range fm.feedMonitors {
if err := m.FeedUpdated(f); err != nil {
fm.logger.Printf("Error invoking monitor '%s' on updated feed '%s': %v\n",
reflect.TypeOf(m), f, err)
}
}
} else {
fm.logger.Infoln("No new articles for " + f.String())
}
}
示例3: UpdateFeed
func (si SearchIndex) UpdateFeed(feed content.Feed) {
si.logger.Infof("Updating article search index for feed '%s'\n", feed)
newArticleLinks := map[string]bool{}
for _, a := range feed.NewArticles() {
newArticleLinks[a.Data().Link] = true
}
var articles []content.Article
for _, a := range feed.ParsedArticles() {
if newArticleLinks[a.Data().Link] {
articles = append(articles, a)
}
}
si.batchIndex(articles)
}
示例4: FeedUpdated
func (i Index) FeedUpdated(feed content.Feed) error {
i.logger.Infof("Updating article search index for feed '%s'\n", feed)
return i.provider.BatchIndex(feed.NewArticles(), data.BatchAdd)
}