LeechCraft 0.6.70-16373-g319c272718
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
ihypesprovider.h
Go to the documentation of this file.
1/**********************************************************************
2 * LeechCraft - modular cross-platform feature rich internet client.
3 * Copyright (C) 2006-2014 Georg Rudoy
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7 **********************************************************************/
8
9#pragma once
10
11#include <variant>
12#include <QString>
13#include <QList>
14#include <QUrl>
15#include <util/sll/eitherfwd.h>
16#include "audiostructs.h"
17
18template<typename>
19class QFuture;
20
21namespace Media
22{
66
75 {
78 QString TrackName_;
79
87
96
105
114
118
121 QUrl Image_;
122
126
129 QString ArtistName_;
130
138 };
139
140 using HypedInfo_t = std::variant<QList<HypedArtistInfo>, QList<HypedTrackInfo>>;
141
147 class Q_DECL_EXPORT IHypesProvider
148 {
149 public:
150 virtual ~IHypesProvider () {}
151
158
166 virtual QString GetServiceName () const = 0;
167
170 enum class HypeType
171 {
174 NewArtists,
175
178 NewTracks,
179
182 TopArtists,
183
186 TopTracks
187 };
188
194 virtual bool SupportsHype (HypeType hype) = 0;
195
202 };
203
204 template<IHypesProvider::HypeType HypeType>
205 auto GetHypedInfo (const HypedInfo_t& info)
206 {
207 if constexpr (HypeType == IHypesProvider::HypeType::NewArtists ||
209 return std::get<QList<HypedArtistInfo>> (info);
210 else
211 return std::get<QList<HypedTrackInfo>> (info);
212 }
213}
214
215Q_DECLARE_INTERFACE (Media::IHypesProvider, "org.LeechCraft.Media.IHypesProvider/1.0")
Interface for plugins that support fetching hypes.
virtual QFuture< HypeQueryResult_t > RequestHype(HypeType type)=0
Updates the list of hyped artists of the given type.
virtual QString GetServiceName() const =0
Returns the service name.
virtual bool SupportsHype(HypeType hype)=0
Returns whether the service supports the given hype type.
HypeType
The type of the hype.
@ NewArtists
New artists rapidly growing in popularity.
auto GetHypedInfo(const HypedInfo_t &info)
std::variant< QList< HypedArtistInfo >, QList< HypedTrackInfo > > HypedInfo_t
A structure describing an artist.
Contains information about a hyped artist.
ArtistInfo Info_
Basic information about the artist.
int Listeners_
Number of listeners.
int PercentageChange_
Change of popularity in percents.
int Playcount_
Play count.
Contains information about a hyped track.
QUrl LargeImage_
Full size image of this track or performing artist.
QString TrackName_
Name of the track.
int Playcount_
Play count.
QString ArtistName_
Name of the performer of this track.
QUrl Image_
URL of thumb image of this track or performing artist.
int Listeners_
Number of listeners.
QUrl ArtistPage_
URL of the artist page.
QUrl TrackPage_
Address of the track page.
int PercentageChange_
Change of popularity in percents.
int Duration_
Duration of the track.