ソースを参照

fix country code in cspot

philippe44 1 年間 前
コミット
a9a9018794

+ 2 - 2
components/spotify/cspot/src/MercurySession.cpp

@@ -120,9 +120,9 @@ void MercurySession::handlePacket() {
   switch (static_cast<RequestType>(packet.command)) {
     case RequestType::COUNTRY_CODE_RESPONSE: {
       this->countryCode = std::string();
-      this->countryCode.reserve(2);
+      this->countryCode.resize(2);
       memcpy(this->countryCode.data(), packet.data.data(), 2);
-      CSPOT_LOG(debug, "Received country code");
+      CSPOT_LOG(debug, "Received country code %s", this->countryCode.c_str());
       break;
     }
     case RequestType::AUDIO_KEY_FAILURE_RESPONSE:

+ 3 - 4
components/spotify/cspot/src/TrackProvider.cpp

@@ -77,12 +77,11 @@ void TrackProvider::onMetadataResponse(MercurySession::Response& res) {
 
   std::vector<uint8_t> trackId;
   std::vector<uint8_t> fileId;
-  AudioFormat format = AudioFormat_OGG_VORBIS_160;
-
+  
   if (altIndex < 0) {
     trackId = pbArrayToVector(trackInfo.gid);
     for (int x = 0; x < trackInfo.file_count; x++) {
-      if (trackInfo.file[x].format == format) {
+      if (trackInfo.file[x].format == ctx->config.audioFormat) {
         fileId = pbArrayToVector(trackInfo.file[x].file_id);
         break;  // If file found stop searching
       }
@@ -90,7 +89,7 @@ void TrackProvider::onMetadataResponse(MercurySession::Response& res) {
   } else {
     trackId = pbArrayToVector(trackInfo.alternative[altIndex].gid);
     for (int x = 0; x < trackInfo.alternative[altIndex].file_count; x++) {
-      if (trackInfo.alternative[altIndex].file[x].format == format) {
+      if (trackInfo.alternative[altIndex].file[x].format == ctx->config.audioFormat) {
         fileId =
             pbArrayToVector(trackInfo.alternative[altIndex].file[x].file_id);
         break;  // If file found stop searching

+ 3 - 3
components/squeezelite/decode_external.c

@@ -123,7 +123,7 @@ static bool bt_sink_cmd_handler(bt_sink_cmd_t cmd, va_list args)
 {
 	// don't LOCK_O as there is always a chance that LMS takes control later anyway
 	if (output.external != DECODE_BT && output.state > OUTPUT_STOPPED) {
-		LOG_WARN("Cannot use BT sink while LMS/AirPlay/CSpot are controlling player");
+		LOG_WARN("Cannot use BT sink while LMS/AirPlay/CSpot are controlling player %d", output.external);
 		return false;
 	} 	
 
@@ -205,7 +205,7 @@ static bool raop_sink_cmd_handler(raop_event_t event, va_list args)
 {
 	// don't LOCK_O as there is always a chance that LMS takes control later anyway
 	if (output.external != DECODE_RAOP && output.state > OUTPUT_STOPPED) {
-		LOG_WARN("Cannot use Airplay sink while LMS/BT/CSpot are controlling player");
+		LOG_WARN("Cannot use Airplay sink while LMS/BT/CSpot are controlling player %d", output.external);
 		return false;
 	} 	
 
@@ -338,7 +338,7 @@ static bool cspot_cmd_handler(cspot_event_t cmd, va_list args)
 {
 	// don't LOCK_O as there is always a chance that LMS takes control later anyway
 	if (output.external != DECODE_CSPOT && output.state > OUTPUT_STOPPED) {
-		LOG_WARN("Cannot use CSpot sink while LMS/BT/Airplay are controlling player");
+		LOG_WARN("Cannot use CSpot sink while LMS/BT/Airplay are controlling player %d", output.external);
 		return false;
 	}