diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2019-07-02 21:12:41 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2019-07-02 21:12:41 +0000 |
| commit | c75694c1cd54c2dda0e4a3a522baf1fcbcdcd7b1 (patch) | |
| tree | f518aa7d889c8ba190a8dd074d92777b8173ca38 /src/plugins | |
| parent | ae9b41a535a0d86968d8ec68ba1be4bf203a2176 (diff) | |
| download | qmmp-c75694c1cd54c2dda0e4a3a522baf1fcbcdcd7b1.tar.gz qmmp-c75694c1cd54c2dda0e4a3a522baf1fcbcdcd7b1.tar.bz2 qmmp-c75694c1cd54c2dda0e4a3a522baf1fcbcdcd7b1.zip | |
listenbrainz plugin implementation
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@8981 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins')
| -rw-r--r-- | src/plugins/General/listenbrainz/listenbrainz.cpp | 313 | ||||
| -rw-r--r-- | src/plugins/General/listenbrainz/listenbrainz.h | 69 | ||||
| -rw-r--r-- | src/plugins/General/listenbrainz/listenbrainzfactory.cpp | 5 | ||||
| -rw-r--r-- | src/plugins/General/listenbrainz/payloadcache.cpp | 145 | ||||
| -rw-r--r-- | src/plugins/General/listenbrainz/payloadcache.h | 67 | ||||
| -rw-r--r-- | src/plugins/General/scrobbler/scrobbler.cpp | 2 | ||||
| -rw-r--r-- | src/plugins/General/scrobbler/scrobbler.h | 2 | ||||
| -rw-r--r-- | src/plugins/General/scrobbler/scrobblercache.cpp | 6 | ||||
| -rw-r--r-- | src/plugins/General/scrobbler/scrobblercache.h | 4 |
9 files changed, 603 insertions, 10 deletions
diff --git a/src/plugins/General/listenbrainz/listenbrainz.cpp b/src/plugins/General/listenbrainz/listenbrainz.cpp new file mode 100644 index 000000000..f6a73be1a --- /dev/null +++ b/src/plugins/General/listenbrainz/listenbrainz.cpp @@ -0,0 +1,313 @@ +/*************************************************************************** + * Copyright (C) 2019 by Ilya Kotov * + * forkotov02@ya.ru * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#include <QNetworkAccessManager> +#include <QNetworkRequest> +#include <QNetworkProxy> +#include <QNetworkReply> +#include <QByteArray> +#include <QCryptographicHash> +#include <QXmlStreamReader> +#include <QUrl> +#include <QUrlQuery> +#include <QJsonDocument> +#include <QJsonArray> +#include <QJsonObject> +#include <QElapsedTimer> +#include <QTimer> +#include <QDateTime> +#include <QDir> +#include <QDesktopServices> +#include <QSettings> +#include <qmmp/soundcore.h> +#include <qmmp/qmmpsettings.h> +#include <qmmp/qmmp.h> +#include "listenbrainz.h" + +#define API_ROOT "https://api.listenbrainz.org" + +ListenBrainz::ListenBrainz(QObject *parent) + : QObject(parent) +{ + m_time = new QElapsedTimer(); + m_cache = new PayloadCache(Qmmp::configDir() +"/listenbrainz_.cache"); + m_ua = QString("qmmp-plugins/%1").arg(Qmmp::strVersion().toLower()).toLatin1(); + m_http = new QNetworkAccessManager(this); + m_core = SoundCore::instance(); + QSettings settings(Qmmp::configFile(), QSettings::IniFormat); + m_token = settings.value("ListenBrainz/user_token").toString().trimmed(); + + connect(m_http, SIGNAL(finished (QNetworkReply *)), SLOT(processResponse(QNetworkReply *))); + connect(QmmpSettings::instance(), SIGNAL(networkSettingsChanged()), SLOT(setupProxy())); + connect(m_core, SIGNAL(trackInfoChanged()), SLOT(updateMetaData())); + connect(m_core, SIGNAL(stateChanged (Qmmp::State)), SLOT(setState(Qmmp::State))); + + setupProxy(); + m_cachedSongs = m_cache->load(); + + if(!m_token.isEmpty()) + { + submit(); + if(m_core->state() == Qmmp::Playing) + { + setState(Qmmp::Playing); + updateMetaData(); + } + } +} + +ListenBrainz::~ListenBrainz() +{ + m_cache->save(m_cachedSongs); + delete m_time; + delete m_cache; + +} + +void ListenBrainz::setState(Qmmp::State state) +{ + if(state == Qmmp::Playing && m_previousState == Qmmp::Paused) + { + qDebug("ListenBrainz: resuming from %d seconds played", int(m_elapsed / 1000)); + m_time->restart(); + } + else if(state == Qmmp::Paused) + { + m_elapsed += m_time->elapsed(); + qDebug("ListenBrainz: pausing after %d seconds played", int(m_elapsed / 1000)); + } + else if(state == Qmmp::Stopped && !m_song.metaData().isEmpty()) + { + if(m_previousState == Qmmp::Playing) + m_elapsed += m_time->elapsed(); + + if((m_elapsed > 240000) || (m_elapsed > MIN_SONG_LENGTH && m_song.duration() == 0) || + (m_elapsed > int(m_song.duration() / 2) && m_song.duration() > MIN_SONG_LENGTH)) + { + m_cachedSongs << m_song; + m_cache->save(m_cachedSongs); + } + + submit(); + m_song.clear(); + m_elapsed = 0; + } + m_previousState = state; +} + +void ListenBrainz::updateMetaData() +{ + TrackInfo info = m_core->trackInfo(); + if(m_core->state() != Qmmp::Playing) + return; + + if(!m_song.metaData().isEmpty() && m_song.metaData() != info.metaData()) + { + int elapsed = (m_elapsed + m_time->elapsed()); + if((elapsed > 240000) || (elapsed > MIN_SONG_LENGTH && m_song.duration() == 0) || + (elapsed > int(m_song.duration() / 2) && m_song.duration() > MIN_SONG_LENGTH)) + { + m_cachedSongs << m_song; + m_cache->save(m_cachedSongs); + } + + submit(); + m_song.clear(); + } + + if(!info.value(Qmmp::TITLE).isEmpty() && !info.value(Qmmp::ARTIST).isEmpty()) + { + m_song = TrackMetaData(info); + m_song.setTimeStamp(QDateTime::currentDateTime().toTime_t()); + sendNotification(m_song); + } + m_time->restart(); + m_elapsed = 0; +} + +void ListenBrainz::processResponse(QNetworkReply *reply) +{ + if (reply->error() != QNetworkReply::NoError) + { + qWarning("ListenBrainz: http error: %s", qPrintable(reply->errorString())); + } + + QByteArray data = reply->readAll(); + QJsonDocument document = QJsonDocument::fromJson(data); + QString status = document.object().value("status").toString(); + if(status != "ok" || reply->error() != QNetworkReply::NoError) + { + status.clear(); + qWarning("ListenBrainz: server reply: %s", data.constData()); + } + + if(reply == m_submitReply) + { + m_submitReply = nullptr; + if(status == "ok") + { + qDebug("ListenBrainz: submited %d song(s)", m_submitedSongs); + while (m_submitedSongs) + { + m_submitedSongs--; + m_cachedSongs.removeFirst (); + } + if (!m_cachedSongs.isEmpty()) //submit remaining songs + { + submit(); + } + else + { + m_cache->save(m_cachedSongs); // update the cache file to reflect the empty cache + updateMetaData(); + } + } + else + { + QTimer::singleShot(120000, this, SLOT(submit())); + } + } + else if(reply == m_notificationReply) + { + m_notificationReply = nullptr; + if(status == "ok") + qDebug("ListenBrainz: Now-Playing notification done"); + } + reply->deleteLater(); +} + +void ListenBrainz::setupProxy() +{ + QmmpSettings *gs = QmmpSettings::instance(); + if (gs->isProxyEnabled()) + { + QNetworkProxy proxy(QNetworkProxy::HttpProxy, gs->proxy().host(), gs->proxy().port()); + if(gs->proxyType() == QmmpSettings::SOCKS5_PROXY) + proxy.setType(QNetworkProxy::Socks5Proxy); + if(gs->useProxyAuth()) + { + proxy.setUser(gs->proxy().userName()); + proxy.setPassword(gs->proxy().password()); + } + m_http->setProxy(proxy); + } + else + m_http->setProxy(QNetworkProxy::NoProxy); +} + +void ListenBrainz::submit() +{ + if (m_cachedSongs.isEmpty() || m_token.isEmpty() || m_submitReply) + return; + + qDebug("ListenBrainz: submit request"); + m_submitedSongs = qMin(m_cachedSongs.size(), 20); + + QJsonArray payload; + for (int i = 0; i < m_submitedSongs; ++i) + { + TrackMetaData metaData = m_cachedSongs[i]; + + QJsonObject track_metadata + { + { "artist_name", metaData.value(Qmmp::ARTIST) }, + { "track_name", metaData.value(Qmmp::TITLE) } + }; + + if(metaData.value(Qmmp::TRACK).toInt() > 0) + { + QJsonObject additional_info + { + { "tracknumber", metaData.value(Qmmp::TRACK).toInt() } + }; + + track_metadata["additional_info"] = additional_info; + }; + + QJsonObject payloadItem + { + { "listened_at", qint64(metaData.timeStamp()) }, + { "track_metadata", track_metadata } + }; + + payload.append(payloadItem); + } + + QJsonObject json { { "listen_type", "import" }, { "payload", payload } }; + + QJsonDocument document(json); + QByteArray body = document.toJson(QJsonDocument::Compact); + + QUrl url(QString("%1/1/submit-listens").arg(API_ROOT)); + url.setPort(443); + + QNetworkRequest request(url); + request.setRawHeader("User-Agent", m_ua); + request.setRawHeader("Host", url.host().toLatin1()); + request.setRawHeader("Accept", "*/*"); + request.setRawHeader("Content-Type", "application/json"); + request.setRawHeader("Authorization", QString("Token %1").arg(m_token).toLatin1()); + request.setHeader(QNetworkRequest::ContentLengthHeader, body.size()); + m_submitReply = m_http->post(request, body); +} + +void ListenBrainz::sendNotification(const TrackMetaData &metaData) +{ + if(m_token.isEmpty() || m_notificationReply) + return; + + qDebug("ListenBrainz: sending notification..."); + + QJsonObject track_metadata + { + { "artist_name", metaData.value(Qmmp::ARTIST) }, + { "track_name", metaData.value(Qmmp::TITLE) } + }; + + if(metaData.value(Qmmp::TRACK).toInt() > 0) + { + QJsonObject additional_info + { + { "tracknumber", metaData.value(Qmmp::TRACK).toInt() } + }; + + track_metadata["additional_info"] = additional_info; + }; + + QJsonObject payloadItem { { "track_metadata", track_metadata } }; + + QJsonArray payload = { payloadItem }; + QJsonObject json { { "listen_type", "playing_now" }, { "payload", payload } }; + + QJsonDocument document(json); + QByteArray body = document.toJson(QJsonDocument::Compact); + + QUrl url(QString("%1/1/submit-listens").arg(API_ROOT)); + url.setPort(443); + + QNetworkRequest request(url); + request.setRawHeader("User-Agent", m_ua); + request.setRawHeader("Host", url.host().toLatin1()); + request.setRawHeader("Accept", "*/*"); + request.setRawHeader("Content-Type", "application/json"); + request.setRawHeader("Authorization", QString("Token %1").arg(m_token).toLatin1()); + request.setHeader(QNetworkRequest::ContentLengthHeader, body.size()); + m_notificationReply = m_http->post(request, body); +} diff --git a/src/plugins/General/listenbrainz/listenbrainz.h b/src/plugins/General/listenbrainz/listenbrainz.h new file mode 100644 index 000000000..3b0baeb95 --- /dev/null +++ b/src/plugins/General/listenbrainz/listenbrainz.h @@ -0,0 +1,69 @@ +/*************************************************************************** + * Copyright (C) 2019 by Ilya Kotov * + * forkotov02@ya.ru * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ +#ifndef LISTENBRAINZ_H +#define LISTENBRAINZ_H + +#include <QMap> +#include <QObject> +#include <qmmp/qmmp.h> +#include "payloadcache.h" + +class QNetworkAccessManager; +class QNetworkReply; +class QIODevice; +class QElapsedTimer; +class SoundCore; + +/** + @author Ilya Kotov <forkotov02@ya.ru> +*/ +class ListenBrainz : public QObject +{ + Q_OBJECT +public: + ListenBrainz(QObject *parent = nullptr); + ~ListenBrainz(); + +private slots: + void setState(Qmmp::State state); + void updateMetaData(); + void processResponse(QNetworkReply *reply); + void setupProxy(); + void submit(); + +private: + enum { MIN_SONG_LENGTH = 30000 }; + + void sendNotification(const TrackMetaData &metaData); + TrackMetaData m_song; + QList<TrackMetaData> m_cachedSongs; + QByteArray m_ua; + int m_submitedSongs = 0; + QString m_token; + QNetworkAccessManager *m_http; + SoundCore *m_core; + QNetworkReply *m_submitReply = nullptr, *m_notificationReply = nullptr; + QElapsedTimer *m_time; + PayloadCache *m_cache; + Qmmp::State m_previousState = Qmmp::Stopped; + qint64 m_elapsed = 0; +}; + +#endif //LISTENBRAINZ_H diff --git a/src/plugins/General/listenbrainz/listenbrainzfactory.cpp b/src/plugins/General/listenbrainz/listenbrainzfactory.cpp index 70d4884e6..569355fb5 100644 --- a/src/plugins/General/listenbrainz/listenbrainzfactory.cpp +++ b/src/plugins/General/listenbrainz/listenbrainzfactory.cpp @@ -20,7 +20,7 @@ #include <QMessageBox> #include <qmmp/qmmp.h> -//#include "scrobblerhandler.h" +#include "listenbrainz.h" #include "settingsdialog.h" #include "listenbrainzfactory.h" @@ -37,8 +37,7 @@ GeneralProperties ListenBrainzFactory::properties() const QObject *ListenBrainzFactory::create(QObject *parent) { - //return new ScrobblerHandler(parent); - return nullptr; + return new ListenBrainz(parent); } QDialog *ListenBrainzFactory::createConfigDialog(QWidget *parent) diff --git a/src/plugins/General/listenbrainz/payloadcache.cpp b/src/plugins/General/listenbrainz/payloadcache.cpp new file mode 100644 index 000000000..f9e305c66 --- /dev/null +++ b/src/plugins/General/listenbrainz/payloadcache.cpp @@ -0,0 +1,145 @@ +/*************************************************************************** + * Copyright (C) 2019 by Ilya Kotov * + * forkotov02@ya.ru * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#include <QFile> +#include "payloadcache.h" + +TrackMetaData::TrackMetaData() +{} + +TrackMetaData::TrackMetaData(const TrackInfo &info) : TrackInfo(info) +{} + +TrackMetaData::TrackMetaData(const TrackMetaData &other) : TrackInfo(other), + m_start_ts(other.timeStamp()) +{} + +TrackMetaData::~TrackMetaData() +{} + +TrackMetaData & TrackMetaData::operator=(const TrackMetaData &info) +{ + TrackInfo::operator=(info); + m_start_ts = info.timeStamp(); + return *this; +} + +bool TrackMetaData::operator==(const TrackMetaData &info) +{ + return (TrackInfo::operator==(info)) && (m_start_ts == info.timeStamp()); +} + +bool TrackMetaData::operator!=(const TrackMetaData &info) +{ + return !operator==(info); +} + +void TrackMetaData::setTimeStamp(uint ts) +{ + m_start_ts = ts; +} + +uint TrackMetaData::timeStamp() const +{ + return m_start_ts; +} + +PayloadCache::PayloadCache(const QString &filePath) +{ + m_filePath = filePath; +} + +QList<TrackMetaData> PayloadCache::load() +{ + QList<TrackMetaData> songs; + int s = 0; + QString line, param, value; + QFile file(m_filePath); + + if(!file.open(QIODevice::ReadOnly)) + return QList<TrackMetaData>(); + + while (!file.atEnd()) + { + line = QString::fromUtf8(file.readLine()).trimmed(); + if ((s = line.indexOf("=")) < 0) + continue; + + param = line.left(s); + value = line.right(line.size() - s - 1); + + if (param == "title") + { + songs << TrackMetaData(); + songs.last().setValue(Qmmp::TITLE, value); + } + else if (songs.isEmpty()) + continue; + else if (param == "artist") + songs.last().setValue(Qmmp::ARTIST, value); + else if (param == "album") + songs.last().setValue(Qmmp::ALBUM, value); + else if (param == "comment") + songs.last().setValue(Qmmp::COMMENT, value); + else if (param == "genre") + songs.last().setValue(Qmmp::GENRE, value); + else if (param == "year") + songs.last().setValue(Qmmp::YEAR, value); + else if (param == "track") + songs.last().setValue(Qmmp::TRACK, value); + else if (param == "length") //1.3.x config support + songs.last().setDuration(value.toInt() * 1000); + else if (param == "duration") + songs.last().setDuration(value.toLongLong()); + else if (param == "time") + songs.last().setTimeStamp(value.toUInt()); + } + file.close(); + return songs; +} + +void PayloadCache::save(const QList<TrackMetaData> &songs) +{ + QFile file(m_filePath); + if (songs.isEmpty()) + { + file.remove(); + return; + } + if(!file.open(QIODevice::WriteOnly)) + { + qWarning("PayloadCache: unable to save file %s", qPrintable(m_filePath)); + qWarning("PayloadCache: error %d: %s", file.error(), qPrintable(file.errorString())); + return; + } + foreach(TrackMetaData m, songs) + { + file.write(QString("title=%1").arg(m.value(Qmmp::TITLE)).toUtf8() +"\n"); + file.write(QString("artist=%1").arg(m.value(Qmmp::ARTIST)).toUtf8() +"\n"); + file.write(QString("album=%1").arg(m.value(Qmmp::ALBUM)).toUtf8() +"\n"); + file.write(QString("comment=%1").arg(m.value(Qmmp::COMMENT)).toUtf8() +"\n"); + file.write(QString("genre=%1").arg(m.value(Qmmp::GENRE)).toUtf8() +"\n"); + file.write(QString("year=%1").arg(m.value(Qmmp::YEAR)).toUtf8() +"\n"); + file.write(QString("track=%1").arg(m.value(Qmmp::TRACK)).toUtf8() +"\n"); + file.write(QString("duration=%1").arg(m.duration()).toLatin1() +"\n"); + file.write(QString("time=%1").arg(m.timeStamp()).toLatin1() +"\n"); + } + file.close(); +} diff --git a/src/plugins/General/listenbrainz/payloadcache.h b/src/plugins/General/listenbrainz/payloadcache.h new file mode 100644 index 000000000..fe5ba8e83 --- /dev/null +++ b/src/plugins/General/listenbrainz/payloadcache.h @@ -0,0 +1,67 @@ +/*************************************************************************** + * Copyright (C) 2019 by Ilya Kotov * + * forkotov02@ya.ru * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#ifndef PAYLOADCACHE_H +#define PAYLOADCACHE_H + +#include <QMap> +#include <QList> +#include <qmmp/qmmp.h> +#include <qmmp/trackinfo.h> + +/** + @author Ilya Kotov <forkotov02@ya.ru> +*/ +class TrackMetaData : public TrackInfo +{ +public: + TrackMetaData(); + TrackMetaData(const TrackInfo &info); + TrackMetaData(const TrackMetaData &other); + + ~TrackMetaData(); + + TrackMetaData & operator=(const TrackMetaData &info); + bool operator==(const TrackMetaData &info); + bool operator!=(const TrackMetaData &info); + void setTimeStamp(uint ts); + uint timeStamp() const; + +private: + uint m_start_ts = 0; +}; + +/** + @author Ilya Kotov <forkotov02@ya.ru> +*/ +class PayloadCache +{ +public: + explicit PayloadCache(const QString &filePath); + + QList<TrackMetaData> load(); + void save(const QList<TrackMetaData> &songs); + +private: + QString m_filePath; + +}; + +#endif // PAYLOADCACHE_H diff --git a/src/plugins/General/scrobbler/scrobbler.cpp b/src/plugins/General/scrobbler/scrobbler.cpp index f8f367e45..d9532f987 100644 --- a/src/plugins/General/scrobbler/scrobbler.cpp +++ b/src/plugins/General/scrobbler/scrobbler.cpp @@ -85,7 +85,7 @@ Scrobbler::Scrobbler(const QString &scrobblerUrl, const QString &name, QObject * m_scrobblerUrl = scrobblerUrl; m_name = name; m_time = new QElapsedTimer(); - m_cache = new ScrobblerCache(Qmmp::configDir() +"/scrobbler_"+name+".cache"); + m_cache = new ListenCache(Qmmp::configDir() +"/scrobbler_"+name+".cache"); m_ua = QString("qmmp-plugins/%1").arg(Qmmp::strVersion().toLower()).toLatin1(); m_http = new QNetworkAccessManager(this); m_core = SoundCore::instance(); diff --git a/src/plugins/General/scrobbler/scrobbler.h b/src/plugins/General/scrobbler/scrobbler.h index ad3e1d56e..b4f727424 100644 --- a/src/plugins/General/scrobbler/scrobbler.h +++ b/src/plugins/General/scrobbler/scrobbler.h @@ -79,7 +79,7 @@ private: SoundCore *m_core; QNetworkReply *m_submitReply = nullptr, *m_notificationReply = nullptr; QElapsedTimer *m_time; - ScrobblerCache *m_cache; + ListenCache *m_cache; QString m_scrobblerUrl, m_name; Qmmp::State m_previousState = Qmmp::Stopped; qint64 m_elapsed = 0; diff --git a/src/plugins/General/scrobbler/scrobblercache.cpp b/src/plugins/General/scrobbler/scrobblercache.cpp index 841c8c48f..05319e2a3 100644 --- a/src/plugins/General/scrobbler/scrobblercache.cpp +++ b/src/plugins/General/scrobbler/scrobblercache.cpp @@ -61,12 +61,12 @@ uint SongInfo::timeStamp() const return m_start_ts; } -ScrobblerCache::ScrobblerCache(const QString &filePath) +ListenCache::ListenCache(const QString &filePath) { m_filePath = filePath; } -QList<SongInfo> ScrobblerCache::load() +QList<SongInfo> ListenCache::load() { QList<SongInfo> songs; int s = 0; @@ -115,7 +115,7 @@ QList<SongInfo> ScrobblerCache::load() return songs; } -void ScrobblerCache::save(const QList<SongInfo> &songs) +void ListenCache::save(const QList<SongInfo> &songs) { QFile file(m_filePath); if (songs.isEmpty()) diff --git a/src/plugins/General/scrobbler/scrobblercache.h b/src/plugins/General/scrobbler/scrobblercache.h index 819d1fa96..1bfc3c502 100644 --- a/src/plugins/General/scrobbler/scrobblercache.h +++ b/src/plugins/General/scrobbler/scrobblercache.h @@ -51,10 +51,10 @@ private: /** @author Ilya Kotov <forkotov02@ya.ru> */ -class ScrobblerCache +class ListenCache { public: - explicit ScrobblerCache(const QString &filePath); + explicit ListenCache(const QString &filePath); QList<SongInfo> load(); void save(const QList<SongInfo> &songs); |
