mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-04-11 11:32:22 +02:00
Remove MusixMatchHash
This commit is contained in:
parent
dd61f4a3cc
commit
1dd0f26fff
@ -94,7 +94,6 @@ enum InfoType {
|
||||
typedef QMap< InfoType, QVariant > InfoMap;
|
||||
typedef QMap< QString, QMap< QString, QString > > InfoGenericMap;
|
||||
typedef QHash< QString, QVariant > InfoCustomDataHash;
|
||||
typedef QHash< QString, QString > MusixMatchHash;
|
||||
|
||||
class InfoPlugin : public QObject
|
||||
{
|
||||
@ -168,6 +167,5 @@ private:
|
||||
|
||||
Q_DECLARE_METATYPE( Tomahawk::InfoSystem::InfoGenericMap )
|
||||
Q_DECLARE_METATYPE( Tomahawk::InfoSystem::InfoCustomDataHash );
|
||||
Q_DECLARE_METATYPE( Tomahawk::InfoSystem::MusixMatchHash )
|
||||
|
||||
#endif // TOMAHAWK_INFOSYSTEM_H
|
||||
|
@ -45,11 +45,11 @@ MusixMatchPlugin::~MusixMatchPlugin()
|
||||
void MusixMatchPlugin::getInfo(const QString &caller, const InfoType type, const QVariant& data, Tomahawk::InfoSystem::InfoCustomDataHash customData)
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
if( !isValidTrackData(caller, data, customData) || !data.canConvert<Tomahawk::InfoSystem::MusixMatchHash>())
|
||||
if( !isValidTrackData(caller, data, customData) || !data.canConvert<Tomahawk::InfoSystem::InfoCustomDataHash>())
|
||||
return;
|
||||
Tomahawk::InfoSystem::MusixMatchHash hash = data.value<Tomahawk::InfoSystem::MusixMatchHash>();
|
||||
QString artist = hash["artistName"];
|
||||
QString track = hash["trackName"];
|
||||
Tomahawk::InfoSystem::InfoCustomDataHash hash = data.value<Tomahawk::InfoSystem::InfoCustomDataHash>();
|
||||
QString artist = hash["artistName"].toString();
|
||||
QString track = hash["trackName"].toString();
|
||||
if( artist.isEmpty() || track.isEmpty() )
|
||||
{
|
||||
emit info(caller, Tomahawk::InfoSystem::InfoTrackLyrics, data, QVariant(), customData);
|
||||
@ -73,22 +73,22 @@ void MusixMatchPlugin::getInfo(const QString &caller, const InfoType type, const
|
||||
bool MusixMatchPlugin::isValidTrackData(const QString &caller, const QVariant& data, Tomahawk::InfoSystem::InfoCustomDataHash &customData)
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
if (data.isNull() || !data.isValid() || !data.canConvert<Tomahawk::InfoSystem::MusixMatchHash>())
|
||||
if (data.isNull() || !data.isValid() || !data.canConvert<Tomahawk::InfoSystem::InfoCustomDataHash>())
|
||||
{
|
||||
emit info(caller, Tomahawk::InfoSystem::InfoTrackLyrics, data, QVariant(), customData);
|
||||
emit finished(caller, Tomahawk::InfoSystem::InfoTrackLyrics);
|
||||
qDebug() << "MusixMatchPlugin::isValidTrackData: Data null, invalid, or can't convert";
|
||||
return false;
|
||||
}
|
||||
MusixMatchHash hash = data.value<Tomahawk::InfoSystem::MusixMatchHash>();
|
||||
if (hash["trackName"].isEmpty() )
|
||||
InfoCustomDataHash hash = data.value<Tomahawk::InfoSystem::InfoCustomDataHash>();
|
||||
if (hash["trackName"].toString().isEmpty() )
|
||||
{
|
||||
emit info(caller, Tomahawk::InfoSystem::InfoTrackLyrics, data, QVariant(), customData);
|
||||
emit finished(caller, Tomahawk::InfoSystem::InfoTrackLyrics);
|
||||
qDebug() << "MusixMatchPlugin::isValidTrackData: Track name is empty";
|
||||
return false;
|
||||
}
|
||||
if (hash["artistName"].isEmpty() )
|
||||
if (hash["artistName"].toString().isEmpty() )
|
||||
{
|
||||
emit info(caller, Tomahawk::InfoSystem::InfoTrackLyrics, data, QVariant(), customData);
|
||||
emit finished(caller, Tomahawk::InfoSystem::InfoTrackLyrics);
|
||||
|
@ -47,7 +47,6 @@ InfoSystem::InfoSystem(QObject *parent)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
qRegisterMetaType<QMap< QString, QMap< QString, QString > > >("Tomahawk::InfoSystem::InfoGenericMap");
|
||||
qRegisterMetaType<QHash<QString, QVariant > >("Tomahawk::InfoSystem::InfoCustomDataHash");
|
||||
qRegisterMetaType<QHash<QString, QString > >("Tomahawk::InfoSystem::MusixMatchHash");
|
||||
|
||||
m_infoSystemCacheThreadController = new QThread( this );
|
||||
m_cache = new Tomahawk::InfoSystem::InfoSystemCache();
|
||||
|
@ -215,10 +215,10 @@ void XMPPBot::handleMessage(const Message& msg, MessageSession* session)
|
||||
infoMap[InfoArtistFamiliarity] = m_currTrack.data()->artist()->name();
|
||||
if (token == "lyrics")
|
||||
{
|
||||
MusixMatchHash myhash;
|
||||
myhash["trackName"] = m_currTrack.data()->track();
|
||||
myhash["artistName"] = m_currTrack.data()->artist()->name();
|
||||
infoMap[InfoTrackLyrics] = QVariant::fromValue<Tomahawk::InfoSystem::MusixMatchHash>(myhash);
|
||||
InfoCustomDataHash myhash;
|
||||
myhash["trackName"] = QVariant::fromValue<QString>(m_currTrack.data()->track());
|
||||
myhash["artistName"] = QVariant::fromValue<QString>(m_currTrack.data()->artist()->name());
|
||||
infoMap[InfoTrackLyrics] = QVariant::fromValue<Tomahawk::InfoSystem::InfoCustomDataHash>(myhash);
|
||||
}
|
||||
}
|
||||
|
||||
@ -364,15 +364,15 @@ void XMPPBot::infoReturnedSlot(QString caller, Tomahawk::InfoSystem::InfoType ty
|
||||
{
|
||||
qDebug() << "Lyrics requested";
|
||||
if (!output.canConvert<QString>() ||
|
||||
!input.canConvert<Tomahawk::InfoSystem::MusixMatchHash>()
|
||||
!input.canConvert<Tomahawk::InfoSystem::InfoCustomDataHash>()
|
||||
)
|
||||
{
|
||||
qDebug() << "Variants failed to be valid";
|
||||
break;
|
||||
}
|
||||
MusixMatchHash inHash = input.value<MusixMatchHash>();
|
||||
QString artist = inHash["artistName"];
|
||||
QString track = inHash["trackName"];
|
||||
InfoCustomDataHash inHash = input.value<InfoCustomDataHash>();
|
||||
QString artist = inHash["artistName"].toString();
|
||||
QString track = inHash["trackName"].toString();
|
||||
QString lyrics = output.toString();
|
||||
qDebug() << "lyrics = " << lyrics;
|
||||
m_currReturnMessage += QString("\nLyrics for \"%1\" by %2:\n\n%3\n").arg(track).arg(artist).arg(lyrics);
|
||||
|
Loading…
x
Reference in New Issue
Block a user