Clementine Adore Mod
 All Classes Namespaces Files Functions Variables Macros Pages
Public Slots | Signals | Public Member Functions | Static Public Attributes | Private Slots | Private Member Functions | Private Attributes | List of all members
AdoreService Class Reference

The central class of the Adore mod, controlling all other AdoreXXX classes. More...

#include <adoreservice.h>

Inheritance diagram for AdoreService:

Public Slots

void NowPlaying (const Song &song)
 This is a remnant of the scrobbler type service, maybe deploy an own type in the future... More...
 
void Scrobble ()
 This is a remnant of the scrobbler type service, maybe deploy an own type in the future... More...
 
void Love ()
 This is a remnant of the scrobbler type service, maybe deploy an own type in the future... More...
 
void Ban ()
 This is a remnant of the scrobbler type service, maybe deploy an own type in the future... More...
 
void ShowConfig ()
 This is a remnant of the scrobbler type service, maybe deploy an own type in the future... More...
 
void ToggleScrobbling ()
 This is a remnant of the scrobbler type service, maybe deploy an own type in the future... More...
 

Signals

void AuthenticationComplete (bool success, const QString &error_message)
 remnant of the lastfm implementation. maybe use it in the future for better ui integration More...
 
void SavedItemsChanged ()
 

Public Member Functions

 AdoreService (Application *app, QObject *parent=nullptr)
 
 ~AdoreService ()
 
void ReloadSettings ()
 preserved for future use, does nothing i.t.m. More...
 
virtual QString Icon ()
 
bool IsAuthenticated () const
 
bool IsScrobblingEnabled () const
 
bool AreButtonsVisible () const
 
bool IsScrobbleButtonVisible () const
 
bool PreferAlbumArtist () const
 
bool HasConnectionProblems () const
 
void UpdateSubscriberStatus ()
 

Static Public Attributes

static const char * kServiceName = "Adore"
 as appears in the settings window More...
 
static const char * kSettingsGroup = "Adore"
 as appears in the settings navibar More...
 
static const char * kUrl = "https://restapitest.c3s.cc"
 URL of the REST API, can be overridden in ~/.config/Clementine/Clementine.conf section [Adore] key 'host'. More...
 
static const int kPort = 443
 port of the REST API, can be overridden in ~/.config/Clementine/Clementine.conf section [Adore] key 'host' More...
 
static const char * kUtilizeImp = "/api/v1/util_adore"
 path to the utilization api call of the REST API More...
 
static const char * kAuthorize = "/account/authorize_client"
 base path to the authorization web page More...
 
static const char * kRegister = "/api/v1/register"
 path to the player client registration api call of the REST API (meant to submit some extra information about the client at program start) More...
 
static const char * kPlayerName = "Clementine"
 self explanatory More...
 
static const char * kPluginVendor = "C3S"
 the creator of the Adore code More...
 
static const char * kPluginName = "Clementine Adore Mod"
 as Clementine doesn't have a real plugin system, just translate it as ModName or PatchName More...
 
static const char * kPluginVersion = "0.5"
 version of the the Adore code More...
 

Private Slots

void ProvideAuthenication (QNetworkReply *reply, QAuthenticator *auth)
 this slot is just provided for handling the http authorisation of the test site – disable in AdoreService::AdoreService(). More...
 
void UtilizeImpReplyFinished (QNetworkReply *reply)
 Handle the clean-up of the reply to the RegisterClient API call. More...
 
void RegisterClientReplyFinished (QNetworkReply *reply)
 Handle the clean-up of the reply to the RegisterClient API call. More...
 

Private Member Functions

lastfm::Track TrackFromSong (const Song &song) const
 Converts a Clementine song to a lastfm track. More...
 
void RegisterClient ()
 
void ProcessQueued ()
 

Private Attributes

QNetworkAccessManager * network_
 
lastfm::Audioscrobbler * scrobbler_
 zombie base object. remnant of the lastfm implementation. More...
 
lastfm::Track last_track_
 needed to keep track of the metadata. More...
 
lastfm::Track next_metadata_
 needed to keep track of the metadata. More...
 
bool scrobbling_enabled_
 remnant of the lastfm implementation. maybe use it in the future for better ui integration More...
 
bool buttons_visible_
 remnant of the lastfm implementation. maybe use it in the future for better ui integration More...
 
bool scrobble_button_visible_
 remnant of the lastfm implementation. maybe use it in the future for better ui integration More...
 
bool prefer_albumartist_
 remnant of the lastfm implementation. maybe use it in the future for better ui integration More...
 
bool connection_problems_
 Useful to inform the user that we can't scrobble right now. remnant of the lastfm implementation. maybe use it in the future for better ui integration. More...
 
Application * app_
 
AdoreDb adb
 SQLite db for batch processing. More...
 
AdoreStreamer astreamer
 GStreamer audio buffer grabber, converter to 11050 Hz mono, and fingerprinter. More...
 

Detailed Description

The central class of the Adore mod, controlling all other AdoreXXX classes.

Note: This class is derived from the Scrobbler service as it fulfills a similar purpose. Only a subset of the Scrobbler capabilities are used because, for example, no direct user interface elements in the Clementine main window have to be accessed. TODO: Maybe get rid of the Scrobbler heritage in the future.

Constructor & Destructor Documentation

AdoreService::AdoreService ( Application *  app,
QObject *  parent = nullptr 
)
explicit
AdoreService::~AdoreService ( )

Member Function Documentation

bool AdoreService::AreButtonsVisible ( ) const
inline
void AdoreService::AuthenticationComplete ( bool  success,
const QString &  error_message 
)
signal

remnant of the lastfm implementation. maybe use it in the future for better ui integration

void AdoreService::Ban ( )
slot

This is a remnant of the scrobbler type service, maybe deploy an own type in the future...

bool AdoreService::HasConnectionProblems ( ) const
inline
virtual QString AdoreService::Icon ( )
inlinevirtual
bool AdoreService::IsAuthenticated ( ) const

Returns the authentication status. TODO: not just look if the client uuid is set but evaluate the Register API call if the backend recognizes the uuid!

bool AdoreService::IsScrobbleButtonVisible ( ) const
inline
bool AdoreService::IsScrobblingEnabled ( ) const
inline
void AdoreService::Love ( )
slot

This is a remnant of the scrobbler type service, maybe deploy an own type in the future...

void AdoreService::NowPlaying ( const Song &  song)
slot

This is a remnant of the scrobbler type service, maybe deploy an own type in the future...

Analog to the scrobbler slot NowPlaying(). This member marks a new track needs to be fingerprinted and if there is an old track, transfers it to the REST API.

bool AdoreService::PreferAlbumArtist ( ) const
inline
void AdoreService::ProcessQueued ( )
private

This member looks in the queue db (AdoreDb) for played songs that couldn't be transferred to the backend server and processes them. Note: In the corresponding UtilizeImpReplyFinished() this member is called again till no more songs are in the queue (or an error occurs).

void AdoreService::ProvideAuthenication ( QNetworkReply *  reply,
QAuthenticator *  auth 
)
privateslot

this slot is just provided for handling the http authorisation of the test site – disable in AdoreService::AdoreService().

void AdoreService::RegisterClient ( )
private

Player client registration api call of the REST API (meant to submit some extra information about the client at program start)

void AdoreService::RegisterClientReplyFinished ( QNetworkReply *  reply)
privateslot

Handle the clean-up of the reply to the RegisterClient API call.

void AdoreService::ReloadSettings ( )

preserved for future use, does nothing i.t.m.

void AdoreService::SavedItemsChanged ( )
signal
void AdoreService::Scrobble ( )
slot

This is a remnant of the scrobbler type service, maybe deploy an own type in the future...

void AdoreService::ShowConfig ( )
slot

This is a remnant of the scrobbler type service, maybe deploy an own type in the future...

provided by Clementines service framework to display the settings dialog

void AdoreService::ToggleScrobbling ( )
slot

This is a remnant of the scrobbler type service, maybe deploy an own type in the future...

lastfm::Track AdoreService::TrackFromSong ( const Song &  song) const
private

Converts a Clementine song to a lastfm track.

See Also
Track class
void AdoreService::UpdateSubscriberStatus ( )
void AdoreService::UtilizeImpReplyFinished ( QNetworkReply *  reply)
privateslot

Handle the clean-up of the reply to the RegisterClient API call.

Member Data Documentation

AdoreDb AdoreService::adb
private

SQLite db for batch processing.

See Also
AdoreDb class
Application* AdoreService::app_
private
AdoreStreamer AdoreService::astreamer
private

GStreamer audio buffer grabber, converter to 11050 Hz mono, and fingerprinter.

See Also
AdoreStreamer class
bool AdoreService::buttons_visible_
private

remnant of the lastfm implementation. maybe use it in the future for better ui integration

bool AdoreService::connection_problems_
private

Useful to inform the user that we can't scrobble right now. remnant of the lastfm implementation. maybe use it in the future for better ui integration.

const char * AdoreService::kAuthorize = "/account/authorize_client"
static

base path to the authorization web page

const char * AdoreService::kPlayerName = "Clementine"
static

self explanatory

const char * AdoreService::kPluginName = "Clementine Adore Mod"
static

as Clementine doesn't have a real plugin system, just translate it as ModName or PatchName

const char * AdoreService::kPluginVendor = "C3S"
static

the creator of the Adore code

const char * AdoreService::kPluginVersion = "0.5"
static

version of the the Adore code

const int AdoreService::kPort = 443
static

port of the REST API, can be overridden in ~/.config/Clementine/Clementine.conf section [Adore] key 'host'

const char * AdoreService::kRegister = "/api/v1/register"
static

path to the player client registration api call of the REST API (meant to submit some extra information about the client at program start)

const char * AdoreService::kServiceName = "Adore"
static

as appears in the settings window

const char * AdoreService::kSettingsGroup = "Adore"
static

as appears in the settings navibar

const char * AdoreService::kUrl = "https://restapitest.c3s.cc"
static

URL of the REST API, can be overridden in ~/.config/Clementine/Clementine.conf section [Adore] key 'host'.

const char * AdoreService::kUtilizeImp = "/api/v1/util_adore"
static

path to the utilization api call of the REST API

lastfm::Track AdoreService::last_track_
private

needed to keep track of the metadata.

QNetworkAccessManager* AdoreService::network_
private
lastfm::Track AdoreService::next_metadata_
private

needed to keep track of the metadata.

bool AdoreService::prefer_albumartist_
private

remnant of the lastfm implementation. maybe use it in the future for better ui integration

bool AdoreService::scrobble_button_visible_
private

remnant of the lastfm implementation. maybe use it in the future for better ui integration

lastfm::Audioscrobbler* AdoreService::scrobbler_
private

zombie base object. remnant of the lastfm implementation.

bool AdoreService::scrobbling_enabled_
private

remnant of the lastfm implementation. maybe use it in the future for better ui integration


The documentation for this class was generated from the following files: