1
/* This file is part of Clementine.
2
Copyright 2010, David Sansome <me@davidsansome.com>
4
Clementine is free software: you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation, either version 3 of the License, or
7
(at your option) any later version.
9
Clementine is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public License
15
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
18
#ifndef SPOTIFYSERVER_H
19
#define SPOTIFYSERVER_H
21
#include "spotifyblob/common/spotifymessages.pb.h"
26
class SpotifyMessageHandler;
31
class SpotifyServer : public QObject {
35
SpotifyServer(QObject* parent = 0);
38
void Login(const QString& username, const QString& password,
39
spotify_pb::Bitrate bitrate, bool volume_normalisation);
45
void LoadUserPlaylist(int index);
46
void SyncUserPlaylist(int index);
47
void StartPlaybackLater(const QString& uri, quint16 port);
48
void Search(const QString& text, int limit, int limit_album = 0);
49
void LoadImage(const QString& id);
50
void AlbumBrowse(const QString& uri);
51
void SetPlaybackSettings(spotify_pb::Bitrate bitrate, bool volume_normalisation);
53
int server_port() const;
56
void StartPlayback(const QString& uri, quint16 port);
57
void Seek(qint64 offset_bytes);
60
void LoginCompleted(bool success, const QString& error,
61
spotify_pb::LoginResponse_Error error_code);
62
void PlaylistsUpdated(const spotify_pb::Playlists& playlists);
64
void StarredLoaded(const spotify_pb::LoadPlaylistResponse& response);
65
void InboxLoaded(const spotify_pb::LoadPlaylistResponse& response);
66
void UserPlaylistLoaded(const spotify_pb::LoadPlaylistResponse& response);
67
void PlaybackError(const QString& message);
68
void SearchResults(const spotify_pb::SearchResponse& response);
69
void ImageLoaded(const QString& id, const QImage& image);
70
void SyncPlaylistProgress(const spotify_pb::SyncPlaylistProgress& progress);
71
void AlbumBrowseResults(const spotify_pb::BrowseAlbumResponse& response);
75
void HandleMessage(const spotify_pb::SpotifyMessage& message);
78
void LoadPlaylist(spotify_pb::PlaylistType type, int index = -1);
79
void SyncPlaylist(spotify_pb::PlaylistType type, int index, bool offline);
80
void SendMessage(const spotify_pb::SpotifyMessage& message);
83
QTcpSocket* protocol_socket_;
84
SpotifyMessageHandler* handler_;
87
QList<spotify_pb::SpotifyMessage> queued_login_messages_;
88
QList<spotify_pb::SpotifyMessage> queued_messages_;
91
#endif // SPOTIFYSERVER_H