LeechCraft
0.6.70-17335-ge406ffdcaf
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
18
template
<
typename
>
19
class
QFuture
;
20
21
namespace
Media
22
{
30
struct
HypedArtistInfo
31
{
37
ArtistInfo
Info_
;
38
46
int
PercentageChange_
;
47
55
int
Playcount_
;
56
64
int
Listeners_
;
65
};
66
74
struct
HypedTrackInfo
75
{
78
QString
TrackName_
;
79
86
QUrl
TrackPage_
;
87
95
int
PercentageChange_
;
96
104
int
Playcount_
;
105
113
int
Listeners_
;
114
117
int
Duration_
;
118
121
QUrl
Image_
;
122
125
QUrl
LargeImage_
;
126
129
QString
ArtistName_
;
130
137
QUrl
ArtistPage_
;
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
157
using
HypeQueryResult_t
=
LC::Util::Either<QString, HypedInfo_t>
;
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
201
virtual
QFuture<HypeQueryResult_t>
RequestHype
(
HypeType
type) = 0;
202
};
203
204
template
<IHypesProv
id
er::HypeType HypeType>
205
auto
GetHypedInfo
(
const
HypedInfo_t
& info)
206
{
207
if
constexpr
(HypeType ==
IHypesProvider::HypeType::NewArtists
||
208
HypeType ==
IHypesProvider::HypeType::TopArtists
)
209
return
std::get<
QList<HypedArtistInfo>
> (info);
210
else
211
return
std::get<QList<HypedTrackInfo>> (info);
212
}
213
}
214
215
Q_DECLARE_INTERFACE (
Media::IHypesProvider
,
"org.LeechCraft.Media.IHypesProvider/1.0"
)
audiostructs.h
LC::Util::Either
Definition
either.h:22
Media::IHypesProvider
Interface for plugins that support fetching hypes.
Definition
ihypesprovider.h:148
Media::IHypesProvider::RequestHype
virtual QFuture< HypeQueryResult_t > RequestHype(HypeType type)=0
Updates the list of hyped artists of the given type.
Media::IHypesProvider::GetServiceName
virtual QString GetServiceName() const =0
Returns the service name.
Media::IHypesProvider::~IHypesProvider
virtual ~IHypesProvider()
Definition
ihypesprovider.h:150
Media::IHypesProvider::HypeQueryResult_t
LC::Util::Either< QString, HypedInfo_t > HypeQueryResult_t
The result of a hyped entity list query.
Definition
ihypesprovider.h:157
Media::IHypesProvider::SupportsHype
virtual bool SupportsHype(HypeType hype)=0
Returns whether the service supports the given hype type.
Media::IHypesProvider::HypeType
HypeType
The type of the hype.
Definition
ihypesprovider.h:171
Media::IHypesProvider::HypeType::NewArtists
@ NewArtists
New artists rapidly growing in popularity.
Definition
ihypesprovider.h:174
Media::IHypesProvider::HypeType::NewTracks
@ NewTracks
New tracks rapidly growing in popularity.
Definition
ihypesprovider.h:178
Media::IHypesProvider::HypeType::TopArtists
@ TopArtists
Top artists.
Definition
ihypesprovider.h:182
Media::IHypesProvider::HypeType::TopTracks
@ TopTracks
Top tracks.
Definition
ihypesprovider.h:186
QFuture
Definition
idownload.h:17
QList
Definition
ianrulesstorage.h:14
eitherfwd.h
Media
Definition
audiostructs.h:17
Media::GetHypedInfo
auto GetHypedInfo(const HypedInfo_t &info)
Definition
ihypesprovider.h:205
Media::HypedInfo_t
std::variant< QList< HypedArtistInfo >, QList< HypedTrackInfo > > HypedInfo_t
Definition
ihypesprovider.h:140
Media::ArtistInfo
A structure describing an artist.
Definition
audiostructs.h:81
Media::HypedArtistInfo
Contains information about a hyped artist.
Definition
ihypesprovider.h:31
Media::HypedArtistInfo::Info_
ArtistInfo Info_
Basic information about the artist.
Definition
ihypesprovider.h:37
Media::HypedArtistInfo::Listeners_
int Listeners_
Number of listeners.
Definition
ihypesprovider.h:64
Media::HypedArtistInfo::PercentageChange_
int PercentageChange_
Change of popularity in percents.
Definition
ihypesprovider.h:46
Media::HypedArtistInfo::Playcount_
int Playcount_
Play count.
Definition
ihypesprovider.h:55
Media::HypedTrackInfo
Contains information about a hyped track.
Definition
ihypesprovider.h:75
Media::HypedTrackInfo::LargeImage_
QUrl LargeImage_
Full size image of this track or performing artist.
Definition
ihypesprovider.h:125
Media::HypedTrackInfo::TrackName_
QString TrackName_
Name of the track.
Definition
ihypesprovider.h:78
Media::HypedTrackInfo::Playcount_
int Playcount_
Play count.
Definition
ihypesprovider.h:104
Media::HypedTrackInfo::ArtistName_
QString ArtistName_
Name of the performer of this track.
Definition
ihypesprovider.h:129
Media::HypedTrackInfo::Image_
QUrl Image_
URL of thumb image of this track or performing artist.
Definition
ihypesprovider.h:121
Media::HypedTrackInfo::Listeners_
int Listeners_
Number of listeners.
Definition
ihypesprovider.h:113
Media::HypedTrackInfo::ArtistPage_
QUrl ArtistPage_
URL of the artist page.
Definition
ihypesprovider.h:137
Media::HypedTrackInfo::TrackPage_
QUrl TrackPage_
Address of the track page.
Definition
ihypesprovider.h:86
Media::HypedTrackInfo::PercentageChange_
int PercentageChange_
Change of popularity in percents.
Definition
ihypesprovider.h:95
Media::HypedTrackInfo::Duration_
int Duration_
Duration of the track.
Definition
ihypesprovider.h:117
src
interfaces
media
ihypesprovider.h
Generated by
1.13.2