diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2010-08-13 15:47:32 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2010-08-13 15:47:32 +0000 |
| commit | 0d0e92bb52188c28c99f69376c4b6ee024a06e8e (patch) | |
| tree | e2b231ca58fecab6c3d88e331c208cbfa57a2602 /src/plugins/General | |
| parent | 7f7f5b2e8a47f92bf9d051847771233a5734cd7b (diff) | |
| download | qmmp-0d0e92bb52188c28c99f69376c4b6ee024a06e8e.tar.gz qmmp-0d0e92bb52188c28c99f69376c4b6ee024a06e8e.tar.bz2 qmmp-0d0e92bb52188c28c99f69376c4b6ee024a06e8e.zip | |
fixed lyrics plugin
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1825 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/General')
13 files changed, 87 insertions, 46 deletions
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("<div id=\\\"artist\\\">(.*)</div>"); artist_regexp.setMinimal(true); QRegExp title_regexp("<div id=\\\"title\\\">([^<]*)</div>"); @@ -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 @@ <context> <name>LyricsWindow</name> <message> - <location filename="../lyricswindow.cpp" line="63"/> + <location filename="../lyricswindow.cpp" line="64"/> <source>Done</source> <translation>Hotovo</translation> </message> <message> - <location filename="../lyricswindow.cpp" line="66"/> + <location filename="../lyricswindow.cpp" line="67"/> <source>Error</source> <translation>Chyba</translation> </message> <message> - <location filename="../lyricswindow.cpp" line="97"/> + <location filename="../lyricswindow.cpp" line="127"/> <source>Lyrics: %1 - %2</source> <translation>Text: %1 - %2</translation> </message> @@ -65,12 +65,13 @@ <translation>Nespojeno</translation> </message> <message> - <location filename="../lyricswindow.cpp" line="85"/> + <location filename="../lyricswindow.cpp" line="115"/> <source>Not found</source> <translation>Nenalezeno</translation> </message> <message> <location filename="../lyricswindow.cpp" line="96"/> + <location filename="../lyricswindow.cpp" line="126"/> <source>Receiving</source> <translation>Příjímám</translation> </message> 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 @@ <context> <name>LyricsWindow</name> <message> - <location filename="../lyricswindow.cpp" line="63"/> + <location filename="../lyricswindow.cpp" line="64"/> <source>Done</source> <translation>Fertig</translation> </message> <message> - <location filename="../lyricswindow.cpp" line="66"/> + <location filename="../lyricswindow.cpp" line="67"/> <source>Error</source> <translation>Fehler</translation> </message> <message> - <location filename="../lyricswindow.cpp" line="97"/> + <location filename="../lyricswindow.cpp" line="127"/> <source>Lyrics: %1 - %2</source> <translation>Liedtext: %1 - %2</translation> </message> @@ -65,12 +65,13 @@ <translation>Keine Verbindung</translation> </message> <message> - <location filename="../lyricswindow.cpp" line="85"/> + <location filename="../lyricswindow.cpp" line="115"/> <source>Not found</source> <translation>Es kann kein Liedtext für dieses Stück gefunden werden.</translation> </message> <message> <location filename="../lyricswindow.cpp" line="96"/> + <location filename="../lyricswindow.cpp" line="126"/> <source>Receiving</source> <translation>Daten werden empfangen</translation> </message> 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 @@ <context> <name>LyricsWindow</name> <message> - <location filename="../lyricswindow.cpp" line="63"/> + <location filename="../lyricswindow.cpp" line="64"/> <source>Done</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../lyricswindow.cpp" line="66"/> + <location filename="../lyricswindow.cpp" line="67"/> <source>Error</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../lyricswindow.cpp" line="97"/> + <location filename="../lyricswindow.cpp" line="127"/> <source>Lyrics: %1 - %2</source> <translation>Testo: %1 - %2</translation> </message> @@ -65,12 +65,13 @@ <translation>Nessuna connessione</translation> </message> <message> - <location filename="../lyricswindow.cpp" line="85"/> + <location filename="../lyricswindow.cpp" line="115"/> <source>Not found</source> <translation>Non trovato</translation> </message> <message> <location filename="../lyricswindow.cpp" line="96"/> + <location filename="../lyricswindow.cpp" line="126"/> <source>Receiving</source> <translation>Ricezione</translation> </message> 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 @@ <context> <name>LyricsWindow</name> <message> - <location filename="../lyricswindow.cpp" line="63"/> + <location filename="../lyricswindow.cpp" line="64"/> <source>Done</source> <translation>Atlikta</translation> </message> <message> - <location filename="../lyricswindow.cpp" line="66"/> + <location filename="../lyricswindow.cpp" line="67"/> <source>Error</source> <translation>Klaida</translation> </message> <message> - <location filename="../lyricswindow.cpp" line="97"/> + <location filename="../lyricswindow.cpp" line="127"/> <source>Lyrics: %1 - %2</source> <translation>Dainos tekstas: %1 - %2</translation> </message> @@ -65,12 +65,13 @@ <translation>Nėra ryšio</translation> </message> <message> - <location filename="../lyricswindow.cpp" line="85"/> + <location filename="../lyricswindow.cpp" line="115"/> <source>Not found</source> <translation>Nerasta</translation> </message> <message> <location filename="../lyricswindow.cpp" line="96"/> + <location filename="../lyricswindow.cpp" line="126"/> <source>Receiving</source> <translation>Gaunu</translation> </message> 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 @@ <context> <name>LyricsWindow</name> <message> - <location filename="../lyricswindow.cpp" line="63"/> + <location filename="../lyricswindow.cpp" line="64"/> <source>Done</source> <translation>Klaar</translation> </message> <message> - <location filename="../lyricswindow.cpp" line="66"/> + <location filename="../lyricswindow.cpp" line="67"/> <source>Error</source> <translation>Fout</translation> </message> <message> - <location filename="../lyricswindow.cpp" line="97"/> + <location filename="../lyricswindow.cpp" line="127"/> <source>Lyrics: %1 - %2</source> <translation>Tekst: %1 - %2</translation> </message> @@ -65,12 +65,13 @@ <translation>Geen verbinding</translation> </message> <message> - <location filename="../lyricswindow.cpp" line="85"/> + <location filename="../lyricswindow.cpp" line="115"/> <source>Not found</source> <translation>Niet gevonden</translation> </message> <message> <location filename="../lyricswindow.cpp" line="96"/> + <location filename="../lyricswindow.cpp" line="126"/> <source>Receiving</source> <translation>Bezig met ontvangen</translation> </message> 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 @@ <context> <name>LyricsWindow</name> <message> - <location filename="../lyricswindow.cpp" line="63"/> + <location filename="../lyricswindow.cpp" line="64"/> <source>Done</source> <translation>Gotowe</translation> </message> <message> - <location filename="../lyricswindow.cpp" line="66"/> + <location filename="../lyricswindow.cpp" line="67"/> <source>Error</source> <translation>Błąd</translation> </message> <message> - <location filename="../lyricswindow.cpp" line="85"/> + <location filename="../lyricswindow.cpp" line="115"/> <source>Not found</source> <translation>Nie znaleziono</translation> </message> @@ -66,11 +66,12 @@ </message> <message> <location filename="../lyricswindow.cpp" line="96"/> + <location filename="../lyricswindow.cpp" line="126"/> <source>Receiving</source> <translation>Pobieranie</translation> </message> <message> - <location filename="../lyricswindow.cpp" line="97"/> + <location filename="../lyricswindow.cpp" line="127"/> <source>Lyrics: %1 - %2</source> <translation>Teksty: %1 - %2</translation> </message> 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 @@ <context> <name>LyricsWindow</name> <message> - <location filename="../lyricswindow.cpp" line="63"/> + <location filename="../lyricswindow.cpp" line="64"/> <source>Done</source> <translation>Готово</translation> </message> <message> - <location filename="../lyricswindow.cpp" line="66"/> + <location filename="../lyricswindow.cpp" line="67"/> <source>Error</source> <translation>Ошибка</translation> </message> <message> - <location filename="../lyricswindow.cpp" line="97"/> + <location filename="../lyricswindow.cpp" line="127"/> <source>Lyrics: %1 - %2</source> <translation>Текст песни: %1 - %2</translation> </message> @@ -65,12 +65,13 @@ <translation>Нет соединения</translation> </message> <message> - <location filename="../lyricswindow.cpp" line="85"/> + <location filename="../lyricswindow.cpp" line="115"/> <source>Not found</source> <translation>Не найдено</translation> </message> <message> <location filename="../lyricswindow.cpp" line="96"/> + <location filename="../lyricswindow.cpp" line="126"/> <source>Receiving</source> <translation>Получение</translation> </message> 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 @@ <context> <name>LyricsWindow</name> <message> - <location filename="../lyricswindow.cpp" line="63"/> + <location filename="../lyricswindow.cpp" line="64"/> <source>Done</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../lyricswindow.cpp" line="66"/> + <location filename="../lyricswindow.cpp" line="67"/> <source>Error</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../lyricswindow.cpp" line="85"/> + <location filename="../lyricswindow.cpp" line="115"/> <source>Not found</source> <translation type="unfinished"></translation> </message> @@ -66,11 +66,12 @@ </message> <message> <location filename="../lyricswindow.cpp" line="96"/> + <location filename="../lyricswindow.cpp" line="126"/> <source>Receiving</source> <translation>Alınıyor</translation> </message> <message> - <location filename="../lyricswindow.cpp" line="97"/> + <location filename="../lyricswindow.cpp" line="127"/> <source>Lyrics: %1 - %2</source> <translation>Şarkı Sözü: %1 - %2</translation> </message> 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 @@ <context> <name>LyricsWindow</name> <message> - <location filename="../lyricswindow.cpp" line="63"/> + <location filename="../lyricswindow.cpp" line="64"/> <source>Done</source> <translation>Готово</translation> </message> <message> - <location filename="../lyricswindow.cpp" line="66"/> + <location filename="../lyricswindow.cpp" line="67"/> <source>Error</source> <translation>Помилка</translation> </message> <message> - <location filename="../lyricswindow.cpp" line="97"/> + <location filename="../lyricswindow.cpp" line="127"/> <source>Lyrics: %1 - %2</source> <translation>Тексти: %1 - %2</translation> </message> @@ -65,12 +65,13 @@ <translation>Немає з'єднання</translation> </message> <message> - <location filename="../lyricswindow.cpp" line="85"/> + <location filename="../lyricswindow.cpp" line="115"/> <source>Not found</source> <translation>Не знайдено</translation> </message> <message> <location filename="../lyricswindow.cpp" line="96"/> + <location filename="../lyricswindow.cpp" line="126"/> <source>Receiving</source> <translation>Отримання</translation> </message> 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 @@ <context> <name>LyricsWindow</name> <message> - <location filename="../lyricswindow.cpp" line="63"/> + <location filename="../lyricswindow.cpp" line="64"/> <source>Done</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../lyricswindow.cpp" line="66"/> + <location filename="../lyricswindow.cpp" line="67"/> <source>Error</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../lyricswindow.cpp" line="97"/> + <location filename="../lyricswindow.cpp" line="127"/> <source>Lyrics: %1 - %2</source> <translation>歌词:%1 - %2</translation> </message> @@ -65,12 +65,13 @@ <translation>无连接</translation> </message> <message> - <location filename="../lyricswindow.cpp" line="85"/> + <location filename="../lyricswindow.cpp" line="115"/> <source>Not found</source> <translation type="unfinished"></translation> </message> <message> <location filename="../lyricswindow.cpp" line="96"/> + <location filename="../lyricswindow.cpp" line="126"/> <source>Receiving</source> <translation>接受</translation> </message> 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 @@ <context> <name>LyricsWindow</name> <message> - <location filename="../lyricswindow.cpp" line="63"/> + <location filename="../lyricswindow.cpp" line="64"/> <source>Done</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../lyricswindow.cpp" line="66"/> + <location filename="../lyricswindow.cpp" line="67"/> <source>Error</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../lyricswindow.cpp" line="97"/> + <location filename="../lyricswindow.cpp" line="127"/> <source>Lyrics: %1 - %2</source> <translation>歌詞:%1 - %2</translation> </message> @@ -65,12 +65,13 @@ <translation>無連接</translation> </message> <message> - <location filename="../lyricswindow.cpp" line="85"/> + <location filename="../lyricswindow.cpp" line="115"/> <source>Not found</source> <translation type="unfinished"></translation> </message> <message> <location filename="../lyricswindow.cpp" line="96"/> + <location filename="../lyricswindow.cpp" line="126"/> <source>Receiving</source> <translation>接受</translation> </message> |
