non-crashing CSpot + spi_master and override fixes

This commit is contained in:
Philippe G
2022-01-04 13:52:45 -08:00
parent 33c7ba820d
commit e59188ec44
15 changed files with 52 additions and 30 deletions

View File

@@ -35,8 +35,8 @@ SpotifyTrack::~SpotifyTrack()
{
this->manager->unregisterMercuryCallback(this->reqSeqNum);
this->manager->freeAudioKeyCallback();
pbFree(Track_fields, &this->trackInfo);
pbFree(Episode_fields, &this->episodeInfo);
pb_release(Track_fields, this->trackInfo);
pb_release(Episode_fields, this->episodeInfo);
}
bool SpotifyTrack::countryListContains(std::string countryList, std::string country)
@@ -142,6 +142,21 @@ void SpotifyTrack::episodeInformationCallback(std::unique_ptr<MercuryResponse> r
}
}
if (trackInfoReceived != nullptr)
{
auto imageId = pbArrayToVector(episodeInfo.covers->image[0].file_id);
TrackInfo simpleTrackInfo = {
.name = std::string(episodeInfo.name),
.album = "",
.artist = "",
.imageUrl = "https://i.scdn.co/image/" + bytesToHexString(imageId),
.duration = trackInfo.duration,
};
trackInfoReceived(simpleTrackInfo);
}
this->requestAudioKey(pbArrayToVector(episodeInfo.gid), this->fileId, episodeInfo.duration, position_ms, isPaused);
}