Commit 161130b10e910424c0e2a8d3cffdc413d0949b51

  • Tree SHA1: e07cf01
  • Parent SHA1: 86d66d5 (Be safe. If collection plugins couldn't be loaded, crashing keeps the real culprit from being obvious...)
  • raw diff | raw patch
fix cover fetching, use the last.fm web api instead of amazon.
  
33 * Copyright (c) 2004 Stefan Bogner <bochi@online.ms> *
44 * Copyright (c) 2004 Max Howell <max.howell@methylblue.com> *
55 * Copyright (c) 2007 Dan Meltzer <parallelgrapefruit@gmail.com> *
6 * Copyright (c) 2009 Martin Sandsmark <sandsmark@samfundet.no> *
67 * *
78 * This program is free software; you can redistribute it and/or modify it under *
89 * the terms of the GNU General Public License as published by the Free Software *
9090{
9191 m_userCanEditQuery = true;
9292 m_albums << album;
93 buildQueries( album );
93 startFetch( album );
9494}
9595
9696void
113113 m_isFetching = true;
114114 Meta::AlbumPtr firstAlbum = m_albums.takeFirst();
115115 m_albumsMutex.unlock();
116 buildQueries( firstAlbum );
116 startFetch( album );
117117 }
118118 else
119119 {
147147 {
148148 Meta::AlbumPtr album = m_albums.takeFirst();
149149 m_albumsMutex.unlock();
150 buildQueries( album );
150 startFetch( album );
151151 }
152152 else
153153 {
165165// PRIVATE SLOTS
166166//////////////////////////////////////////////////////////////////////////////////////////
167167
168
169void CoverFetcher::buildQueries( Meta::AlbumPtr album )
170{
171 m_fetchMutex.lock();
172 m_isFetching = true;
173 m_fetchMutex.unlock();
174 m_albumPtr = album;
175
176 // Amazon doesn't like accents, so we use cleanPath() to remove them
177 QString albumName = Amarok::cleanPath( album->name() );
178 QString artistName = Amarok::cleanPath( album->hasAlbumArtist() ? album->albumArtist()->name() : QString() );
179
180 QStringList extensions;
181 extensions << i18n("disc") << i18n("disk") << i18n("remaster") << i18n("cd") << i18n("single") << i18n("soundtrack") << i18n("part")
182 << "disc" << "disk" << "remaster" << "cd" << "single" << "soundtrack" << "part" << "cds" /*cd single*/;
183
184 m_queries.clear();
185 m_userQuery.clear();
186
187 //we do several queries, one raw ie, without the following modifications
188 //the others have the above strings removed with the following regex, as this can increase hit-rate
189 const QString template1 = " ?-? ?[(^{]* ?%1 ?\\d*[)^}\\]]* *$"; //eg album - [disk 1] -> album
190 foreach( const QString &extension, extensions ) {
191 QRegExp regexp( template1.arg( extension ) );
192 regexp.setCaseSensitivity( Qt::CaseInsensitive );
193 albumName.remove( regexp );
194 }
195
196 //TODO try queries that remove anything in album after a " - " eg Les Mis. - Excerpts
197
198 /**
199 * We search for artist - album, and just album, using the exact album text and the
200 * manipulated album text.
201 */
202
203 //search on our modified term, then the original
204 if ( !artistName.isEmpty() )
205 m_userQuery = artistName + " - ";
206 m_userQuery += albumName;
207
208 m_queries += m_userQuery;
209 m_queries += artistName + " - " + albumName;
210 m_queries += albumName;
211
212 //don't do the same searches twice in a row
213 m_queries.pop_front();
214 m_queries.pop_back();
215
216 /**
217 * Finally we do a search for just the artist, just in case as this often
218 * turns up a cover, and it might just be the right one! Also it would be
219 * the only valid search if m_album.isEmpty()
220 */
221 m_queries += artistName;
222 debug() << m_queries;
223 startFetch( album );
224}
225168void
226169CoverFetcher::startFetch( Meta::AlbumPtr album )
227170{
173173 m_fetchMutex.unlock();
174174 m_albumPtr = album;
175175
176 // Amarok's Amazon license Key.
177 const QString LICENSE( "0N04TFAWZR6YVWWS3CG2" );
178
179176 // reset all values
180 m_coverAmazonUrls.clear();
181 m_coverAsins.clear();
182 m_coverUrls.clear();
183 m_coverNames.clear();
184177 m_xml.clear();
185178 m_size = 2;
186179
187 if( m_queries.isEmpty() )
188 {
189 debug() << "m_queries is empty";
190 finishWithError( i18n("No cover found") );
191 return;
192 }
193 QString query = m_queries.front();
194 m_queries.pop_front();
180 QUrl url;
181 url.setScheme( "http" );
182 url.setHost( "ws.audioscrobbler.com" );
183 url.setPath( "/2.0/" );
184 url.addQueryItem( "method", "album.getinfo" );
185 url.addQueryItem( "api_key", "402d3ca8e9bc9d3cf9b85e1202944ca5" );
186 url.addQueryItem( "album", album->name().toLocal8Bit() );
195187
196 // '&' breaks searching
197 query.remove('&');
188 if ( album->hasAlbumArtist() )
189 url.addQueryItem( "artist", album->albumArtist()->name().toLocal8Bit() );
198190
199 // Bug 97901: Import cover from amazon france doesn't work properly
200 // (we have to set "mode=music-fr" instead of "mode=music")
201 QString locale = AmarokConfig::amazonLocale();
202 //Amazon Japan isn't on xml.amazon.com
203 QString tld = "com";
204
205 if( locale == "us" )
206 tld = "com";
207 else if( locale =="uk" )
208 tld = "co.uk";
209 else
210 tld = locale;
211
212 QString url;
213 url = "http://ecs.amazonaws." + tld
214 + "/onca/xml?Service=AWSECommerceService&Version=2007-10-29&Operation=ItemSearch&AssociateTag=amarok-20&AWSAccessKeyId=" + LICENSE
215 + "&Keywords=" + QUrl::toPercentEncoding( query, "/" )
216 + "&SearchIndex=Music&ResponseGroup=Small,Images";
217191 debug() << url;
218192
219193 KJob* job = KIO::storedGet( url, KIO::NoReload, KIO::HideProgressInfo );
195195
196196 if( m_userCanEditQuery )
197197 The::statusBar()->newProgressOperation( job, i18n( "Fetching Cover" ) );
198
199198}
200199
201200void
203203 // NOTE: job can become 0 when this method is called from attemptAnotherFetch()
204204 if( job && job->error() )
205205 {
206 finishWithError( i18n("There was an error communicating with Amazon."), job );
206 finishWithError( i18n( "There was an error communicating with last.fm." ), job );
207207 return;
208208 }
209209
210 //FIXME: Do we still need this? Check after 2.0 final... why is it commented out.
211 /*
212 if( m_albums.isEmpty() )
213 {
214 finishWithError( i18n("Internal error, no albums in queue"), job );
215 return;
216 }
217 */
218
219210 if( job )
220211 {
221212 KIO::StoredTransferJob* const storedJob = static_cast<KIO::StoredTransferJob*>( job );
216216 QDomDocument doc;
217217 if( !doc.setContent( m_xml ) )
218218 {
219 m_errors += i18n("The XML obtained from Amazon is invalid.");
219 m_errors += i18n( "The XML obtained from Last.fm is invalid." );
220220 if( m_albums.size() > 0 )
221 buildQueries( m_albums.takeFirst() );
221 startFetch( m_albums.takeFirst() );
222
222223 return;
223224 }
224225
225 const QDomNode details = doc.documentElement().namedItem( "Details" );
226 const QDomNodeList list = doc.documentElement().namedItem( "album" ).childNodes();
226227
227 // the url for the Amazon product info page
228 const QDomNodeList list = doc.documentElement().namedItem( "Items" ).childNodes();
229
230 for(int i = 0; i < list.count(); i++ )
231 {
232 QDomNode n = list.item( i );
233 if( n.isElement() && n.nodeName() == "IsValid" )
234 {
235 if( n.toElement().text() == "False" )
236 {
237 warning() << "The XML Is Invalid!";
238 return;
239 }
240 }
241 else if( list.item( i ).nodeName() == "Item" )
242 {
243 const QDomNode node = list.item( i );
244 parseItemNode( node );
245 }
246 }
247 attemptAnotherFetch();
248}
249
250
251void CoverFetcher::parseItemNode( const QDomNode &node )
252{
253 QDomNode it = node.firstChild();
254
255228 QString size;
256229 switch( m_size )
257230 {
258 case 0: size = "Small"; break;
259 case 1: size = "Medium"; break;
260 default: size = "Large"; break;
231 case 0: size = "small"; break;
232 case 1: size = "medium"; break;
233 default: size = "large"; break;
261234 }
262 size += "Image";
263
264 while( !it.isNull() )
235 QString coverUrl;
236 for( int i = 0; i < list.count(); i++ )
265237 {
266 if( it.isElement() )
238 QDomNode n = list.item( i );
239 if( n.nodeName() == "image" )
267240 {
268 QDomElement e = it.toElement();
269 if( e.tagName() == "ASIN" )
270 {
271 m_asin = e.text();
272 m_coverAsins += m_asin;
273 }
274 else if( e.tagName() == "DetailPageURL" )
275 {
276 m_amazonURL = e.text();
277 m_coverAmazonUrls += m_amazonURL;
278 }
279 else if( e.tagName() == size )
280 {
281 QDomNode subIt = e.firstChild();
282 while( !subIt.isNull() )
283 {
284 if( subIt.isElement() )
285 {
286 QDomElement subE = subIt.toElement();
287 if( subE.tagName() == "URL" )
288 {
289 const QString coverUrl = subE.text();
290 m_coverUrls += coverUrl;
291 break;
292 }
293 }
294 subIt = subIt.nextSibling();
295 }
296 }
297 else if( e.tagName() == "ItemAttributes" )
298 {
299 QDomNodeList nodes = e.childNodes();
300 QDomNode iter;
301 QString artist;
302 QString album;
303 for( int i = 0; i < nodes.count(); i++ )
304 {
305 iter = nodes.item( i );
241 const QDomNode node = list.item( i );
306242
307 if( iter.isElement() )
308 {
309 if( iter.nodeName() == "Artist" )
310 {
311 artist = iter.toElement().text();
312 }
313 else if( iter.nodeName() == "Title" )
314 {
315 album = iter.toElement().text();
316 }
317 }
243 if ( node.hasAttributes() ) {
244 const QString imageSize = node.attributes().namedItem( "size" ).nodeValue();
245 if ( imageSize == size && node.isElement() ) {
246 coverUrl = node.toElement().text();
318247 }
319 m_coverNames += QString( artist + " - " + album );
320248 }
321249 }
322 it = it.nextSibling();
323250 }
251
252 if ( coverUrl.isEmpty() ) return;
253
254 KJob* getJob = KIO::storedGet( KUrl(coverUrl), KIO::NoReload, KIO::HideProgressInfo );
255 connect( getJob, SIGNAL( result( KJob* ) ), SLOT( finishedImageFetch( KJob* ) ) );
324256}
325257
326258void
327259CoverFetcher::finishedImageFetch( KJob *job ) //SLOT
328260{
329 if( job->error() )
261 if( job->error() || !m_pixmap.loadFromData( static_cast<KIO::StoredTransferJob*>( job )->data() ) )
330262 {
331263 debug() << "finishedImageFetch(): KIO::error(): " << job->error();
332 m_errors += i18n("The cover could not be retrieved.");
333 attemptAnotherFetch();
264 m_errors += i18n( "The cover could not be retrieved." );
334265 return;
335266 }
336267
337 if( !m_pixmap.loadFromData( static_cast<KIO::StoredTransferJob*>( job )->data() ) || m_pixmap.width() <= 1 )
338 {
339 //Amazon seems to offer images of size 1x1 sometimes
340 //Amazon has nothing to offer us for the requested image size
341 m_errors += i18n("The cover-data produced an invalid image.");
342 attemptAnotherFetch();
343 }
344
345268 else if( m_userCanEditQuery )
346269 {
347270 //yay! image found :)
278278 The::statusBar()->endProgressOperation( job ); //just to be safe...
279279}
280280
281
282void
283CoverFetcher::attemptAnotherFetch()
284{
285
286 if( !m_coverUrls.isEmpty() )
287 {
288 // Amazon suggested some more cover URLs to try before we
289 // try a different query
290 KJob* job = KIO::storedGet( KUrl(m_coverUrls.front()), KIO::NoReload, KIO::HideProgressInfo );
291 connect( job, SIGNAL(result( KJob* )), SLOT(finishedImageFetch( KJob* )) );
292
293 if( m_userCanEditQuery )
294 The::statusBar()->newProgressOperation( job, i18n( "Fetching Cover" ) );
295
296 m_coverUrls.pop_front();
297
298 m_currentCoverName = m_coverNames.front();
299 m_coverNames.pop_front();
300
301 m_amazonURL = m_coverAmazonUrls.front();
302 m_coverAmazonUrls.pop_front();
303
304 m_asin = m_coverAsins.front();
305 m_coverAsins.pop_front();
306 }
307
308 else if( !m_xml.isEmpty() && m_size > 0 )
309 {
310 // we need to try smaller sizes, this often is
311 // fruitless, but does work out sometimes.
312 m_size--;
313
314 finishedXmlFetch( 0 );
315 }
316
317 else if( !m_queries.isEmpty() )
318 {
319 // we have some queries left in the pot
320 startFetch( m_albumPtr );
321 }
322 else if( m_userCanEditQuery )
323 {
324 // we have exhausted all the predetermined queries
325 // so lets let the user give it a try
326 getUserQuery( i18n("You have seen all the covers Amazon returned using the query below. Perhaps you can refine it:") );
327 m_coverAmazonUrls.clear();
328 m_coverAsins.clear();
329 m_coverUrls.clear();
330 m_coverNames.clear();
331 }
332 else
333 {
334 m_isFetching = false;
335 finishWithError( i18n("No cover found") );
336 }
337}
338
339
340// Moved outside the only function that uses it because
341// gcc 2.95 doesn't like class declarations there.
342 class EditSearchDialog : public QDialog, public Ui::EditCoverSearchDialog
343 {
344 public:
345 EditSearchDialog( QWidget* parent, const QString &text, const QString &keyword, CoverFetcher *fetcher )
346 : QDialog( parent )
347 {
348 setupUi( this );
349 setWindowTitle( i18n( "Amazon Query Editor" ) );
350 textLabel->setText( text );
351 SearchLineEdit->setText( keyword );
352
353 if( CoverManager::instance() )
354 connect( amazonLocale, SIGNAL( activated(int) ),
355 CoverManager::instance(), SLOT( changeLocale(int) ) );
356 else
357 connect( amazonLocale, SIGNAL( activated(int) ),
358 fetcher, SLOT( changeLocale(int) ) );
359
360 int currentLocale = CoverFetcher::localeStringToID( AmarokConfig::amazonLocale() );
361 amazonLocale->setCurrentIndex( currentLocale );
362
363 adjustSize();
364 setFixedHeight( height() );
365 }
366
367 QString query() { return SearchLineEdit->text(); }
368 };
369
370QString
371CoverFetcher::localeIDToString( int id )//static
372{
373 switch ( id )
374 {
375 case International:
376 return "us";
377 case Canada:
378 return "ca";
379 case France:
380 return "fr";
381 case Germany:
382 return "de";
383 case Japan:
384 return "jp";
385 case UK:
386 return "uk";
387 }
388
389 return "us";
390}
391
392int
393CoverFetcher::localeStringToID( const QString &s )
394{
395 int id = International;
396 if( s == "fr" ) id = France;
397 else if( s == "de" ) id = Germany;
398 else if( s == "jp" ) id = Japan;
399 else if( s == "uk" ) id = UK;
400 else if( s == "ca" ) id = Canada;
401
402 return id;
403}
404
405void
406CoverFetcher::changeLocale( int id )//SLOT
407{
408 QString locale = localeIDToString( id );
409 AmarokConfig::setAmazonLocale( locale );
410}
411
412void
413CoverFetcher::getUserQuery( QString explanation )
414{
415 if( explanation.isEmpty() )
416 explanation = i18n("Ask Amazon for covers using this query:");
417
418 EditSearchDialog dialog(
419 static_cast<QWidget*>( parent() ),
420 explanation,
421 m_userQuery,
422 this );
423
424
425 switch( dialog.exec() )
426 {
427 case QDialog::Accepted:
428 m_userQuery = dialog.query();
429 debug() << m_userQuery;
430 m_queries.clear();
431 m_queries << m_userQuery;
432 startFetch( m_albumPtr );
433 break;
434 case QDialog::Rejected:
435 break;
436 default:
437 finishWithError( i18n( "Aborted." ) );
438 break;
439 }
440}
441
442281 class CoverFoundDialog : public KDialog
443282 {
444283 public:
293293 QLabel *labelName = new QLabel( box );
294294 KHBox *buttons = new KHBox( box );
295295 KPushButton *save = new KPushButton( KStandardGuiItem::save(), buttons );
296 KPushButton *newsearch = new KPushButton( i18n( "Ne&w Search..." ), buttons );
297 newsearch->setObjectName( "NewSearch" );
298 KPushButton *nextcover = new KPushButton( i18n( "&Next Cover" ), buttons );
299 nextcover->setObjectName( "NextCover" );
300296 KPushButton *cancel = new KPushButton( KStandardGuiItem::cancel(), buttons );
301297
302298 labelPix ->setAlignment( Qt::AlignHCenter );
305305 this->setCaption( i18n("Cover Found") );
306306
307307 connect( save, SIGNAL(clicked()), SLOT(accept()) );
308 connect( newsearch, SIGNAL(clicked()), SLOT(accept()) );
309 connect( nextcover, SIGNAL(clicked()), SLOT(accept()) );
310308 connect( cancel, SIGNAL(clicked()), SLOT(reject()) );
311309 }
312310
333333 case KDialog::Rejected: //make sure we do not show any more dialogs
334334 debug() << "cover rejected";
335335 break;
336 case 1000: //showQueryEditor()
337 getUserQuery();
338 m_coverAmazonUrls.clear();
339 m_coverAsins.clear();
340 m_coverUrls.clear();
341 m_coverNames.clear();
342 break;
343 case 1001: //nextCover()
344 attemptAnotherFetch();
345 break;
346336 default:
347337 finishWithError( i18n( "Aborted." ) );
348338 break;
347347 m_albumPtr->setImage( image() );
348348 m_isFetching = false;
349349 if( !m_userCanEditQuery /*manual fetch*/ && !m_albums.isEmpty() )
350 buildQueries( m_albums.takeFirst() );
350 startFetch( m_albums.takeFirst() );
351
351352}
352353
353354void
368368 if( !m_albums.isEmpty() )
369369 {
370370 debug() << "next album" << m_albums[0]->name();
371 buildQueries( m_albums.takeFirst() );
371 startFetch( m_albums.takeFirst() );
372372 }
373
373374}
374375
375376#include "CoverFetcher.moc"
  
22 * Copyright (c) 2004 Mark Kretschmann <kretschmann@kde.org> *
33 * Copyright (c) 2004 Stefan Bogner <bochi@online.ms> *
44 * Copyright (c) 2007 Dan Meltzer <parallelgrapefruit@gmail.com> *
5 * Copyright (c) 2009 Martin Sandsmark <sandsmark@samfundet.no> *
56 * *
67 * This program is free software; you can redistribute it and/or modify it under *
78 * the terms of the GNU General Public License as published by the Free Software *
7272 /// Main Fetch loop
7373 AMAROK_EXPORT void manualFetch( Meta::AlbumPtr album );
7474
75 QString amazonURL() const { return m_amazonURL; }
76 QString asin() const { return m_asin; }
7775 QPixmap image() const { return m_pixmap; }
7876
7977 AMAROK_EXPORT void queueAlbum( Meta::AlbumPtr album );
8080 bool wasError() const { return !m_success; }
8181 QStringList errors() const { return m_errors; }
8282
83 enum Locale { International = 0, Canada, France, Germany, Japan, UK };
84 static QString localeIDToString( int id );
85 static int localeStringToID( const QString &locale );
86
8783private slots:
8884 void finishedXmlFetch( KJob * job );
8985 void finishedImageFetch( KJob * job );
90 void changeLocale( int id );
9186
9287private:
9388 static CoverFetcher* s_instance;
100100 QString m_userQuery; /// the query from the query edit dialog
101101 QString m_xml;
102102 QPixmap m_pixmap;
103 QString m_amazonURL;
104103 QString m_asin;
105104 int m_size;
106105
107106 QStringList m_queries;
108 QStringList m_coverAsins;
109 QStringList m_coverAmazonUrls;
110 QStringList m_coverUrls;
111 QStringList m_coverNames;
112107 QString m_currentCoverName;
113108 QStringList m_errors;
114109
111111 bool m_isFetching;
112112
113113private:
114 void buildQueries( Meta::AlbumPtr album );
115
116114 /// Fetch a cover
117115 void startFetch( Meta::AlbumPtr album );
118116
119119
120120 /// The fetch failed, finish up and log an error message
121121 void finishWithError( const QString &message, KJob *job = 0 );
122
123 /// Prompt the user for a query
124 void getUserQuery( QString explanation = QString() );
125
126 /// Will try all available queries, and then prompt the user, if allowed
127 void attemptAnotherFetch();
128122
129123 /// Show the cover that has been found
130124 void showCover();
  
194194 viewGroup->addAction( m_selectAlbumsWithoutCover );
195195 m_selectAllAlbums->setChecked( true );
196196
197 // amazon locale menu
198 QString locale = AmarokConfig::amazonLocale();
199 m_currentLocale = CoverFetcher::localeStringToID( locale );
200
201 QAction *a;
202 QActionGroup *localeGroup = new QActionGroup( this );
203 localeGroup->setExclusive( true );
204
205 m_amazonLocaleMenu = new KMenu( this );
206
207 a = m_amazonLocaleMenu->addAction( i18nc( "The locale to use when fetching covers from amazon.com", "International"), this, SLOT( slotSetLocaleIntl() ) );
208 if( m_currentLocale == CoverFetcher::International ) a->setChecked( true );
209 localeGroup->addAction( a );
210
211 a = m_amazonLocaleMenu->addAction( i18n("Canada"), this, SLOT( slotSetLocaleCa() ) );
212 if( m_currentLocale == CoverFetcher::Canada ) a->setChecked( true );
213 localeGroup->addAction( a );
214
215 a = m_amazonLocaleMenu->addAction( i18n("France"), this, SLOT( slotSetLocaleFr() ) );
216 if( m_currentLocale == CoverFetcher::France ) a->setChecked( true );
217 localeGroup->addAction( a );
218
219 a = m_amazonLocaleMenu->addAction( i18n("Germany"), this, SLOT( slotSetLocaleDe() ) );
220 if( m_currentLocale == CoverFetcher::Germany ) a->setChecked( true );
221 localeGroup->addAction( a );
222
223 a = m_amazonLocaleMenu->addAction( i18n("Japan"), this, SLOT( slotSetLocaleJp() ) );
224 if( m_currentLocale == CoverFetcher::Japan ) a->setChecked( true );
225 localeGroup->addAction( a );
226
227 a = m_amazonLocaleMenu->addAction( i18n("United Kingdom"), this, SLOT( slotSetLocaleUk() ) );
228 if( m_currentLocale == CoverFetcher::UK ) a->setChecked( true );
229 localeGroup->addAction( a );
230
231 KToolBar* toolBar = new KToolBar( hbox );
232 toolBar->setToolButtonStyle( Qt::ToolButtonTextBesideIcon );
233 {
234 QAction* viewMenuAction = new QAction( KIcon( "view-list-icons" ), i18nc( "@title buttontext for popup-menu", "View" ), this );
235 viewMenuAction->setMenu( m_viewMenu );
236 toolBar->addAction( viewMenuAction );
237 }
238 {
239 QAction* localeMenuAction = new QAction( KIcon( "preferences-desktop-locale-amarok" ), i18n( "Amazon Locale" ), this );
240 localeMenuAction->setMenu( m_amazonLocaleMenu );
241 toolBar->addAction( localeMenuAction );
242 }
243
244197 //fetch missing covers button
245198 m_fetchButton = new KPushButton( KGuiItem( i18n("Fetch Missing Covers"), "get-hot-new-stuff-amarok" ), hbox );
246199 connect( m_fetchButton, SIGNAL(clicked()), SLOT(fetchMissingCovers()) );
287287 dialog->show();
288288}
289289
290
291QString CoverManager::amazonTld() //static
292{
293 if( AmarokConfig::amazonLocale() == "us" )
294 return "com";
295 else if( AmarokConfig::amazonLocale()== "jp" )
296 return "jp";
297 else if( AmarokConfig::amazonLocale() == "uk" )
298 return "co.uk";
299 else if( AmarokConfig::amazonLocale() == "ca" )
300 return "ca";
301 else
302 return AmarokConfig::amazonLocale();
303}
304
305290void
306291CoverManager::metadataChanged( Meta::AlbumPtr album )
307292{
540540 }
541541 m_currentView = id;
542542}
543
544void CoverManager::changeLocale( int id ) //SLOT
545{
546 QString locale = CoverFetcher::localeIDToString( id );
547 AmarokConfig::setAmazonLocale( locale );
548 m_currentLocale = id;
549}
550
551543
552544void CoverManager::coverFetched( const QString &artist, const QString &album ) //SLOT
553545{
  
6262
6363 void setStatusText( QString text );
6464
65 // Return the top level domain for the current locale
66 static QString amazonTld();
67
6865 // Reimplemented from Meta::Observer
6966 using Observer::metadataChanged;
7067 void metadataChanged( Meta::AlbumPtr album );
7168
7269 public slots:
7370 void updateStatusBar();
74 void changeLocale( int id );
7571
7672 private slots:
7773 void slotArtistQueryResult( QString collectionId, Meta::ArtistList artists );
8686 void slotShowAlbumsWithCover() { changeView( AlbumsWithCover ); }
8787 void slotShowAlbumsWithoutCover() { changeView( AlbumsWithoutCover ); }
8888 void changeView( int id );
89
90 void slotSetLocaleIntl() { changeLocale( CoverFetcher::International ); }
91 void slotSetLocaleCa() { changeLocale( CoverFetcher::Canada ); }
92 void slotSetLocaleDe() { changeLocale( CoverFetcher::Germany ); }
93 void slotSetLocaleFr() { changeLocale( CoverFetcher::France ); }
94 void slotSetLocaleJp() { changeLocale( CoverFetcher::Japan ); }
95 void slotSetLocaleUk() { changeLocale( CoverFetcher::UK ); }
9689
9790 void fetchMissingCovers();
9891 void coverFetched( const QString&, const QString& );
105105 CoverView *m_coverView;
106106 Amarok::LineEdit *m_searchEdit;
107107 KPushButton *m_fetchButton;
108 KMenu *m_amazonLocaleMenu;
109108 KMenu *m_viewMenu;
110 QToolButton *m_amazonLocaleButton;
111109 QToolButton *m_viewButton;
112 int m_currentLocale;
113110 int m_currentView;
114111
115112 Meta::ArtistList m_artistList;