From 0d0e92bb52188c28c99f69376c4b6ee024a06e8e Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Fri, 13 Aug 2010 15:47:32 +0000 Subject: fixed lyrics plugin git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1825 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/General/lyrics/lyricswindow.cpp | 32 +++++++++++++++++++++- src/plugins/General/lyrics/lyricswindow.h | 2 +- .../lyrics/translations/lyrics_plugin_cs.ts | 9 +++--- .../lyrics/translations/lyrics_plugin_de.ts | 9 +++--- .../lyrics/translations/lyrics_plugin_it.ts | 9 +++--- .../lyrics/translations/lyrics_plugin_lt.ts | 9 +++--- .../lyrics/translations/lyrics_plugin_nl.ts | 9 +++--- .../lyrics/translations/lyrics_plugin_pl.ts | 9 +++--- .../lyrics/translations/lyrics_plugin_ru.ts | 9 +++--- .../lyrics/translations/lyrics_plugin_tr.ts | 9 +++--- .../lyrics/translations/lyrics_plugin_uk_UA.ts | 9 +++--- .../lyrics/translations/lyrics_plugin_zh_CN.ts | 9 +++--- .../lyrics/translations/lyrics_plugin_zh_TW.ts | 9 +++--- 13 files changed, 87 insertions(+), 46 deletions(-) (limited to 'src/plugins/General') diff --git a/src/plugins/General/lyrics/lyricswindow.cpp b/src/plugins/General/lyrics/lyricswindow.cpp index aa19cbfbe..03ac3b2bd 100644 --- a/src/plugins/General/lyrics/lyricswindow.cpp +++ b/src/plugins/General/lyrics/lyricswindow.cpp @@ -34,6 +34,7 @@ LyricsWindow::LyricsWindow(const QString &artist, const QString &title, QWidget setWindowFlags(Qt::Dialog); setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_QuitOnClose, false); + m_requestReply = 0; ui.artistLineEdit->setText(artist); ui.titleLineEdit->setText(title); m_http = new QNetworkAccessManager(this); @@ -65,10 +66,39 @@ void LyricsWindow::showText(QNetworkReply *reply) { ui.stateLabel->setText(tr("Error")); ui.textBrowser->setText(reply->errorString()); + m_requestReply = 0; + reply->deleteLater(); return; } QString content = QString::fromUtf8(reply->readAll().constData()); + if(m_requestReply == reply) + { + m_requestReply = 0; + QRegExp js_params("javascript:getContent\\(\\\'(.*)\\\', \\\'(.*)\\\', \\\'(.*)\\\', \\\'(.*)\\\'"); + js_params.setMinimal (true); + js_params.indexIn(content); + + QUrl url = QString("http://www.lyricsplugin.com/winamp03/plugin/content.php?") + + "artist=" + js_params.cap(1) + + "&title=" + js_params.cap(2) + + "&time=" + js_params.cap(3) + + "&check=" + js_params.cap(4); + + QString referer = QString("http://www.lyricsplugin.com/winamp03/plugin/?") + + "artist=" + js_params.cap(1) + + "&title=" + js_params.cap(2); + + qDebug("LyricsWindow: request url = %s", url.toEncoded().constData()); + QNetworkRequest request; + request.setUrl(url); + request.setRawHeader("Referer", referer.toAscii()); + ui.stateLabel->setText(tr("Receiving")); + m_http->get(request); + reply->deleteLater(); + return; + } + QRegExp artist_regexp("
(.*)
"); artist_regexp.setMinimal(true); QRegExp title_regexp("
([^<]*)
"); @@ -100,5 +130,5 @@ void LyricsWindow::on_searchPushButton_clicked() request.setUrl(QUrl("http://www.lyricsplugin.com/winamp03/plugin/?artist=" + ui.artistLineEdit->text()+"&title=" + ui.titleLineEdit->text())); request.setRawHeader("User-Agent", QString("qmmp/%1").arg(Qmmp::strVersion()).toAscii()); - m_http->get(request); + m_requestReply = m_http->get(request); } diff --git a/src/plugins/General/lyrics/lyricswindow.h b/src/plugins/General/lyrics/lyricswindow.h index 5363963a2..026f71d0b 100644 --- a/src/plugins/General/lyrics/lyricswindow.h +++ b/src/plugins/General/lyrics/lyricswindow.h @@ -45,7 +45,7 @@ private slots: private: Ui::LyricsWindow ui; QNetworkAccessManager *m_http; - + QNetworkReply *m_requestReply; }; #endif diff --git a/src/plugins/General/lyrics/translations/lyrics_plugin_cs.ts b/src/plugins/General/lyrics/translations/lyrics_plugin_cs.ts index ccc4d322f..eae3375b9 100644 --- a/src/plugins/General/lyrics/translations/lyrics_plugin_cs.ts +++ b/src/plugins/General/lyrics/translations/lyrics_plugin_cs.ts @@ -45,17 +45,17 @@ LyricsWindow - + Done Hotovo - + Error Chyba - + Lyrics: %1 - %2 Text: %1 - %2 @@ -65,12 +65,13 @@ Nespojeno - + Not found Nenalezeno + Receiving Příjímám diff --git a/src/plugins/General/lyrics/translations/lyrics_plugin_de.ts b/src/plugins/General/lyrics/translations/lyrics_plugin_de.ts index e4b448867..d62df38c9 100644 --- a/src/plugins/General/lyrics/translations/lyrics_plugin_de.ts +++ b/src/plugins/General/lyrics/translations/lyrics_plugin_de.ts @@ -45,17 +45,17 @@ LyricsWindow - + Done Fertig - + Error Fehler - + Lyrics: %1 - %2 Liedtext: %1 - %2 @@ -65,12 +65,13 @@ Keine Verbindung - + Not found Es kann kein Liedtext für dieses Stück gefunden werden. + Receiving Daten werden empfangen diff --git a/src/plugins/General/lyrics/translations/lyrics_plugin_it.ts b/src/plugins/General/lyrics/translations/lyrics_plugin_it.ts index f43fd4627..3c4a19bb1 100644 --- a/src/plugins/General/lyrics/translations/lyrics_plugin_it.ts +++ b/src/plugins/General/lyrics/translations/lyrics_plugin_it.ts @@ -45,17 +45,17 @@ LyricsWindow - + Done - + Error - + Lyrics: %1 - %2 Testo: %1 - %2 @@ -65,12 +65,13 @@ Nessuna connessione - + Not found Non trovato + Receiving Ricezione diff --git a/src/plugins/General/lyrics/translations/lyrics_plugin_lt.ts b/src/plugins/General/lyrics/translations/lyrics_plugin_lt.ts index b9a37cf00..26c738f9b 100644 --- a/src/plugins/General/lyrics/translations/lyrics_plugin_lt.ts +++ b/src/plugins/General/lyrics/translations/lyrics_plugin_lt.ts @@ -45,17 +45,17 @@ LyricsWindow - + Done Atlikta - + Error Klaida - + Lyrics: %1 - %2 Dainos tekstas: %1 - %2 @@ -65,12 +65,13 @@ Nėra ryšio - + Not found Nerasta + Receiving Gaunu diff --git a/src/plugins/General/lyrics/translations/lyrics_plugin_nl.ts b/src/plugins/General/lyrics/translations/lyrics_plugin_nl.ts index 966f85fc6..fb47aaa8b 100644 --- a/src/plugins/General/lyrics/translations/lyrics_plugin_nl.ts +++ b/src/plugins/General/lyrics/translations/lyrics_plugin_nl.ts @@ -45,17 +45,17 @@ LyricsWindow - + Done Klaar - + Error Fout - + Lyrics: %1 - %2 Tekst: %1 - %2 @@ -65,12 +65,13 @@ Geen verbinding - + Not found Niet gevonden + Receiving Bezig met ontvangen diff --git a/src/plugins/General/lyrics/translations/lyrics_plugin_pl.ts b/src/plugins/General/lyrics/translations/lyrics_plugin_pl.ts index 028544017..3ea4551ea 100644 --- a/src/plugins/General/lyrics/translations/lyrics_plugin_pl.ts +++ b/src/plugins/General/lyrics/translations/lyrics_plugin_pl.ts @@ -45,17 +45,17 @@ LyricsWindow - + Done Gotowe - + Error Błąd - + Not found Nie znaleziono @@ -66,11 +66,12 @@ + Receiving Pobieranie - + Lyrics: %1 - %2 Teksty: %1 - %2 diff --git a/src/plugins/General/lyrics/translations/lyrics_plugin_ru.ts b/src/plugins/General/lyrics/translations/lyrics_plugin_ru.ts index c9ff7dfcb..0928dd44a 100644 --- a/src/plugins/General/lyrics/translations/lyrics_plugin_ru.ts +++ b/src/plugins/General/lyrics/translations/lyrics_plugin_ru.ts @@ -45,17 +45,17 @@ LyricsWindow - + Done Готово - + Error Ошибка - + Lyrics: %1 - %2 Текст песни: %1 - %2 @@ -65,12 +65,13 @@ Нет соединения - + Not found Не найдено + Receiving Получение diff --git a/src/plugins/General/lyrics/translations/lyrics_plugin_tr.ts b/src/plugins/General/lyrics/translations/lyrics_plugin_tr.ts index 87fca0ccc..ac156c378 100644 --- a/src/plugins/General/lyrics/translations/lyrics_plugin_tr.ts +++ b/src/plugins/General/lyrics/translations/lyrics_plugin_tr.ts @@ -45,17 +45,17 @@ LyricsWindow - + Done - + Error - + Not found @@ -66,11 +66,12 @@ + Receiving Alınıyor - + Lyrics: %1 - %2 Şarkı Sözü: %1 - %2 diff --git a/src/plugins/General/lyrics/translations/lyrics_plugin_uk_UA.ts b/src/plugins/General/lyrics/translations/lyrics_plugin_uk_UA.ts index 7215c6243..5fc0d08c8 100644 --- a/src/plugins/General/lyrics/translations/lyrics_plugin_uk_UA.ts +++ b/src/plugins/General/lyrics/translations/lyrics_plugin_uk_UA.ts @@ -45,17 +45,17 @@ LyricsWindow - + Done Готово - + Error Помилка - + Lyrics: %1 - %2 Тексти: %1 - %2 @@ -65,12 +65,13 @@ Немає з'єднання - + Not found Не знайдено + Receiving Отримання diff --git a/src/plugins/General/lyrics/translations/lyrics_plugin_zh_CN.ts b/src/plugins/General/lyrics/translations/lyrics_plugin_zh_CN.ts index ee6da7266..8411aff18 100644 --- a/src/plugins/General/lyrics/translations/lyrics_plugin_zh_CN.ts +++ b/src/plugins/General/lyrics/translations/lyrics_plugin_zh_CN.ts @@ -45,17 +45,17 @@ LyricsWindow - + Done - + Error - + Lyrics: %1 - %2 歌词:%1 - %2 @@ -65,12 +65,13 @@ 无连接 - + Not found + Receiving 接受 diff --git a/src/plugins/General/lyrics/translations/lyrics_plugin_zh_TW.ts b/src/plugins/General/lyrics/translations/lyrics_plugin_zh_TW.ts index c28616283..87ad0cb26 100644 --- a/src/plugins/General/lyrics/translations/lyrics_plugin_zh_TW.ts +++ b/src/plugins/General/lyrics/translations/lyrics_plugin_zh_TW.ts @@ -45,17 +45,17 @@ LyricsWindow - + Done - + Error - + Lyrics: %1 - %2 歌詞:%1 - %2 @@ -65,12 +65,13 @@ 無連接 - + Not found + Receiving 接受 -- cgit v1.2.3-13-gbd6f