fix: use CoverArtID if available and LastFM image url otherwise
This commit is contained in:
+34
-26
@@ -361,18 +361,18 @@ const artistBioNotAvailableKey = "Artist biography not available."
|
|||||||
type ArtistPageHeader struct {
|
type ArtistPageHeader struct {
|
||||||
widget.BaseWidget
|
widget.BaseWidget
|
||||||
|
|
||||||
artistID string
|
artistID string
|
||||||
artistPage *ArtistPage
|
artistPage *ArtistPage
|
||||||
artistImage *widgets.ImagePlaceholder
|
artistImage *widgets.ImagePlaceholder
|
||||||
artistImageID string
|
artistImageID string
|
||||||
titleDisp *widget.RichText
|
titleDisp *widget.RichText
|
||||||
biographyDisp *widgets.MaxRowsLabel
|
biographyDisp *widgets.MaxRowsLabel
|
||||||
similarArtists *fyne.Container
|
similarArtists *fyne.Container
|
||||||
favoriteBtn *widgets.FavoriteButton
|
favoriteBtn *widgets.FavoriteButton
|
||||||
playBtn *widget.Button
|
playBtn *widget.Button
|
||||||
playRadioBtn *widget.Button
|
playRadioBtn *widget.Button
|
||||||
menuBtn *widget.Button
|
menuBtn *widget.Button
|
||||||
container *fyne.Container
|
container *fyne.Container
|
||||||
fullSizeCoverFetching bool
|
fullSizeCoverFetching bool
|
||||||
//shareMenuItem *fyne.MenuItem
|
//shareMenuItem *fyne.MenuItem
|
||||||
}
|
}
|
||||||
@@ -459,10 +459,12 @@ func (a *ArtistPageHeader) Update(artist *mediaprovider.ArtistWithAlbums, im *ba
|
|||||||
a.favoriteBtn.IsFavorited = artist.Favorite
|
a.favoriteBtn.IsFavorited = artist.Favorite
|
||||||
a.favoriteBtn.Refresh()
|
a.favoriteBtn.Refresh()
|
||||||
a.artistID = artist.ID
|
a.artistID = artist.ID
|
||||||
a.artistImageID = artist.CoverArtID
|
|
||||||
a.titleDisp.Segments[0].(*widget.TextSegment).Text = artist.Name
|
a.titleDisp.Segments[0].(*widget.TextSegment).Text = artist.Name
|
||||||
a.titleDisp.Refresh()
|
a.titleDisp.Refresh()
|
||||||
|
if artist.CoverArtID == "" {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
a.artistImageID = artist.CoverArtID
|
||||||
go func() {
|
go func() {
|
||||||
if cover, err := im.GetCoverThumbnail(artist.CoverArtID); err == nil {
|
if cover, err := im.GetCoverThumbnail(artist.CoverArtID); err == nil {
|
||||||
a.artistImage.SetImage(cover, true)
|
a.artistImage.SetImage(cover, true)
|
||||||
@@ -520,18 +522,24 @@ func (a *ArtistPageHeader) UpdateInfo(info *mediaprovider.ArtistInfo) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *ArtistPageHeader) showPopUpCover() {
|
func (a *ArtistPageHeader) showPopUpCover() {
|
||||||
if a.fullSizeCoverFetching {
|
if a.artistImageID == "" {
|
||||||
return
|
if im := a.artistImage.Image(); im != nil {
|
||||||
}
|
a.artistPage.contr.ShowPopUpImage(im)
|
||||||
a.fullSizeCoverFetching = true
|
}
|
||||||
defer func() { a.fullSizeCoverFetching = false }()
|
} else {
|
||||||
cover, err := a.artistPage.im.GetFullSizeCoverArt(a.artistImageID)
|
if a.fullSizeCoverFetching {
|
||||||
if err != nil {
|
return
|
||||||
log.Printf("error getting full size album cover: %s", err.Error())
|
}
|
||||||
return
|
a.fullSizeCoverFetching = true
|
||||||
}
|
defer func() { a.fullSizeCoverFetching = false }()
|
||||||
if a.artistPage != nil {
|
cover, err := a.artistPage.im.GetFullSizeCoverArt(a.artistImageID)
|
||||||
a.artistPage.contr.ShowPopUpImage(cover)
|
if err != nil {
|
||||||
|
log.Printf("error getting full size album cover: %s", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if a.artistPage != nil {
|
||||||
|
a.artistPage.contr.ShowPopUpImage(cover)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user