LeechCraft  0.6.70-16373-g319c272718
Modular cross-platform feature rich live environment.
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 {
31  {
38 
47 
56 
65  };
66 
75  {
78  QString TrackName_;
79 
86  QUrl TrackPage_;
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 
201  virtual QFuture<HypeQueryResult_t> RequestHype (HypeType type) = 0;
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 
215 Q_DECLARE_INTERFACE (Media::IHypesProvider, "org.LeechCraft.Media.IHypesProvider/1.0")
auto GetHypedInfo(const HypedInfo_t &info)
int PercentageChange_
Change of popularity in percents.
HypeType
The type of the hype.
QString ArtistName_
Name of the performer of this track.
int Listeners_
Number of listeners.
int PercentageChange_
Change of popularity in percents.
QString TrackName_
Name of the track.
int Playcount_
Play count.
Interface for plugins that support fetching hypes.
ArtistInfo Info_
Basic information about the artist.
Contains information about a hyped artist.
New artists rapidly growing in popularity.
int Duration_
Duration of the track.
QUrl LargeImage_
Full size image of this track or performing artist.
std::variant< QList< HypedArtistInfo >, QList< HypedTrackInfo > > HypedInfo_t
QUrl ArtistPage_
URL of the artist page.
A structure describing an artist.
Definition: audiostructs.h:80
Contains information about a hyped track.
QUrl TrackPage_
Address of the track page.
int Listeners_
Number of listeners.
QUrl Image_
URL of thumb image of this track or performing artist.
int Playcount_
Play count.