LeechCraft  0.6.70-15082-g543737046d
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")
Media::HypedTrackInfo::Listeners_
int Listeners_
Number of listeners.
Definition: ihypesprovider.h:113
Media::HypedTrackInfo::Duration_
int Duration_
Duration of the track.
Definition: ihypesprovider.h:117
Media::IHypesProvider::HypeType::NewArtists
@ NewArtists
New artists rapidly growing in popularity.
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::TrackName_
QString TrackName_
Name of the track.
Definition: ihypesprovider.h:78
QList
Definition: ianrulesstorage.h:14
Media::HypedTrackInfo::LargeImage_
QUrl LargeImage_
Full size image of this track or performing artist.
Definition: ihypesprovider.h:125
Media::HypedTrackInfo::TrackPage_
QUrl TrackPage_
Address of the track page.
Definition: ihypesprovider.h:86
Media::IHypesProvider::~IHypesProvider
virtual ~IHypesProvider()
Definition: ihypesprovider.h:150
Media::ArtistInfo
A structure describing an artist.
Definition: audiostructs.h:86
Media::HypedInfo_t
std::variant< QList< HypedArtistInfo >, QList< HypedTrackInfo > > HypedInfo_t
Definition: ihypesprovider.h:140
LC::Util::Either
Definition: either.h:33
Media::HypedTrackInfo::ArtistPage_
QUrl ArtistPage_
URL of the artist page.
Definition: ihypesprovider.h:137
Media::HypedTrackInfo::Image_
QUrl Image_
URL of thumb image of this track or performing artist.
Definition: ihypesprovider.h:121
Media::HypedArtistInfo::Info_
ArtistInfo Info_
Basic information about the artist.
Definition: ihypesprovider.h:37
Media::HypedTrackInfo
Contains information about a hyped track.
Definition: ihypesprovider.h:74
Media
Definition: audiostructs.h:16
Media::GetHypedInfo
auto GetHypedInfo(const HypedInfo_t &info)
Definition: ihypesprovider.h:205
Media::IHypesProvider
Interface for plugins that support fetching hypes.
Definition: ihypesprovider.h:147
audiostructs.h
Media::HypedTrackInfo::ArtistName_
QString ArtistName_
Name of the performer of this track.
Definition: ihypesprovider.h:129
Media::HypedTrackInfo::Playcount_
int Playcount_
Play count.
Definition: ihypesprovider.h:104
QFuture
Definition: idownload.h:17
Media::HypedTrackInfo::PercentageChange_
int PercentageChange_
Change of popularity in percents.
Definition: ihypesprovider.h:95
Media::HypedArtistInfo::Listeners_
int Listeners_
Number of listeners.
Definition: ihypesprovider.h:64
Media::IHypesProvider::HypeType::TopArtists
@ TopArtists
Top artists.
Media::IHypesProvider::HypeType
HypeType
The type of the hype.
Definition: ihypesprovider.h:170
Media::HypedArtistInfo
Contains information about a hyped artist.
Definition: ihypesprovider.h:30
eitherfwd.h