Scrobbler: Refactor and add MusicBrainz integration

This commit is contained in:
Jonas Kvinge
2023-03-25 14:25:21 +01:00
parent aedbd52e9d
commit fab38f693d
17 changed files with 423 additions and 308 deletions

View File

@@ -1,6 +1,6 @@
/*
* Strawberry Music Player
* Copyright 2018-2021, Jonas Kvinge <jonas@jkvinge.net>
* Copyright 2018-2023, Jonas Kvinge <jonas@jkvinge.net>
*
* Strawberry is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -25,33 +25,23 @@
#include <memory>
#include <QtGlobal>
#include <QObject>
#include <QString>
class ScrobblerCacheItem : public QObject {
Q_OBJECT
#include "scrobblemetadata.h"
class ScrobblerCacheItem {
public:
explicit ScrobblerCacheItem(const QString &artist, const QString &album, const QString &song, const QString &albumartist, const int track, const qint64 duration, const quint64 timestamp, QObject *parent = nullptr);
QString effective_albumartist() const { return albumartist_.isEmpty() ? artist_ : albumartist_; }
public:
QString artist_;
QString album_;
QString song_;
QString albumartist_;
int track_;
qint64 duration_;
quint64 timestamp_;
bool sent_;
explicit ScrobblerCacheItem(const ScrobbleMetadata &_metadata, const quint64 _timestamp);
ScrobbleMetadata metadata;
quint64 timestamp;
bool sent;
};
using ScrobblerCacheItemPtr = std::shared_ptr<ScrobblerCacheItem>;
using ScrobblerCacheItemList = QList<ScrobblerCacheItemPtr>;
using ScrobblerCacheItemPtrList = QList<ScrobblerCacheItemPtr>;
Q_DECLARE_METATYPE(ScrobblerCacheItemPtr)
Q_DECLARE_METATYPE(ScrobblerCacheItemList)
Q_DECLARE_METATYPE(ScrobblerCacheItemPtrList)
#endif // SCROBBLERCACHEITEM_H