summaryrefslogtreecommitdiff
path: root/src/libpiano/piano.h
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2012-04-27 15:15:40 +0200
committerLars-Dominik Braun <lars@6xq.net>2012-05-01 11:04:50 +0200
commit63c86dce1e248aa03a99792f56077dc176bcd295 (patch)
treee702be797a6e1b84f780dc6bf3fab504eb853d71 /src/libpiano/piano.h
parentbd9291bfc016a5f16fd81495dbe779b47627ade0 (diff)
downloadpianobar-63c86dce1e248aa03a99792f56077dc176bcd295.tar.gz
pianobar-63c86dce1e248aa03a99792f56077dc176bcd295.tar.bz2
pianobar-63c86dce1e248aa03a99792f56077dc176bcd295.zip
piano: Move to JSON API (v5)
In random order: Thanks to Chris Eby for his work on pithos, to an anonymous coward for sending me his Android client, to Alex Howard for sending me the webOS client, to ZigZagJoe for providing a temporary fix and thanks to everyone who sent Pandora a message. Although there are a few rough edges here and there this fixes #236.
Diffstat (limited to 'src/libpiano/piano.h')
-rw-r--r--src/libpiano/piano.h79
1 files changed, 56 insertions, 23 deletions
diff --git a/src/libpiano/piano.h b/src/libpiano/piano.h
index d582844..8a21d05 100644
--- a/src/libpiano/piano.h
+++ b/src/libpiano/piano.h
@@ -31,11 +31,13 @@ THE SOFTWARE.
* all strings _must_ be utf-8 encoded. i won't care, but pandora does. so
* be nice and check the encoding of your strings. thanks :) */
-#define PIANO_RPC_HOST "www.pandora.com"
-#define PIANO_RPC_PORT "80"
+/* Pandora API documentation is available at
+ * http://pan-do-ra-api.wikia.com
+ */
+
+#define PIANO_RPC_HOST "tuner.pandora.com"
typedef struct PianoUserInfo {
- char *webAuthToken;
char *listenerId;
char *authToken;
} PianoUserInfo_t;
@@ -66,10 +68,8 @@ typedef enum {
typedef struct PianoSong {
char *artist;
- char *artistMusicId;
char *stationId;
char *album;
- char *userSeed;
char *audioUrl;
char *coverArt;
char *musicId;
@@ -106,12 +106,13 @@ typedef struct PianoGenreCategory {
} PianoGenreCategory_t;
typedef struct PianoHandle {
- char routeId[9];
PianoUserInfo_t user;
/* linked lists */
PianoStation_t *stations;
PianoGenreCategory_t *genreStations;
int timeOffset;
+ char *partnerAuthToken;
+ unsigned int partnerId;
} PianoHandle_t;
typedef struct PianoSearchResult {
@@ -235,26 +236,58 @@ typedef struct {
PianoStation_t *station;
} PianoRequestDataDeleteSeed_t;
+/* pandora error code offset */
+#define PIANO_RET_OFFSET 1024
typedef enum {
PIANO_RET_ERR = 0,
PIANO_RET_OK = 1,
- PIANO_RET_XML_INVALID = 2,
- PIANO_RET_AUTH_TOKEN_INVALID = 3,
- PIANO_RET_AUTH_USER_PASSWORD_INVALID = 4,
- PIANO_RET_CONTINUE_REQUEST = 5,
- PIANO_RET_NOT_AUTHORIZED = 6,
- PIANO_RET_PROTOCOL_INCOMPATIBLE = 7,
- PIANO_RET_READONLY_MODE = 8,
- PIANO_RET_STATION_CODE_INVALID = 9,
- PIANO_RET_IP_REJECTED = 10,
- PIANO_RET_STATION_NONEXISTENT = 11,
- PIANO_RET_OUT_OF_MEMORY = 12,
- PIANO_RET_OUT_OF_SYNC = 13,
- PIANO_RET_PLAYLIST_END = 14,
- PIANO_RET_QUICKMIX_NOT_PLAYABLE = 15,
- PIANO_RET_REMOVING_TOO_MANY_SEEDS = 16,
- PIANO_RET_EXCESSIVE_ACTIVITY = 17,
- PIANO_RET_DAILY_SKIP_LIMIT_REACHED = 18,
+ PIANO_RET_INVALID_RESPONSE = 2,
+ PIANO_RET_CONTINUE_REQUEST = 3,
+ PIANO_RET_OUT_OF_MEMORY = 4,
+
+ PIANO_RET_P_INTERNAL = PIANO_RET_OFFSET+0,
+ PIANO_RET_P_API_VERSION_NOT_SUPPORTED = PIANO_RET_OFFSET+11,
+ PIANO_RET_P_BIRTH_YEAR_INVALID = PIANO_RET_OFFSET+1025,
+ PIANO_RET_P_BIRTH_YEAR_TOO_YOUNG = PIANO_RET_OFFSET+1026,
+ PIANO_RET_P_CALL_NOT_ALLOWED = PIANO_RET_OFFSET+1008,
+ PIANO_RET_P_CERTIFICATE_REQUIRED = PIANO_RET_OFFSET+7,
+ PIANO_RET_P_COMPLIMENTARY_PERIOD_ALREADY_IN_USE = PIANO_RET_OFFSET+1007,
+ PIANO_RET_P_DAILY_TRIAL_LIMIT_REACHED = PIANO_RET_OFFSET+1035,
+ PIANO_RET_P_DEVICE_ALREADY_ASSOCIATED_TO_ACCOUNT = PIANO_RET_OFFSET+1014,
+ PIANO_RET_P_DEVICE_DISABLED = PIANO_RET_OFFSET+1034,
+ PIANO_RET_P_DEVICE_MODEL_INVALID = PIANO_RET_OFFSET+1023,
+ PIANO_RET_P_DEVICE_NOT_FOUND = PIANO_RET_OFFSET+1009,
+ PIANO_RET_P_EXPLICIT_PIN_INCORRECT = PIANO_RET_OFFSET+1018,
+ PIANO_RET_P_EXPLICIT_PIN_MALFORMED = PIANO_RET_OFFSET+1020,
+ PIANO_RET_P_INSUFFICIENT_CONNECTIVITY = PIANO_RET_OFFSET+13,
+ PIANO_RET_P_INVALID_AUTH_TOKEN = PIANO_RET_OFFSET+1001,
+ PIANO_RET_P_INVALID_COUNTRY_CODE = PIANO_RET_OFFSET+1027,
+ PIANO_RET_P_INVALID_GENDER = PIANO_RET_OFFSET+1027,
+ PIANO_RET_P_INVALID_PARTNER_LOGIN = PIANO_RET_OFFSET+1002,
+ PIANO_RET_P_INVALID_PASSWORD = PIANO_RET_OFFSET+1012,
+ PIANO_RET_P_INVALID_SPONSOR = PIANO_RET_OFFSET+1036,
+ PIANO_RET_P_INVALID_USERNAME = PIANO_RET_OFFSET+1011,
+ PIANO_RET_P_LICENSING_RESTRICTIONS = PIANO_RET_OFFSET+12,
+ PIANO_RET_P_MAINTENANCE_MODE = PIANO_RET_OFFSET+1,
+ PIANO_RET_P_MAX_STATIONS_REACHED = PIANO_RET_OFFSET+1005,
+ PIANO_RET_P_PARAMETER_MISSING = PIANO_RET_OFFSET+9,
+ PIANO_RET_P_PARAMETER_TYPE_MISMATCH = PIANO_RET_OFFSET+8,
+ PIANO_RET_P_PARAMETER_VALUE_INVALID = PIANO_RET_OFFSET+10,
+ PIANO_RET_P_PARTNER_NOT_AUTHORIZED = PIANO_RET_OFFSET+1010,
+ PIANO_RET_P_READ_ONLY_MODE = PIANO_RET_OFFSET+1000,
+ PIANO_RET_P_SECURE_PROTOCOL_REQUIRED = PIANO_RET_OFFSET+6,
+ PIANO_RET_P_STATION_DOES_NOT_EXIST = PIANO_RET_OFFSET+1006,
+ PIANO_RET_P_UPGRADE_DEVICE_MODEL_INVALID = PIANO_RET_OFFSET+1015,
+ PIANO_RET_P_URL_PARAM_MISSING_AUTH_TOKEN = PIANO_RET_OFFSET+3,
+ PIANO_RET_P_URL_PARAM_MISSING_METHOD = PIANO_RET_OFFSET+2,
+ PIANO_RET_P_URL_PARAM_MISSING_PARTNER_ID = PIANO_RET_OFFSET+4,
+ PIANO_RET_P_URL_PARAM_MISSING_USER_ID = PIANO_RET_OFFSET+5,
+ PIANO_RET_P_USERNAME_ALREADY_EXISTS = PIANO_RET_OFFSET+1013,
+ PIANO_RET_P_USER_ALREADY_USED_TRIAL = PIANO_RET_OFFSET+1037,
+ PIANO_RET_P_USER_NOT_ACTIVE = PIANO_RET_OFFSET+1003,
+ PIANO_RET_P_USER_NOT_AUTHORIZED = PIANO_RET_OFFSET+1004,
+ PIANO_RET_P_ZIP_CODE_INVALID = PIANO_RET_OFFSET+1024,
+
} PianoReturn_t;
void PianoInit (PianoHandle_t *);