Changeset View
Changeset View
Standalone View
Standalone View
src/lyrics/LyricsManager.cpp
Context not available. | |||||
31 | #include <KLocalizedString> | 31 | #include <KLocalizedString> | ||
---|---|---|---|---|---|
32 | 32 | | |||
33 | 33 | | |||
34 | #define APIURL "http://lyrics.wikia.com/api.php?action=query&prop=revisions&rvprop=content&format=xml&titles=" | 34 | #define APIURL "https://lyrics.fandom.com/api.php?action=query&prop=revisions&rvprop=content&format=xml&titles=" | ||
35 | 35 | | |||
36 | 36 | | |||
37 | LyricsManager* LyricsManager::s_self = nullptr; | 37 | LyricsManager* LyricsManager::s_self = nullptr; | ||
Context not available. | |||||
136 | 136 | | |||
137 | QUrl url( APIURL + artist + QLatin1Char(':') + title ); | 137 | QUrl url( APIURL + artist + QLatin1Char(':') + title ); | ||
138 | m_trackMap.insert( url, track ); | 138 | m_trackMap.insert( url, track ); | ||
139 | | ||||
140 | connect( NetworkAccessManagerProxy::instance(), &NetworkAccessManagerProxy::requestRedirectedUrl, | ||||
141 | this, &LyricsManager::updateRedirectedUrl); | ||||
142 | | ||||
139 | NetworkAccessManagerProxy::instance()->getData( url, this, &LyricsManager::lyricsLoaded ); | 143 | NetworkAccessManagerProxy::instance()->getData( url, this, &LyricsManager::lyricsLoaded ); | ||
140 | } | 144 | } | ||
141 | 145 | | |||
Context not available. | |||||
273 | 277 | | |||
274 | return testText.isEmpty(); | 278 | return testText.isEmpty(); | ||
275 | } | 279 | } | ||
280 | | ||||
281 | void LyricsManager::updateRedirectedUrl(const QUrl& oldUrl, const QUrl& newUrl) | ||||
282 | { | ||||
283 | if( m_trackMap.contains( oldUrl ) && !m_trackMap.contains( newUrl ) ) | ||||
284 | { | ||||
285 | // Get track for the old URL. | ||||
286 | Meta::TrackPtr track = m_trackMap.value( oldUrl ); | ||||
287 | | ||||
288 | // Replace with redirected url for correct lookup | ||||
289 | m_trackMap.insert( newUrl, track ); | ||||
290 | m_trackMap.remove( oldUrl ); | ||||
291 | } | ||||
292 | } | ||||
Context not available. |