Silently avoid empty description and note

This commit is contained in:
2016-01-17 20:50:58 +01:00
parent 56ee04e768
commit 53b2d9c07b

View File

@@ -134,10 +134,14 @@ func (c *AlbumDescriptionCache) fetchAndCache(ID AlbumID) (*AlbumDescription, er
waitSize++ waitSize++
go func() { go func() {
description := principal.Find(".bandeau-info p.auto-height span") description := principal.Find(".bandeau-info p.auto-height span")
if description.Size() != 1 { if description.Size() > 1 {
errors <- fmt.Errorf("Could not find a single description, found %d", description.Size()) errors <- fmt.Errorf("Could not find a single description, found %d", description.Size())
return return
} }
if description.Size() == 0 {
errors <- nil
return
}
res.Description = description.Text() res.Description = description.Text()
errors <- nil errors <- nil
}() }()
@@ -150,7 +154,10 @@ func (c *AlbumDescriptionCache) fetchAndCache(ID AlbumID) (*AlbumDescription, er
} }
m := noteRx.FindStringSubmatch(note.Text()) m := noteRx.FindStringSubmatch(note.Text())
if m == nil { if m == nil {
errors <- fmt.Errorf("Could not parse note with regexp %s", noteRx) res.Note = -1.0
// we simply ignore because there is most likely no note
errors <- nil
//errors <- fmt.Errorf("Could not parse note with regexp %s", noteRx)
return return
} }
noteTmp, err := strconv.ParseFloat(m[1], 64) noteTmp, err := strconv.ParseFloat(m[1], 64)