mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-14 15:37:10 +03:00
update cspot
This commit is contained in:
@@ -3,12 +3,12 @@
|
||||
#include <stdint.h>
|
||||
#include <memory>
|
||||
|
||||
#include "Crypto.h"
|
||||
#include "LoginBlob.h"
|
||||
#include "MercurySession.h"
|
||||
#include "TimeProvider.h"
|
||||
#include "Crypto.h"
|
||||
#include "protobuf/authentication.pb.h" // for AuthenticationType_AUTHE...
|
||||
#include "protobuf/metadata.pb.h"
|
||||
#include "protobuf/authentication.pb.h" // for AuthenticationType_AUTHE...
|
||||
#ifdef BELL_ONLY_CJSON
|
||||
#include "cJSON.h"
|
||||
#else
|
||||
@@ -37,24 +37,28 @@ struct Context {
|
||||
std::shared_ptr<cspot::MercurySession> session;
|
||||
std::string getCredentialsJson() {
|
||||
#ifdef BELL_ONLY_CJSON
|
||||
cJSON* json_obj = cJSON_CreateObject();
|
||||
cJSON_AddStringToObject(json_obj, "authData", Crypto::base64Encode(config.authData).c_str());
|
||||
cJSON_AddNumberToObject(json_obj, "authType", AuthenticationType_AUTHENTICATION_STORED_SPOTIFY_CREDENTIALS);
|
||||
cJSON_AddStringToObject(json_obj, "username", config.username.c_str());
|
||||
cJSON* json_obj = cJSON_CreateObject();
|
||||
cJSON_AddStringToObject(json_obj, "authData",
|
||||
Crypto::base64Encode(config.authData).c_str());
|
||||
cJSON_AddNumberToObject(
|
||||
json_obj, "authType",
|
||||
AuthenticationType_AUTHENTICATION_STORED_SPOTIFY_CREDENTIALS);
|
||||
cJSON_AddStringToObject(json_obj, "username", config.username.c_str());
|
||||
|
||||
char* str = cJSON_PrintUnformatted(json_obj);
|
||||
cJSON_Delete(json_obj);
|
||||
std::string json_objStr(str);
|
||||
free(str);
|
||||
char* str = cJSON_PrintUnformatted(json_obj);
|
||||
cJSON_Delete(json_obj);
|
||||
std::string json_objStr(str);
|
||||
free(str);
|
||||
|
||||
return json_objStr;
|
||||
return json_objStr;
|
||||
#else
|
||||
nlohmann::json obj;
|
||||
obj["authData"] = Crypto::base64Encode(config.authData);
|
||||
obj["authType"] = AuthenticationType_AUTHENTICATION_STORED_SPOTIFY_CREDENTIALS;
|
||||
obj["username"] = config.username;
|
||||
nlohmann::json obj;
|
||||
obj["authData"] = Crypto::base64Encode(config.authData);
|
||||
obj["authType"] =
|
||||
AuthenticationType_AUTHENTICATION_STORED_SPOTIFY_CREDENTIALS;
|
||||
obj["username"] = config.username;
|
||||
|
||||
return obj.dump();
|
||||
return obj.dump();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -88,8 +88,8 @@ class MercurySession : public bell::Task, public cspot::Session {
|
||||
void unregisterAudioKey(uint32_t sequenceId);
|
||||
|
||||
uint32_t requestAudioKey(const std::vector<uint8_t>& trackId,
|
||||
const std::vector<uint8_t>& fileId,
|
||||
AudioKeyCallback audioCallback);
|
||||
const std::vector<uint8_t>& fileId,
|
||||
AudioKeyCallback audioCallback);
|
||||
|
||||
std::string getCountryCode();
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <variant> // for variant
|
||||
#include <vector> // for vector
|
||||
|
||||
#include "CDNAudioFile.h" // for CDNTrackStream, CDNTrackStream::Track...
|
||||
#include "CDNAudioFile.h" // for CDNTrackStream, CDNTrackStream::Track...
|
||||
#include "TrackQueue.h"
|
||||
#include "protobuf/spirc.pb.h" // for MessageType
|
||||
|
||||
|
||||
@@ -33,7 +33,8 @@ class TrackPlayer : bell::Task {
|
||||
public:
|
||||
// Callback types
|
||||
typedef std::function<void(std::shared_ptr<QueuedTrack>)> TrackLoadedCallback;
|
||||
typedef std::function<size_t(uint8_t*, size_t, std::string_view)> DataCallback;
|
||||
typedef std::function<size_t(uint8_t*, size_t, std::string_view)>
|
||||
DataCallback;
|
||||
typedef std::function<void()> EOFCallback;
|
||||
typedef std::function<bool()> isAiringCallback;
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
#include <stddef.h> // for size_t
|
||||
#include <atomic>
|
||||
#include <deque>
|
||||
#include <mutex>
|
||||
#include <functional>
|
||||
#include <mutex>
|
||||
|
||||
#include "BellTask.h"
|
||||
#include "PlaybackState.h"
|
||||
@@ -94,7 +94,6 @@ class TrackQueue : public bell::Task {
|
||||
std::shared_ptr<bell::WrappedSemaphore> playableSemaphore;
|
||||
std::atomic<bool> notifyPending = false;
|
||||
|
||||
|
||||
void runTask() override;
|
||||
void stopTask();
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <pb_encode.h>
|
||||
#include <optional>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
#include <optional>
|
||||
#include "NanoPBHelper.h"
|
||||
#include "pb_decode.h"
|
||||
#include "protobuf/spirc.pb.h"
|
||||
|
||||
Reference in New Issue
Block a user