1

Having a bit of a problem getting cover art when using findAlbums with the GNSDK, but identifyAlbumAsync works perfectly. If you looked at the iOS sample code, you'll see that the code I have to iterate the albums returned is the same used when the app uses the mic to ID a track. I attached this code to showTextSearch() so that I can easily test it. Ten albums are returned for this query.

    do
    {
        let musicID = try GnMusicId(user: gnUser, locale: gnLocale, statusEventsDelegate: self)

        let responseAlbums = try musicID.findAlbums(withAlbumTitle: "Born To Run", trackTitle: nil, albumArtistName: "Bruce Springsteen", trackArtistName: nil, composerName: nil)

        var albums:GnAlbumEnumerator
        if (responseAlbums.isKind(of: GnResponseAlbums.self))
        {
            albums = responseAlbums.albums()
        }
        else
        {
            albums = responseAlbums as! GnAlbumEnumerator
        }

        for a in albums
        {
            let album = a as! GnAlbum
            let coverArtContent = album.coverArt()
            let coverArtAsset = coverArtContent?.asset(kImageSizeSmall)

            let artistImageContent = album.artist()?.contributor()?.image()
            let artistImageAsset = artistImageContent?.asset(kImageSizeSmall);
        }
    }
    catch
    {
        print("Error")
    }

I get a lot of album data back, but no album art. My config ID is correct for GNSDK, and my license file is correct as far as I know. The documentation is iffy at best, so maybe I missed something, but I couldn't find anything that said why findAlbums would not return cover art when identifyAlbumAsync does.

In any case, for each iteration of the ten albums, coverArtContent and aristImageContent are nil. I even tried being more specific with trackTitle and trackArtistName to no avail.

Any ideas on why this would be happening? Thanks.

Michael Gaines
  • 383
  • 3
  • 13

1 Answers1

0

Well, I figured out the problem. Add this after musicID is set:

        let gnMusicIdStreamOptions = musicID.options()
        try gnMusicIdStreamOptions.resultSingle(bEnable: true)
        try gnMusicIdStreamOptions.lookupData(lookupData: kLookupDataSonicData, bEnable:true)
        try gnMusicIdStreamOptions.lookupData(lookupData: kLookupDataContent, bEnable:true)
        try gnMusicIdStreamOptions.preferResultCoverart(bEnable: true)
Michael Gaines
  • 383
  • 3
  • 13