Created
April 26, 2012 16:07
-
-
Save anonymous/2500616 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/libpiano/piano.c b/src/libpiano/piano.c | |
index 342e4ec..b70477e 100644 | |
--- a/src/libpiano/piano.c | |
+++ b/src/libpiano/piano.c | |
@@ -42,7 +42,7 @@ THE SOFTWARE. | |
#include "crypt.h" | |
#include "config.h" | |
-#define PIANO_PROTOCOL_VERSION "33" | |
+#define PIANO_PROTOCOL_VERSION "34" | |
#define PIANO_RPC_HOST "www.pandora.com" | |
#define PIANO_RPC_PORT "80" | |
#define PIANO_RPC_PATH "/radio/xmlrpc/v" PIANO_PROTOCOL_VERSION "?" | |
@@ -272,6 +272,7 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req, | |
"<?xml version=\"1.0\"?><methodCall>" | |
"<methodName>listener.authenticateListener</methodName>" | |
"<params><param><value><int>%lu</int></value></param>" | |
+ "<param><value><string></string></value></param>" | |
/* user */ | |
"<param><value><string>%s</string></value></param>" | |
/* password */ | |
diff --git a/src/main.c b/src/main.c | |
index 43f3ffc..9a637cf 100644 | |
--- a/src/main.c | |
+++ b/src/main.c | |
@@ -77,10 +77,31 @@ static bool BarMainLoginUser (BarApp_t *app) { | |
WaitressReturn_t wRet; | |
PianoRequestDataLogin_t reqData; | |
bool ret; | |
+ WaitressHandle_t waithSync; | |
+ char *syncTime; | |
+ unsigned long int syncTimeInt; | |
+ | |
+ /* skip sync step by fetching time from somewhere else */ | |
+ WaitressInit (&waithSync); | |
+ WaitressSetUrl (&waithSync, "http://ridetheclown.com/s2/synctime.php"); | |
+ if (app->settings.proxy != NULL && strlen (app->settings.proxy) > 0) { | |
+ WaitressSetProxy (&waithSync, app->settings.proxy); | |
+ } | |
+ wRet = WaitressFetchBuf (&waithSync, &syncTime); | |
+ WaitressFree (&waithSync); | |
+ if (wRet != WAITRESS_RET_OK) { | |
+ BarUiMsg (&app->settings, MSG_ERR, "Unable to sync: %s\n", | |
+ WaitressErrorToStr (wRet)); | |
+ return false; | |
+ } | |
+ | |
+ syncTimeInt = strtoul (syncTime, NULL, 0); | |
+ app->ph.timeOffset = time (NULL) - syncTimeInt; | |
+ free (syncTime); | |
reqData.user = app->settings.username; | |
reqData.password = app->settings.password; | |
- reqData.step = 0; | |
+ reqData.step = 1; | |
BarUiMsg (&app->settings, MSG_INFO, "Login... "); | |
ret = BarUiPianoCall (app, PIANO_REQUEST_LOGIN, &reqData, &pRet, &wRet); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment