Clementine-audio-player-Mac.../src/internet/amazon/amazonclouddrive.h

72 lines
1.9 KiB
C
Raw Normal View History

Amazon Cloud Drive support. Squashed commit of the following: commit 451a327fabb5f9aba077d93a33d75d8a6a288f5f Author: John Maguire <john.maguire@gmail.com> Date: Fri Mar 27 14:55:36 2015 +0100 Revert debug console changes. commit 52f643c3dc524a837f56268b6da4881187204165 Author: John Maguire <john.maguire@gmail.com> Date: Fri Mar 27 14:49:28 2015 +0100 Revert extra logging commit 23645f9fea4caa65d93c2a0a5ad5e2a164c3b535 Author: John Maguire <john.maguire@gmail.com> Date: Fri Mar 27 14:47:55 2015 +0100 How did you get there commit 8153388f19db17caf4286618922516b495a3f1d3 Author: John Maguire <john.maguire@gmail.com> Date: Fri Mar 27 14:45:12 2015 +0100 Update copyright headers. commit fa9e279259604a16564287291180b69cbb22d74f Author: John Maguire <john.maguire@gmail.com> Date: Fri Mar 27 14:43:27 2015 +0100 Remove logging commit 47a405543c8f6924adb60fbc34ec7360c608a9ec Author: John Maguire <john.maguire@gmail.com> Date: Fri Mar 27 14:42:05 2015 +0100 Show login state correctly for Amazon. commit 748d88d993fb56ecd97e14b8e7c7b6c49f11c410 Author: John Maguire <john.maguire@gmail.com> Date: Fri Mar 27 14:28:55 2015 +0100 Ensure Amazon is connected before serving URLs. commit 25ec9c65f4b0be4fc2df13cf941cf236f7cf6b46 Author: John Maguire <john.maguire@gmail.com> Date: Fri Mar 27 14:22:28 2015 +0100 Refresh Amazon authorisation & follow changes. commit 27c1a37173a76e04341b87abe2ada8438d6ee59f Author: John Maguire <john.maguire@gmail.com> Date: Thu Mar 26 18:27:27 2015 +0100 Revert unneeded OAuthenticator change. commit 3594af5be12d979762719010535db8f5aaec0905 Author: John Maguire <john.maguire@gmail.com> Date: Thu Mar 26 16:52:19 2015 +0100 Initial support for Amazon Cloud Drive.
2015-03-27 14:56:08 +01:00
/* This file is part of Clementine.
Copyright 2015, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef INTERNET_AMAZON_AMAZON_CLOUD_DRIVE_H_
#define INTERNET_AMAZON_AMAZON_CLOUD_DRIVE_H_
#include "internet/core/cloudfileservice.h"
#include <QDateTime>
#include <QString>
#include <QUrl>
class NetworkAccessManager;
class OAuthenticator;
class QNetworkReply;
class QNetworkRequest;
class AmazonCloudDrive : public CloudFileService {
Q_OBJECT
public:
AmazonCloudDrive(Application* app, InternetModel* parent);
static const char* kServiceName;
static const char* kSettingsGroup;
virtual bool has_credentials() const;
QUrl GetStreamingUrlFromSongId(const QUrl& url);
void ForgetCredentials();
signals:
void Connected();
public slots:
void Connect();
private:
void FetchEndpoint();
void RequestChanges(const QString& checkpoint);
void AddAuthorizationHeader(QNetworkRequest* request);
void EnsureConnected();
private slots:
void ConnectFinished(OAuthenticator*);
void FetchEndpointFinished(QNetworkReply*);
void RequestChangesFinished(QNetworkReply*);
private:
NetworkAccessManager* network_;
QString access_token_;
QDateTime expiry_time_;
QString content_url_;
QString metadata_url_;
};
#endif // INTERNET_AMAZON_AMAZON_CLOUD_DRIVE_H_