From 00c75af2d94243249ff37168a980352fc6f65ebd Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Thu, 3 Oct 2019 19:56:56 +0000 Subject: added lyrics providers git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@9081 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/General/CMakeLists.txt | 2 +- src/plugins/General/lyrics/lyricswindow.cpp | 14 +- src/plugins/General/lyrics/lyricswindow.h | 3 +- src/plugins/General/lyrics/providers/providers.qrc | 6 + .../lyrics/providers/ultimate_providers.xml | 313 +++++++++++++++++++++ 5 files changed, 330 insertions(+), 8 deletions(-) create mode 100644 src/plugins/General/lyrics/providers/providers.qrc create mode 100644 src/plugins/General/lyrics/providers/ultimate_providers.xml diff --git a/src/plugins/General/CMakeLists.txt b/src/plugins/General/CMakeLists.txt index f6c81baf5..71dd3a686 100644 --- a/src/plugins/General/CMakeLists.txt +++ b/src/plugins/General/CMakeLists.txt @@ -41,7 +41,7 @@ add_subdirectory(notifier) ENDIF(USE_NOTIFIER) IF(USE_LYRICS) -add_subdirectory(lyrics) +#add_subdirectory(lyrics) ENDIF(USE_LYRICS) IF(USE_HAL AND Qt5DBus_FOUND) diff --git a/src/plugins/General/lyrics/lyricswindow.cpp b/src/plugins/General/lyrics/lyricswindow.cpp index 1754413b3..3e59893df 100644 --- a/src/plugins/General/lyrics/lyricswindow.cpp +++ b/src/plugins/General/lyrics/lyricswindow.cpp @@ -28,7 +28,6 @@ #include #include #include -//#include "ultimatelyricsparser.h" #include "lyricswindow.h" LyricsWindow::LyricsWindow(const QString &artist, const QString &title, QWidget *parent) @@ -59,6 +58,9 @@ LyricsWindow::LyricsWindow(const QString &artist, const QString &title, QWidget } connect(m_http, SIGNAL(finished (QNetworkReply *)), SLOT(showText(QNetworkReply *))); + if(!m_parser.load(":/ultimate_providers.xml")) + qWarning("LyricsWindow: unable to load ultimate_providers.xml"); + QDir cacheDir(m_cachePath); if(!cacheDir.exists()) { @@ -67,9 +69,6 @@ LyricsWindow::LyricsWindow(const QString &artist, const QString &title, QWidget } if(!loadFromCache()) on_searchPushButton_clicked(); - - //UltimateLyricsParser parser; - //parser.load(":/ultimate_providers.xml"); } @@ -180,13 +179,16 @@ void LyricsWindow::showText(QNetworkReply *reply) void LyricsWindow::on_searchPushButton_clicked() { m_ui.stateLabel->setText(tr("Receiving")); - setWindowTitle(QString(tr("Lyrics: %1 - %2")).arg(m_ui.artistLineEdit->text()) + qDebug() << m_parser.providers().count(); + + + /*setWindowTitle(QString(tr("Lyrics: %1 - %2")).arg(m_ui.artistLineEdit->text()) .arg(m_ui.titleLineEdit->text())); QNetworkRequest request; request.setUrl(QUrl("https://lyrics.fandom.com/api.php?action=lyrics&artist=" + m_ui.artistLineEdit->text()+"&song=" + m_ui.titleLineEdit->text() + "&fmt=xml")); request.setRawHeader("User-Agent", QString("qmmp/%1").arg(Qmmp::strVersion()).toLatin1()); - m_requestReply = m_http->get(request); + m_requestReply = m_http->get(request);*/ } QString LyricsWindow::cacheFilePath() const diff --git a/src/plugins/General/lyrics/lyricswindow.h b/src/plugins/General/lyrics/lyricswindow.h index f8a4e8ca8..2843cc959 100644 --- a/src/plugins/General/lyrics/lyricswindow.h +++ b/src/plugins/General/lyrics/lyricswindow.h @@ -21,7 +21,7 @@ #define LYRICSWINDOW_H #include - +#include "ultimatelyricsparser.h" #include "ui_lyricswindow.h" class QNetworkAccessManager; @@ -51,6 +51,7 @@ private: QNetworkReply *m_requestReply; QString m_artist, m_title; QString m_cachePath; + UltimateLyricsParser m_parser; }; #endif diff --git a/src/plugins/General/lyrics/providers/providers.qrc b/src/plugins/General/lyrics/providers/providers.qrc new file mode 100644 index 000000000..102d6b40e --- /dev/null +++ b/src/plugins/General/lyrics/providers/providers.qrc @@ -0,0 +1,6 @@ + + + + ultimate_providers.xml + + diff --git a/src/plugins/General/lyrics/providers/ultimate_providers.xml b/src/plugins/General/lyrics/providers/ultimate_providers.xml new file mode 100644 index 000000000..98a043695 --- /dev/null +++ b/src/plugins/General/lyrics/providers/ultimate_providers.xml @@ -0,0 +1,313 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3-13-gbd6f