cspot duration

This commit is contained in:
Philippe G
2021-12-26 15:48:25 -08:00
parent 676acbdbc2
commit e85733fc32
6 changed files with 33 additions and 27 deletions

View File

@@ -32,9 +32,9 @@ message Artist {
message Track {
optional bytes gid = 1;
optional string name = 2;
optional sint32 duration = 0x7;
optional Album album = 0x3;
repeated Artist artist = 0x4;
optional sint32 duration = 0x7;
repeated Restriction restriction = 0xb;
repeated AudioFile file = 0xc;
repeated Track alternative = 0xd;

View File

@@ -36,6 +36,7 @@ template int64_t PbReader::decodeFixed();
template uint32_t PbReader::decodeVarInt();
template int64_t PbReader::decodeVarInt();
template int32_t PbReader::decodeVarInt();
template bool PbReader::decodeVarInt();
void PbReader::resetMaxPosition()

View File

@@ -91,6 +91,10 @@ void decodeField(std::shared_ptr<PbReader> reader, AnyRef any)
{
*any.as<int64_t>() = reader->decodeVarInt<int64_t>();
}
else if (any.is<int32_t>())
{
*any.as<int32_t>() = reader->decodeVarInt<int32_t>();
}
else
{
reader->skip();

View File

@@ -74,6 +74,7 @@ void SpotifyTrack::trackInformationCallback(std::unique_ptr<MercuryResponse> res
trackInfo = decodePb<Track>(response->parts[0]);
CSPOT_LOG(info, "Track name: %s", trackInfo.name.value().c_str());
CSPOT_LOG(info, "Track duration: %d", trackInfo.duration.value());
CSPOT_LOG(debug, "trackInfo.restriction.size() = %d", trackInfo.restriction.size());
int altIndex = 0;