Line 0
Link Here
|
0 |
- |
1 |
diff --git a/src/services/ampache/LastfmInfoParser.cpp b/src/services/ampache/LastfmInfoParser.cpp |
|
|
2 |
index 50cb529516ce1358785fa04824cd32642a526495..0c6dd8fe9f6a491a88dfb062a09e2652976df0ef 100644 |
3 |
--- a/src/services/ampache/LastfmInfoParser.cpp |
4 |
+++ b/src/services/ampache/LastfmInfoParser.cpp |
5 |
@@ -20,8 +20,7 @@ |
6 |
#include "core/support/Amarok.h" |
7 |
#include "core/support/Debug.h" |
8 |
|
9 |
-#include <lastfm/XmlQuery> |
10 |
-#include <lastfm/ws.h> |
11 |
+#include <lastfm/XmlQuery.h> |
12 |
|
13 |
#include <KLocale> |
14 |
|
15 |
@@ -55,7 +54,8 @@ void LastfmInfoParser::onGetTrackInfo() |
16 |
{ |
17 |
case QNetworkReply::NoError: |
18 |
{ |
19 |
- lastfm::XmlQuery lfm = m_jobs[ "getTrackInfo" ]->readAll(); |
20 |
+ lastfm::XmlQuery lfm; |
21 |
+ lfm.parse( m_jobs[ "getTrackInfo" ]->readAll() ); |
22 |
lastfm::XmlQuery wiki = lfm["track"]["wiki"]; |
23 |
const QString contentText = wiki["content"].text(); |
24 |
const QString publishedDate = wiki["published"].text(); |
25 |
@@ -103,7 +103,8 @@ void LastfmInfoParser::onGetAlbumInfo() |
26 |
{ |
27 |
case QNetworkReply::NoError: |
28 |
{ |
29 |
- lastfm::XmlQuery lfm = m_jobs[ "getAlbumInfo" ]->readAll(); |
30 |
+ lastfm::XmlQuery lfm; |
31 |
+ lfm.parse( m_jobs[ "getAlbumInfo" ]->readAll() ); |
32 |
lastfm::XmlQuery wiki = lfm["album"]["wiki"]; |
33 |
const QString summaryText = wiki["summary"].text(); |
34 |
const QString contentText = wiki["content"].text(); |
35 |
@@ -155,7 +156,8 @@ void LastfmInfoParser::onGetArtistInfo() |
36 |
{ |
37 |
case QNetworkReply::NoError: |
38 |
{ |
39 |
- lastfm::XmlQuery lfm = m_jobs[ "getArtistInfo" ]->readAll(); |
40 |
+ lastfm::XmlQuery lfm; |
41 |
+ lfm.parse( m_jobs[ "getArtistInfo" ]->readAll() ); |
42 |
debug() << lfm.text(); |
43 |
lastfm::XmlQuery bio = lfm["artist"]["bio"]; |
44 |
const QString summaryText = bio["summary"].text(); |
45 |
diff --git a/src/services/lastfm/LastFmService.cpp b/src/services/lastfm/LastFmService.cpp |
46 |
index a14d989b3fac81e545df095adee36580b052fea7..c9898aa1fcd16ca8070eec66231db23c1beddff2 100644 |
47 |
--- a/src/services/lastfm/LastFmService.cpp |
48 |
+++ b/src/services/lastfm/LastFmService.cpp |
49 |
@@ -46,8 +46,8 @@ |
50 |
#include "widgets/SearchWidget.h" |
51 |
#include "NetworkAccessManagerProxy.h" |
52 |
|
53 |
-#include <lastfm/Audioscrobbler> // from liblastfm |
54 |
-#include <lastfm/XmlQuery> |
55 |
+#include <lastfm/Audioscrobbler.h> // from liblastfm |
56 |
+#include <lastfm/XmlQuery.h> |
57 |
|
58 |
#include <KLocale> |
59 |
#include <KPasswordDialog> |
60 |
@@ -224,10 +224,7 @@ LastFmService::init() |
61 |
{ |
62 |
// set the global static Lastfm::Ws stuff |
63 |
lastfm::ws::ApiKey = Amarok::lastfmApiKey(); |
64 |
- lastfm::ws::SharedSecret = "fe0dcde9fcd14c2d1d50665b646335e9"; |
65 |
- // testing w/ official keys |
66 |
- //Ws::SharedSecret = "73582dfc9e556d307aead069af110ab8"; |
67 |
- //Ws::ApiKey = "c8c7b163b11f92ef2d33ba6cd3c2c3c3"; |
68 |
+ lastfm::ws::SharedSecret = Amarok::lastfmApiSharedSecret(); |
69 |
m_userNameArray = qstrdup( m_userName.toLatin1().data() ); |
70 |
lastfm::ws::Username = m_userNameArray; |
71 |
if( lastfm::nam() != The::networkAccessManager() ) |
72 |
@@ -309,7 +306,8 @@ LastFmService::onAuthenticated() |
73 |
case QNetworkReply::NoError: |
74 |
{ |
75 |
|
76 |
- lastfm::XmlQuery lfm = lastfm::XmlQuery( m_jobs[ "auth" ]->readAll() ); |
77 |
+ lastfm::XmlQuery lfm; |
78 |
+ lfm.parse( m_jobs[ "auth" ]->readAll() ); |
79 |
LastFmServiceConfig config; |
80 |
|
81 |
if( lfm.children( "error" ).size() > 0 ) |
82 |
@@ -359,10 +357,8 @@ LastFmService::onGetUserInfo() |
83 |
{ |
84 |
case QNetworkReply::NoError: |
85 |
{ |
86 |
- try |
87 |
- { |
88 |
- lastfm::XmlQuery lfm( m_jobs[ "getUserInfo" ]->readAll() ); |
89 |
- |
90 |
+ lastfm::XmlQuery lfm; |
91 |
+ if( lfm.parse( m_jobs[ "getUserInfo" ]->readAll() ) ) { |
92 |
m_country = lfm["user"]["country"].text(); |
93 |
m_age = lfm["user"]["age"].text(); |
94 |
m_gender = lfm["user"]["gender"].text(); |
95 |
@@ -381,9 +377,10 @@ LastFmService::onGetUserInfo() |
96 |
} |
97 |
updateProfileInfo(); |
98 |
|
99 |
- } catch( lastfm::ws::ParseError& e ) |
100 |
+ } |
101 |
+ else |
102 |
{ |
103 |
- debug() << "Got exception in parsing from last.fm:" << e.what(); |
104 |
+ debug() << "Got exception in parsing from last.fm:" << lfm.parseError().message(); |
105 |
} |
106 |
break; |
107 |
} case QNetworkReply::AuthenticationRequiredError: |
108 |
diff --git a/src/services/lastfm/LastFmServiceCollection.cpp b/src/services/lastfm/LastFmServiceCollection.cpp |
109 |
index 22f49ec0fe8e9f917f8a26f9d546ad147ad04e5b..0ed5505c1cd1350c85f21964e772f3c36cf6ae3e 100644 |
110 |
--- a/src/services/lastfm/LastFmServiceCollection.cpp |
111 |
+++ b/src/services/lastfm/LastFmServiceCollection.cpp |
112 |
@@ -26,7 +26,7 @@ |
113 |
#include "core-impl/collections/support/MemoryQueryMaker.h" |
114 |
|
115 |
#include <lastfm/ws.h> |
116 |
-#include <lastfm/XmlQuery> |
117 |
+#include <lastfm/XmlQuery.h> |
118 |
|
119 |
#include <QNetworkReply> |
120 |
|
121 |
@@ -154,10 +154,9 @@ void LastFmServiceCollection::slotAddNeighboursLoved() |
122 |
case QNetworkReply::NoError: |
123 |
{ |
124 |
// iterate through each neighbour |
125 |
- try |
126 |
+ lastfm::XmlQuery lfm; |
127 |
+ if( lfm.parse( m_jobs[ "user.getNeighbours" ]->readAll() ) ) |
128 |
{ |
129 |
- lastfm::XmlQuery lfm( m_jobs[ "user.getNeighbours" ]->readAll() ); |
130 |
- |
131 |
foreach( const lastfm::XmlQuery &e, lfm[ "neighbours" ].children( "user" ) ) |
132 |
{ |
133 |
const QString name = e[ "name" ].text(); |
134 |
@@ -168,9 +167,10 @@ void LastFmServiceCollection::slotAddNeighboursLoved() |
135 |
addTrack( trackPtr ); |
136 |
} |
137 |
|
138 |
- } catch( lastfm::ws::ParseError& e ) |
139 |
+ } |
140 |
+ else |
141 |
{ |
142 |
- debug() << "Got exception in parsing from last.fm:" << e.what(); |
143 |
+ debug() << "Got exception in parsing from last.fm:" << lfm.parseError().message(); |
144 |
} |
145 |
break; |
146 |
} |
147 |
@@ -195,15 +195,14 @@ void LastFmServiceCollection::slotAddNeighboursPersonal() |
148 |
case QNetworkReply::NoError: |
149 |
{ |
150 |
// iterate through each neighbour |
151 |
- try |
152 |
+ if( !m_jobs[ "user.getNeighbours" ] ) |
153 |
+ { |
154 |
+ debug() << "BAD! got no result object"; |
155 |
+ return; |
156 |
+ } |
157 |
+ lastfm::XmlQuery lfm; |
158 |
+ if( lfm.parse( m_jobs[ "user.getNeighbours" ]->readAll() ) ) |
159 |
{ |
160 |
- if( !m_jobs[ "user.getNeighbours" ] ) |
161 |
- { |
162 |
- debug() << "BAD! got no result object"; |
163 |
- return; |
164 |
- } |
165 |
- lastfm::XmlQuery lfm( m_jobs[ "user.getNeighbours" ]->readAll() ); |
166 |
- |
167 |
// iterate through each neighbour |
168 |
foreach( const lastfm::XmlQuery &e, lfm[ "neighbours" ].children( "user" ) ) |
169 |
{ |
170 |
@@ -218,9 +217,10 @@ void LastFmServiceCollection::slotAddNeighboursPersonal() |
171 |
|
172 |
// should be safe, as both slots SHOULD get called before we return to the event loop... |
173 |
m_jobs[ "user.getNeighbours" ]->deleteLater(); |
174 |
- } catch( lastfm::ws::ParseError& e ) |
175 |
+ } |
176 |
+ else |
177 |
{ |
178 |
- debug() << "Got exception in parsing from last.fm:" << e.what(); |
179 |
+ debug() << "Got exception in parsing from last.fm:" << lfm.parseError().message(); |
180 |
} |
181 |
break; |
182 |
} |
183 |
@@ -248,10 +248,9 @@ void LastFmServiceCollection::slotAddFriendsLoved() |
184 |
{ |
185 |
case QNetworkReply::NoError: |
186 |
{ |
187 |
- try |
188 |
+ lastfm::XmlQuery lfm; |
189 |
+ if( lfm.parse( m_jobs[ "user.getFriends" ]->readAll() ) ) |
190 |
{ |
191 |
- lastfm::XmlQuery lfm( m_jobs[ "user.getFriends" ]->readAll() ); |
192 |
- |
193 |
foreach( const lastfm::XmlQuery &e, lfm[ "friends" ].children( "user" ) ) |
194 |
{ |
195 |
const QString name = e[ "name" ].text(); |
196 |
@@ -261,9 +260,10 @@ void LastFmServiceCollection::slotAddFriendsLoved() |
197 |
addTrack( trackPtr ); |
198 |
} |
199 |
|
200 |
- } catch( lastfm::ws::ParseError& e ) |
201 |
+ } |
202 |
+ else |
203 |
{ |
204 |
- debug() << "Got exception in parsing from last.fm:" << e.what(); |
205 |
+ debug() << "Got exception in parsing from last.fm:" << lfm.parseError().message(); |
206 |
} |
207 |
break; |
208 |
} |
209 |
@@ -293,10 +293,9 @@ void LastFmServiceCollection::slotAddFriendsPersonal() |
210 |
{ |
211 |
case QNetworkReply::NoError: |
212 |
{ |
213 |
- try |
214 |
+ lastfm::XmlQuery lfm; |
215 |
+ if( lfm.parse( m_jobs[ "user.getFriends" ]->readAll() ) ) |
216 |
{ |
217 |
- lastfm::XmlQuery lfm( m_jobs[ "user.getFriends" ]->readAll() ); |
218 |
- |
219 |
foreach( const lastfm::XmlQuery &e, lfm[ "friends" ].children( "user" ) ) |
220 |
{ |
221 |
const QString name = e[ "name" ].text(); |
222 |
@@ -306,9 +305,10 @@ void LastFmServiceCollection::slotAddFriendsPersonal() |
223 |
addTrack( trackPtr ); |
224 |
} |
225 |
|
226 |
- } catch( lastfm::ws::ParseError& e ) |
227 |
+ } |
228 |
+ else |
229 |
{ |
230 |
- debug() << "Got exception in parsing from last.fm:" << e.what(); |
231 |
+ debug() << "Got exception in parsing from last.fm:" << lfm.parseError().message(); |
232 |
} |
233 |
break; |
234 |
} |
235 |
diff --git a/src/services/lastfm/LastFmServiceSettings.cpp b/src/services/lastfm/LastFmServiceSettings.cpp |
236 |
index 2eff71e51dc30605b4d395323a01e24b8fa25d1e..9f67559b79fb218d4c5dba769fe98dcf5cea4b8b 100644 |
237 |
--- a/src/services/lastfm/LastFmServiceSettings.cpp |
238 |
+++ b/src/services/lastfm/LastFmServiceSettings.cpp |
239 |
@@ -23,9 +23,9 @@ |
240 |
#include "NetworkAccessManagerProxy.h" |
241 |
#include "ui_LastFmConfigWidget.h" |
242 |
|
243 |
-#include <lastfm/Audioscrobbler> // from liblastfm |
244 |
+#include <lastfm/Audioscrobbler.h> // from liblastfm |
245 |
#include <lastfm/ws.h> |
246 |
-#include <lastfm/XmlQuery> |
247 |
+#include <lastfm/XmlQuery.h> |
248 |
|
249 |
#include <QCryptographicHash> |
250 |
#include <QNetworkAccessManager> |
251 |
@@ -100,7 +100,7 @@ LastFmServiceSettings::testLogin() |
252 |
m_configDialog->testLogin->setText( i18n( "Testing..." ) ); |
253 |
// set the global static Lastfm::Ws stuff |
254 |
lastfm::ws::ApiKey = Amarok::lastfmApiKey(); |
255 |
- lastfm::ws::SharedSecret = "fe0dcde9fcd14c2d1d50665b646335e9"; |
256 |
+ lastfm::ws::SharedSecret = Amarok::lastfmApiSharedSecret(); |
257 |
lastfm::ws::Username = qstrdup( m_configDialog->kcfg_ScrobblerUsername->text().toLatin1().data() ); |
258 |
if( lastfm::nam() != The::networkAccessManager() ) |
259 |
lastfm::setNetworkAccessManager( The::networkAccessManager() ); |
260 |
@@ -126,7 +126,8 @@ LastFmServiceSettings::onAuthenticated() |
261 |
{ |
262 |
DEBUG_BLOCK |
263 |
|
264 |
- lastfm::XmlQuery lfm = lastfm::XmlQuery( m_authQuery->readAll() ); |
265 |
+ lastfm::XmlQuery lfm; |
266 |
+ lfm.parse( m_authQuery->readAll() ); |
267 |
|
268 |
switch( m_authQuery->error() ) |
269 |
{ |
270 |
diff --git a/src/services/lastfm/LastFmTreeModel.h b/src/services/lastfm/LastFmTreeModel.h |
271 |
index ac171a57a36ec6bb5443035b11bea77e4ae94720..3aa2061afce8bb6c57e1a7f1cf0717af8f52a7d1 100644 |
272 |
--- a/src/services/lastfm/LastFmTreeModel.h |
273 |
+++ b/src/services/lastfm/LastFmTreeModel.h |
274 |
@@ -22,7 +22,7 @@ |
275 |
#include "core/meta/Meta.h" |
276 |
#include "WeightedStringList.h" |
277 |
|
278 |
-#include <lastfm/User> |
279 |
+#include <lastfm/User.h> |
280 |
|
281 |
#include <QAbstractItemModel> |
282 |
#include <QHash> |
283 |
@@ -136,7 +136,7 @@ private: |
284 |
LastFmTreeItem *m_myTopArtists; |
285 |
|
286 |
QString m_userName; |
287 |
- lastfm::AuthenticatedUser m_user; |
288 |
+ lastfm::User m_user; |
289 |
|
290 |
QStringList m_friends; |
291 |
QStringList m_neighbors; |
292 |
diff --git a/src/services/lastfm/LastFmTreeModel.cpp b/src/services/lastfm/LastFmTreeModel.cpp |
293 |
index 2d94d67c5fe10bfc1abba3dd9848fd1177daa518..4d47d4201bdd6bfc33ff58a4c94d75ff6a70ec46 100644 |
294 |
--- a/src/services/lastfm/LastFmTreeModel.cpp |
295 |
+++ b/src/services/lastfm/LastFmTreeModel.cpp |
296 |
@@ -26,8 +26,8 @@ |
297 |
#include "AmarokMimeData.h" |
298 |
|
299 |
#include <lastfm/ws.h> |
300 |
-#include <lastfm/Tag> |
301 |
-#include <lastfm/XmlQuery> |
302 |
+#include <lastfm/Tag.h> |
303 |
+#include <lastfm/XmlQuery.h> |
304 |
|
305 |
#include <KIcon> |
306 |
#include <KLocale> |
307 |
@@ -68,11 +68,12 @@ LastFmTreeModel::slotAddNeighbors () |
308 |
{ |
309 |
DEBUG_BLOCK |
310 |
|
311 |
- try |
312 |
- { |
313 |
// Iterate over each neighbor, in two passes: 1) Get data 2) Sort data, store in model |
314 |
|
315 |
- lastfm::XmlQuery lfm( m_jobs[ "getNeighbours" ]->readAll() ); |
316 |
+ lastfm::XmlQuery lfm; |
317 |
+ lfm.parse( m_jobs[ "getNeighbours" ]->readAll() ); |
318 |
+ if( lfm.parseError().enumValue() == lastfm::ws::NoError ) |
319 |
+ { |
320 |
foreach( const lastfm::XmlQuery &e, lfm[ "neighbours" ].children ( "user" ) ) |
321 |
{ |
322 |
const QString name = e[ "name" ].text(); |
323 |
@@ -88,11 +89,11 @@ LastFmTreeModel::slotAddNeighbors () |
324 |
appendUserStations( neighbor, name ); |
325 |
} |
326 |
m_neighbors.sort(); |
327 |
+ } else { |
328 |
+ debug() << "Got exception in parsing from last.fm:" << lfm.parseError().message(); |
329 |
+ return; |
330 |
} |
331 |
- catch( lastfm::ws::ParseError e ) |
332 |
- { |
333 |
- debug() << "Got exception in parsing from last.fm:" << e.what(); |
334 |
- } |
335 |
+ |
336 |
emitRowChanged(LastFm::Neighbors); |
337 |
m_jobs[ "getNeighbours" ]->deleteLater(); |
338 |
} |
339 |
@@ -102,11 +103,11 @@ LastFmTreeModel::slotAddFriends () |
340 |
{ |
341 |
DEBUG_BLOCK |
342 |
|
343 |
- try |
344 |
- { |
345 |
- // Iterate over each friend, in two passes: 1) Get data 2) Sort data, store in model |
346 |
+ // Iterate over each friend, in two passes: 1) Get data 2) Sort data, store in model |
347 |
|
348 |
- lastfm::XmlQuery lfm( m_jobs[ "getFriends" ]->readAll() ); |
349 |
+ lastfm::XmlQuery lfm; |
350 |
+ if( lfm.parse( m_jobs[ "getFriends" ]->readAll() ) ) |
351 |
+ { |
352 |
foreach( const lastfm::XmlQuery &e, lfm[ "friends" ].children ( "user" ) ) |
353 |
{ |
354 |
const QString name = e[ "name" ].text(); |
355 |
@@ -123,11 +124,11 @@ LastFmTreeModel::slotAddFriends () |
356 |
appendUserStations( afriend, name ); |
357 |
} |
358 |
m_friends.sort(); |
359 |
+ } else { |
360 |
+ debug() << "Got exception in parsing from last.fm:" << lfm.parseError().message(); |
361 |
+ return; |
362 |
} |
363 |
- catch( lastfm::ws::ParseError e ) |
364 |
- { |
365 |
- debug() << "Got exception in parsing from last.fm:" << e.what(); |
366 |
- } |
367 |
+ |
368 |
emitRowChanged(LastFm::Friends); |
369 |
m_jobs[ "getFriends" ]->deleteLater(); |
370 |
} |
371 |
@@ -137,10 +138,9 @@ LastFmTreeModel::slotAddTopArtists () |
372 |
{ |
373 |
DEBUG_BLOCK |
374 |
WeightedStringList list; |
375 |
- try |
376 |
+ lastfm::XmlQuery lfm; |
377 |
+ if( lfm.parse( m_jobs[ "getTopArtists" ]->readAll() ) ) |
378 |
{ |
379 |
- lastfm::XmlQuery lfm( m_jobs[ "getTopArtists" ]->readAll() ); |
380 |
- |
381 |
foreach( const lastfm::XmlQuery &e, lfm[ "topartists" ].children ( "artist" ) ) |
382 |
{ |
383 |
const QString name = e[ "name" ].text(); |
384 |
@@ -158,9 +158,10 @@ LastFmTreeModel::slotAddTopArtists () |
385 |
m_myTopArtists->appendChild ( artist ); |
386 |
} |
387 |
|
388 |
- } catch( lastfm::ws::ParseError e ) |
389 |
+ } |
390 |
+ else |
391 |
{ |
392 |
- debug() << "Got exception in parsing from last.fm:" << e.what(); |
393 |
+ debug() << "Got exception in parsing from last.fm:" << lfm.parseError().message(); |
394 |
} |
395 |
emitRowChanged(LastFm::TopArtists); |
396 |
m_jobs[ "getTopArtists" ]->deleteLater(); |
397 |
diff --git a/src/services/lastfm/ScrobblerAdapter.h b/src/services/lastfm/ScrobblerAdapter.h |
398 |
index 67ed73b291cef61ee37b0ddae28ba1eadfd6304d..b276837c18b2181c1d7aba1674b878bfbf308e3b 100644 |
399 |
--- a/src/services/lastfm/ScrobblerAdapter.h |
400 |
+++ b/src/services/lastfm/ScrobblerAdapter.h |
401 |
@@ -20,8 +20,8 @@ |
402 |
|
403 |
#include "core/meta/Meta.h" |
404 |
|
405 |
-#include <lastfm/Audioscrobbler> |
406 |
-#include <lastfm/Track> |
407 |
+#include <lastfm/Audioscrobbler.h> |
408 |
+#include <lastfm/Track.h> |
409 |
|
410 |
#include <QVariant> |
411 |
|
412 |
diff --git a/src/services/lastfm/biases/LastFmBias.cpp b/src/services/lastfm/biases/LastFmBias.cpp |
413 |
index b011b3299f98d851109d3d9ba52e6fd09855dcff..52307a4aa9ff48adf6c06b18b719717601494515 100644 |
414 |
--- a/src/services/lastfm/biases/LastFmBias.cpp |
415 |
+++ b/src/services/lastfm/biases/LastFmBias.cpp |
416 |
@@ -34,9 +34,8 @@ |
417 |
#include "core/collections/QueryMaker.h" |
418 |
#include "core-impl/collections/support/CollectionManager.h" |
419 |
|
420 |
-#include "lastfm/Artist" |
421 |
-#include "lastfm/ws.h" |
422 |
-#include "lastfm/XmlQuery" |
423 |
+#include <lastfm/Artist.h> |
424 |
+#include <lastfm/ws.h> |
425 |
|
426 |
#include <QLabel> |
427 |
#include <QComboBox> |
428 |
diff --git a/src/services/lastfm/biases/WeeklyTopBias.cpp b/src/services/lastfm/biases/WeeklyTopBias.cpp |
429 |
index df6dd6681f05d95a0e281d6e82224de2bbf001e6..2deb9ccba66f7ec0df36225506acea2e4f30905b 100644 |
430 |
--- a/src/services/lastfm/biases/WeeklyTopBias.cpp |
431 |
+++ b/src/services/lastfm/biases/WeeklyTopBias.cpp |
432 |
@@ -34,9 +34,9 @@ |
433 |
#include "core/collections/QueryMaker.h" |
434 |
#include "core-impl/collections/support/CollectionManager.h" |
435 |
|
436 |
-#include "lastfm/Artist" |
437 |
-#include "lastfm/ws.h" |
438 |
-#include "lastfm/XmlQuery" |
439 |
+#include <lastfm/Artist.h> |
440 |
+#include <lastfm/ws.h> |
441 |
+#include <lastfm/XmlQuery.h> |
442 |
|
443 |
#include <QNetworkReply> |
444 |
|
445 |
@@ -371,10 +371,9 @@ Dynamic::WeeklyTopBias::weeklyArtistQueryFinished() |
446 |
} |
447 |
|
448 |
|
449 |
- try |
450 |
+ lastfm::XmlQuery lfm; |
451 |
+ if( lfm.parse( reply->readAll() ) ) |
452 |
{ |
453 |
- lastfm::XmlQuery lfm( reply->readAll() ); |
454 |
- |
455 |
// debug() << "got response:" << lfm; |
456 |
QStringList artists; |
457 |
for( int i = 0; i < lfm[ "weeklyartistchart" ].children( "artist" ).size(); i++ ) |
458 |
@@ -398,10 +397,10 @@ Dynamic::WeeklyTopBias::weeklyArtistQueryFinished() |
459 |
warning() << "Got a reply for a week"<<week<<"that was not requested."; |
460 |
return; |
461 |
} |
462 |
- |
463 |
- } catch( lastfm::ws::ParseError& e ) |
464 |
+ } |
465 |
+ else |
466 |
{ |
467 |
- debug() << "caught exception parsing weekly artist chart."; |
468 |
+ debug() << "failed to parse weekly artist chart."; |
469 |
} |
470 |
|
471 |
reply->deleteLater(); |
472 |
diff --git a/src/services/lastfm/meta/LastFmMeta.h b/src/services/lastfm/meta/LastFmMeta.h |
473 |
index f7b93c14c92c0bebf99d165656a0e34f8b991cc0..7d64a3fa5c6f6cbe3f0cc5b26881a4996321938a 100644 |
474 |
--- a/src/services/lastfm/meta/LastFmMeta.h |
475 |
+++ b/src/services/lastfm/meta/LastFmMeta.h |
476 |
@@ -24,7 +24,7 @@ |
477 |
#include "ServiceMetaBase.h" // for the SourceInfoProvider |
478 |
|
479 |
|
480 |
-#include <lastfm/Track> |
481 |
+#include <lastfm/Track.h> |
482 |
|
483 |
|
484 |
#include <QObject> |
485 |
diff --git a/src/services/lastfm/meta/LastFmMeta.cpp b/src/services/lastfm/meta/LastFmMeta.cpp |
486 |
index d8f52845cb801d8ae940bc1bca77c7281ef18379..220d929977d28c8183db9965cecfc1a80039fe08 100644 |
487 |
--- a/src/services/lastfm/meta/LastFmMeta.cpp |
488 |
+++ b/src/services/lastfm/meta/LastFmMeta.cpp |
489 |
@@ -41,7 +41,7 @@ |
490 |
#include <QWeakPointer> |
491 |
#include <QUrl> |
492 |
|
493 |
-#include <lastfm/Track> |
494 |
+#include <lastfm/Track.h> |
495 |
|
496 |
namespace LastFm { |
497 |
|
498 |
@@ -451,8 +451,7 @@ Track::love() |
499 |
DEBUG_BLOCK |
500 |
|
501 |
debug() << "info:" << d->lastFmTrack.artist() << d->lastFmTrack.title(); |
502 |
- d->wsReply = lastfm::MutableTrack( d->lastFmTrack ).love(); |
503 |
- connect( d->wsReply, SIGNAL( finished() ), this, SLOT( slotWsReply() ) ); |
504 |
+ lastfm::MutableTrack( d->lastFmTrack ).love(); |
505 |
} |
506 |
|
507 |
void |
508 |
@@ -477,9 +476,9 @@ void Track::slotResultReady() |
509 |
{ |
510 |
if( d->trackFetch->error() == QNetworkReply::NoError ) |
511 |
{ |
512 |
- try |
513 |
+ lastfm::XmlQuery lfm; |
514 |
+ if( lfm.parse( d->trackFetch->readAll() ) ) |
515 |
{ |
516 |
- lastfm::XmlQuery lfm( d->trackFetch->readAll() ); |
517 |
QString id = lfm[ "track" ][ "id" ].text(); |
518 |
QString streamable = lfm[ "track" ][ "streamable" ].text(); |
519 |
if( streamable.toInt() == 1 ) |
520 |
@@ -487,9 +486,10 @@ void Track::slotResultReady() |
521 |
else |
522 |
init(); |
523 |
|
524 |
- } catch( lastfm::ws::ParseError& e ) |
525 |
+ } |
526 |
+ else |
527 |
{ |
528 |
- debug() << "Got exception in parsing from last.fm:" << e.what(); |
529 |
+ debug() << "Got exception in parsing from last.fm:" << lfm.parseError().message(); |
530 |
} |
531 |
} else |
532 |
{ |
533 |
diff --git a/src/services/lastfm/meta/LastFmMeta_p.h b/src/services/lastfm/meta/LastFmMeta_p.h |
534 |
index c2d88ac79a4dd0fe59b9f889baf72c879833f0d3..caf954a1e1acbf220ce8efa9d16db2a71cf4bbb3 100644 |
535 |
--- a/src/services/lastfm/meta/LastFmMeta_p.h |
536 |
+++ b/src/services/lastfm/meta/LastFmMeta_p.h |
537 |
@@ -26,10 +26,10 @@ |
538 |
#include "core/statistics/StatisticsProvider.h" |
539 |
#include "core-impl/statistics/providers/tag/TagStatisticsProvider.h" |
540 |
|
541 |
-#include <lastfm/Track> |
542 |
+#include <lastfm/Track.h> |
543 |
#include <lastfm/ws.h> |
544 |
-#include <lastfm/RadioTuner> |
545 |
-#include <lastfm/XmlQuery> |
546 |
+#include <lastfm/RadioTuner.h> |
547 |
+#include <lastfm/XmlQuery.h> |
548 |
|
549 |
#include <kio/job.h> |
550 |
#include <kio/jobclasses.h> |
551 |
@@ -144,26 +144,24 @@ class Track::Private : public QObject |
552 |
return; |
553 |
if( m_userFetch->error() == QNetworkReply::NoError ) |
554 |
{ |
555 |
- try |
556 |
+ lastfm::XmlQuery lfm; |
557 |
+ if( !lfm.parse( m_userFetch->readAll() ) ) |
558 |
{ |
559 |
- lastfm::XmlQuery lfm( m_userFetch->readAll() ); |
560 |
- albumUrl = lfm[ "track" ][ "album" ][ "url" ].text(); |
561 |
- trackUrl = lfm[ "track" ][ "url" ].text(); |
562 |
- artistUrl = lfm[ "track" ][ "artist" ][ "url" ].text(); |
563 |
- |
564 |
- notifyObservers(); |
565 |
+ debug() << "Got exception in parsing from last.fm:" << lfm.parseError().message(); |
566 |
+ return; |
567 |
+ } |
568 |
+ albumUrl = lfm[ "track" ][ "album" ][ "url" ].text(); |
569 |
+ trackUrl = lfm[ "track" ][ "url" ].text(); |
570 |
+ artistUrl = lfm[ "track" ][ "artist" ][ "url" ].text(); |
571 |
|
572 |
- imageUrl = lfm[ "track" ][ "album" ][ "image size=large" ].text(); |
573 |
+ notifyObservers(); |
574 |
|
575 |
- if( !imageUrl.isEmpty() ) |
576 |
- { |
577 |
- KIO::Job* job = KIO::storedGet( KUrl( imageUrl ), KIO::Reload, KIO::HideProgressInfo ); |
578 |
- connect( job, SIGNAL( result( KJob* ) ), this, SLOT( fetchImageFinished( KJob* ) ) ); |
579 |
- } |
580 |
+ imageUrl = lfm[ "track" ][ "album" ][ "image size=large" ].text(); |
581 |
|
582 |
- } catch( lastfm::ws::ParseError& e ) |
583 |
+ if( !imageUrl.isEmpty() ) |
584 |
{ |
585 |
- debug() << "Got exception in parsing from last.fm:" << e.what(); |
586 |
+ KIO::Job* job = KIO::storedGet( KUrl( imageUrl ), KIO::Reload, KIO::HideProgressInfo ); |
587 |
+ connect( job, SIGNAL( result( KJob* ) ), this, SLOT( fetchImageFinished( KJob* ) ) ); |
588 |
} |
589 |
} |
590 |
|
591 |
diff --git a/src/services/lastfm/meta/MultiPlayableCapabilityImpl_p.h b/src/services/lastfm/meta/MultiPlayableCapabilityImpl_p.h |
592 |
index 1c464cc2635c7d614eab48ca5e4e156c67870f04..e9b63271c77d3420cd8eeb5eb19d1152b23c319f 100644 |
593 |
--- a/src/services/lastfm/meta/MultiPlayableCapabilityImpl_p.h |
594 |
+++ b/src/services/lastfm/meta/MultiPlayableCapabilityImpl_p.h |
595 |
@@ -25,8 +25,9 @@ |
596 |
#include "core/meta/Meta.h" |
597 |
#include "core/capabilities/MultiPlayableCapability.h" |
598 |
|
599 |
-#include <lastfm/Track> |
600 |
-#include <lastfm/RadioTuner> |
601 |
+#include <lastfm/Track.h> |
602 |
+#include <lastfm/RadioStation.h> |
603 |
+#include <lastfm/RadioTuner.h> |
604 |
#include <lastfm/ws.h> |
605 |
|
606 |
#include <KLocale> |
607 |
@@ -55,24 +56,23 @@ class MultiPlayableCapabilityImpl : public Capabilities::MultiPlayableCapability |
608 |
{ |
609 |
DEBUG_BLOCK |
610 |
m_tuner = new lastfm::RadioTuner( lastfm::RadioStation( m_track->uidUrl() ) ); |
611 |
- |
612 |
+ |
613 |
connect( m_tuner, SIGNAL( trackAvailable() ), this, SLOT( slotNewTrackAvailable() ) ); |
614 |
- connect( m_tuner, SIGNAL( error( lastfm::ws::Error ) ), this, SLOT( error( lastfm::ws::Error ) ) ); |
615 |
+ connect( m_tuner, SIGNAL( error(lastfm::ws::Error,QString) ), this, SLOT( error( lastfm::ws::Error ) ) ); |
616 |
} |
617 |
- |
618 |
+ |
619 |
virtual void fetchNext() |
620 |
{ |
621 |
DEBUG_BLOCK |
622 |
m_currentTrack = m_tuner->takeNextTrack(); |
623 |
m_track->setTrackInfo( m_currentTrack ); |
624 |
- |
625 |
} |
626 |
- |
627 |
+ |
628 |
using Observer::metadataChanged; |
629 |
virtual void metadataChanged( Meta::TrackPtr track ) |
630 |
{ |
631 |
const LastFm::TrackPtr ltrack = LastFm::TrackPtr::dynamicCast( track ); |
632 |
- |
633 |
+ |
634 |
if( ltrack.isNull() ) |
635 |
return; |
636 |
|
637 |
@@ -94,7 +94,7 @@ class MultiPlayableCapabilityImpl : public Capabilities::MultiPlayableCapability |
638 |
m_track->setTrackInfo( m_currentTrack ); |
639 |
} |
640 |
} |
641 |
- |
642 |
+ |
643 |
virtual void skip() |
644 |
{ |
645 |
fetchNext(); |
646 |
diff --git a/src/context/engines/upcomingevents/UpcomingEventsEngine.cpp b/src/context/engines/upcomingevents/UpcomingEventsEngine.cpp |
647 |
index 4ae73d892cef3d4a41662f7ed15849ae773c16e3..689323cc753a3c693bc09870ea1a77e2574ec9a7 100644 |
648 |
--- a/src/context/engines/upcomingevents/UpcomingEventsEngine.cpp |
649 |
+++ b/src/context/engines/upcomingevents/UpcomingEventsEngine.cpp |
650 |
@@ -27,10 +27,6 @@ |
651 |
#include "EngineController.h" |
652 |
#include "LastFmEventXmlParser.h" |
653 |
|
654 |
-// LastFm |
655 |
-#include <lastfm/XmlQuery> |
656 |
-#include <lastfm/ws.h> |
657 |
- |
658 |
// KDE |
659 |
#include <KDateTime> |
660 |
|
661 |
diff --git a/src/core/support/Amarok.h b/src/core/support/Amarok.h |
662 |
index c9852154dee74fb372bae435fdeefa92003d41b1..d8c91e789d02b204202c8a99b9459b8d10b3d90d 100644 |
663 |
--- a/src/core/support/Amarok.h |
664 |
+++ b/src/core/support/Amarok.h |
665 |
@@ -203,6 +203,7 @@ namespace Amarok |
666 |
|
667 |
inline const char* discogsApiKey() { return "91734dd989"; } |
668 |
inline const char* lastfmApiKey() { return "402d3ca8e9bc9d3cf9b85e1202944ca5"; } |
669 |
+ inline const char* lastfmApiSharedSecret() { return "fe0dcde9fcd14c2d1d50665b646335e9"; } |
670 |
inline const char* yahooBossApiKey() { return "oQepTNrV34G9Satb1dgRZ8hdl1uhJvguDSU5Knl2Xd4ALK85knYt6ylr.FTA57XMRBA-"; } |
671 |
inline const char* flickrApiKey() { return "9c5a288116c34c17ecee37877397fe31"; } |
672 |
} |
673 |
diff --git a/CMakeLists.txt b/CMakeLists.txt |
674 |
index 0d146c58bd382b4d4f379ebedddf1630d73db369..31183e59b69cdb3c7902d49bdb93a00a7fb35053 100644 |
675 |
--- a/CMakeLists.txt |
676 |
+++ b/CMakeLists.txt |
677 |
@@ -129,7 +129,7 @@ if( WITH_PLAYER ) |
678 |
# macro_log_feature( STRIGI_FOUND "strigi" "Index metadata of files" "http://strigi.sourceforge.net" FALSE "" "" ) |
679 |
|
680 |
macro_optional_find_package(LibLastFm) |
681 |
- macro_log_feature( LIBLASTFM_FOUND "liblastfm" "Enable Last.Fm service, including scrobbling, song submissions, and suggested song dynamic playlists" "http://cdn.last.fm/src/liblastfm-0.3.0.tar.bz2" FALSE "0.3" "" ) |
682 |
+ macro_log_feature( LIBLASTFM_FOUND "liblastfm" "Enable Last.Fm service, including scrobbling, song submissions, and suggested song dynamic playlists" "http://cdn.last.fm/src/liblastfm-1.0.0.tar.gz" FALSE "1.0.0" "" ) |
683 |
macro_bool_to_01( LIBLASTFM_FOUND HAVE_LIBLASTFM ) |
684 |
|
685 |
macro_optional_find_package( FFmpeg ) |
686 |
diff --git a/cmake/modules/FindLibLastFm.cmake b/cmake/modules/FindLibLastFm.cmake |
687 |
index 1d863b08489e27054a049e35d2d94667646db1f7..95dddb6c082c14c7a6b14eb4501e1283106c8fcf 100644 |
688 |
--- a/cmake/modules/FindLibLastFm.cmake |
689 |
+++ b/cmake/modules/FindLibLastFm.cmake |
690 |
@@ -6,7 +6,7 @@ |
691 |
# LIBLASTFM_FOUND, whether liblastfm was found |
692 |
|
693 |
|
694 |
-find_path(LIBLASTFM_INCLUDE_DIR NAMES Audioscrobbler |
695 |
+find_path(LIBLASTFM_INCLUDE_DIR NAMES lastfm |
696 |
HINTS |
697 |
~/usr/include |
698 |
/opt/local/include |
699 |
diff --git a/src/LastfmReadLabelCapability.cpp b/src/LastfmReadLabelCapability.cpp |
700 |
index 385e6b9c065009b330e116e3d748b82c24f14e8d..d1fb28b6abf2dcf0cf5aaee71dedf1c5328cb59e 100644 |
701 |
--- a/src/LastfmReadLabelCapability.cpp |
702 |
+++ b/src/LastfmReadLabelCapability.cpp |
703 |
@@ -22,8 +22,7 @@ |
704 |
#include <QMap> |
705 |
#include <QNetworkReply> |
706 |
|
707 |
-#include <lastfm/XmlQuery> |
708 |
-#include <ws.h> |
709 |
+#include <lastfm/XmlQuery.h> |
710 |
#include "core/support/Amarok.h" |
711 |
|
712 |
namespace Capabilities |
713 |
@@ -72,7 +71,8 @@ LastfmReadLabelCapability::onTagsFetched() |
714 |
{ |
715 |
case QNetworkReply::NoError: |
716 |
{ |
717 |
- lastfm::XmlQuery lfm = m_job->readAll(); |
718 |
+ lastfm::XmlQuery lfm; |
719 |
+ lfm.parse(m_job->readAll()); |
720 |
QList<lastfm::XmlQuery> tags = lfm.children( "tag" ); |
721 |
QStringList ret; |
722 |
foreach( const lastfm::XmlQuery &child, tags ) |