func feedsource_find(q string) ([]ReadEntity, error) { svc := google.NewGoogleFeedApi(refer, backend_context.config.FeedSourceFolder) v, err := svc.Find(q, backend_context.config.Language) if err != nil { return nil, err } var uris []string for _, ve := range v { uris = append(uris, ve.Uri) } dbo := new_feedsource_operator() subed, err := dbo.findbatch(uris) if err != nil { return nil, err } urims := make(map[string]bool) for _, ve := range subed { urims[ve.Uri] = true } rv := from_feedentities(v) for i := 0; i < len(rv); i++ { if _, ok := urims[rv[i].Uri]; !ok { rv[i].SubscribeState = ReadSourceSubscribeStateUnsubscribed } } return rv, err }
func feedsource_show(uri string) (ReadEntity, error) { g := google.NewGoogleFeedApi(refer, backend_context.config.FeedSourceFolder) fs, err := g.Load(uri, backend_context.config.Language, 4, false) if err != nil { return ReadEntity{}, err } rs := new_readsource(fs.FeedSource) if _, err := new_feedsource_operator().find(uri); err != nil { rs.SubscribeState = ReadSourceSubscribeStateUnsubscribed } entries := readentry_filter(new_readentries(fs.Entries)) return new_readentity(rs, entries), err }