mirror of
				https://github.com/nkanaev/yarr.git
				synced 2025-10-30 22:43:29 +00:00 
			
		
		
		
	rewrite icon crawling
This commit is contained in:
		| @@ -76,10 +76,10 @@ func (s *Storage) UpdateFeedIcon(feedId int64, icon *[]byte) bool { | ||||
| } | ||||
|  | ||||
| func (s *Storage) ListFeeds() []Feed { | ||||
| 	result := make([]Feed, 0, 0) | ||||
| 	result := make([]Feed, 0) | ||||
| 	rows, err := s.db.Query(` | ||||
| 		select id, folder_id, title, description, link, feed_link, | ||||
| 		       ifnull(icon, '') != '' as has_icon | ||||
| 		       ifnull(length(icon), 0) > 0 as has_icon | ||||
| 		from feeds | ||||
| 		order by title collate nocase | ||||
| 	`) | ||||
| @@ -107,6 +107,36 @@ func (s *Storage) ListFeeds() []Feed { | ||||
| 	return result | ||||
| } | ||||
|  | ||||
| func (s *Storage) ListFeedsMissingIcons() []Feed { | ||||
| 	result := make([]Feed, 0) | ||||
| 	rows, err := s.db.Query(` | ||||
| 		select id, folder_id, title, description, link, feed_link | ||||
| 		from feeds | ||||
| 		where icon is null | ||||
| 	`) | ||||
| 	if err != nil { | ||||
| 		log.Print(err) | ||||
| 		return result | ||||
| 	} | ||||
| 	for rows.Next() { | ||||
| 		var f Feed | ||||
| 		err = rows.Scan( | ||||
| 			&f.Id, | ||||
| 			&f.FolderId, | ||||
| 			&f.Title, | ||||
| 			&f.Description, | ||||
| 			&f.Link, | ||||
| 			&f.FeedLink, | ||||
| 		) | ||||
| 		if err != nil { | ||||
| 			log.Print(err) | ||||
| 			return result | ||||
| 		} | ||||
| 		result = append(result, f) | ||||
| 	} | ||||
| 	return result | ||||
| } | ||||
|  | ||||
| func (s *Storage) GetFeed(id int64) *Feed { | ||||
| 	var f Feed | ||||
| 	err := s.db.QueryRow(` | ||||
|   | ||||
		Reference in New Issue
	
	Block a user