mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-31 11:35:24 +01:00
Rename google drive tagging methods to more appropriate generic names.
This commit is contained in:
parent
210f978188
commit
9c7a3ab105
@ -129,19 +129,19 @@ void TagReaderWorker::MessageArrived(const pb::tagreader::Message& message) {
|
|||||||
QStringFromStdString(message.load_embedded_art_request().filename()));
|
QStringFromStdString(message.load_embedded_art_request().filename()));
|
||||||
reply.mutable_load_embedded_art_response()->set_data(
|
reply.mutable_load_embedded_art_response()->set_data(
|
||||||
data.constData(), data.size());
|
data.constData(), data.size());
|
||||||
} else if (message.has_read_google_drive_request()) {
|
} else if (message.has_read_cloud_file_request()) {
|
||||||
#ifdef HAVE_GOOGLE_DRIVE
|
#ifdef HAVE_GOOGLE_DRIVE
|
||||||
const pb::tagreader::ReadGoogleDriveRequest& req =
|
const pb::tagreader::ReadCloudFileRequest& req =
|
||||||
message.read_google_drive_request();
|
message.read_cloud_file_request();
|
||||||
if (!ReadGoogleDrive(
|
if (!ReadCloudFile(
|
||||||
QUrl::fromEncoded(QByteArray(req.download_url().data(),
|
QUrl::fromEncoded(QByteArray(req.download_url().data(),
|
||||||
req.download_url().size())),
|
req.download_url().size())),
|
||||||
QStringFromStdString(req.title()),
|
QStringFromStdString(req.title()),
|
||||||
req.size(),
|
req.size(),
|
||||||
QStringFromStdString(req.mime_type()),
|
QStringFromStdString(req.mime_type()),
|
||||||
QStringFromStdString(req.authorisation_header()),
|
QStringFromStdString(req.authorisation_header()),
|
||||||
reply.mutable_read_google_drive_response()->mutable_metadata())) {
|
reply.mutable_read_cloud_file_response()->mutable_metadata())) {
|
||||||
reply.mutable_read_google_drive_response()->clear_metadata();
|
reply.mutable_read_cloud_file_response()->clear_metadata();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -611,7 +611,7 @@ void TagReaderWorker::DeviceClosed() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_GOOGLE_DRIVE
|
#ifdef HAVE_GOOGLE_DRIVE
|
||||||
bool TagReaderWorker::ReadGoogleDrive(const QUrl& download_url,
|
bool TagReaderWorker::ReadCloudFile(const QUrl& download_url,
|
||||||
const QString& title,
|
const QString& title,
|
||||||
int size,
|
int size,
|
||||||
const QString& mime_type,
|
const QString& mime_type,
|
||||||
|
@ -55,7 +55,7 @@ private:
|
|||||||
QByteArray LoadEmbeddedArt(const QString& filename) const;
|
QByteArray LoadEmbeddedArt(const QString& filename) const;
|
||||||
|
|
||||||
#ifdef HAVE_GOOGLE_DRIVE
|
#ifdef HAVE_GOOGLE_DRIVE
|
||||||
bool ReadGoogleDrive(const QUrl& download_url,
|
bool ReadCloudFile(const QUrl& download_url,
|
||||||
const QString& title,
|
const QString& title,
|
||||||
int size,
|
int size,
|
||||||
const QString& mime_type,
|
const QString& mime_type,
|
||||||
|
@ -82,7 +82,7 @@ message LoadEmbeddedArtResponse {
|
|||||||
optional bytes data = 1;
|
optional bytes data = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message ReadGoogleDriveRequest {
|
message ReadCloudFileRequest {
|
||||||
optional string download_url = 1;
|
optional string download_url = 1;
|
||||||
optional string title = 2;
|
optional string title = 2;
|
||||||
optional int32 size = 3;
|
optional int32 size = 3;
|
||||||
@ -90,7 +90,7 @@ message ReadGoogleDriveRequest {
|
|||||||
optional string mime_type = 5;
|
optional string mime_type = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
message ReadGoogleDriveResponse {
|
message ReadCloudFileResponse {
|
||||||
optional SongMetadata metadata = 1;
|
optional SongMetadata metadata = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,6 +109,6 @@ message Message {
|
|||||||
optional LoadEmbeddedArtRequest load_embedded_art_request = 8;
|
optional LoadEmbeddedArtRequest load_embedded_art_request = 8;
|
||||||
optional LoadEmbeddedArtResponse load_embedded_art_response = 9;
|
optional LoadEmbeddedArtResponse load_embedded_art_response = 9;
|
||||||
|
|
||||||
optional ReadGoogleDriveRequest read_google_drive_request = 10;
|
optional ReadCloudFileRequest read_cloud_file_request = 10;
|
||||||
optional ReadGoogleDriveResponse read_google_drive_response = 11;
|
optional ReadCloudFileResponse read_cloud_file_response = 11;
|
||||||
}
|
}
|
||||||
|
@ -84,14 +84,14 @@ TagReaderReply* TagReaderClient::LoadEmbeddedArt(const QString& filename) {
|
|||||||
return worker_pool_->SendMessageWithReply(&message);
|
return worker_pool_->SendMessageWithReply(&message);
|
||||||
}
|
}
|
||||||
|
|
||||||
TagReaderReply* TagReaderClient::ReadGoogleDrive(const QUrl& download_url,
|
TagReaderReply* TagReaderClient::ReadCloudFile(const QUrl& download_url,
|
||||||
const QString& title,
|
const QString& title,
|
||||||
int size,
|
int size,
|
||||||
const QString& mime_type,
|
const QString& mime_type,
|
||||||
const QString& authorisation_header) {
|
const QString& authorisation_header) {
|
||||||
pb::tagreader::Message message;
|
pb::tagreader::Message message;
|
||||||
pb::tagreader::ReadGoogleDriveRequest* req =
|
pb::tagreader::ReadCloudFileRequest* req =
|
||||||
message.mutable_read_google_drive_request();
|
message.mutable_read_cloud_file_request();
|
||||||
|
|
||||||
const QString url_string = download_url.toEncoded();
|
const QString url_string = download_url.toEncoded();
|
||||||
req->set_download_url(DataCommaSizeFromQString(url_string));
|
req->set_download_url(DataCommaSizeFromQString(url_string));
|
||||||
|
@ -45,7 +45,7 @@ public:
|
|||||||
ReplyType* SaveFile(const QString& filename, const Song& metadata);
|
ReplyType* SaveFile(const QString& filename, const Song& metadata);
|
||||||
ReplyType* IsMediaFile(const QString& filename);
|
ReplyType* IsMediaFile(const QString& filename);
|
||||||
ReplyType* LoadEmbeddedArt(const QString& filename);
|
ReplyType* LoadEmbeddedArt(const QString& filename);
|
||||||
ReplyType* ReadGoogleDrive(const QUrl& download_url,
|
ReplyType* ReadCloudFile(const QUrl& download_url,
|
||||||
const QString& title,
|
const QString& title,
|
||||||
int size,
|
int size,
|
||||||
const QString& mime_type,
|
const QString& mime_type,
|
||||||
|
@ -139,7 +139,7 @@ void GoogleDriveService::MaybeAddFileToDatabase(const google_drive::File& file)
|
|||||||
|
|
||||||
// Song not in index; tag and add.
|
// Song not in index; tag and add.
|
||||||
QString authorisation_header = QString("Bearer %1").arg(client_->access_token());
|
QString authorisation_header = QString("Bearer %1").arg(client_->access_token());
|
||||||
TagReaderClient::ReplyType* reply = app_->tag_reader_client()->ReadGoogleDrive(
|
TagReaderClient::ReplyType* reply = app_->tag_reader_client()->ReadCloudFile(
|
||||||
file.download_url(),
|
file.download_url(),
|
||||||
file.title(),
|
file.title(),
|
||||||
file.size(),
|
file.size(),
|
||||||
@ -159,8 +159,8 @@ void GoogleDriveService::ReadTagsFinished(TagReaderClient::ReplyType* reply,
|
|||||||
|
|
||||||
TaskManager::ScopedTask(task_id, task_manager_);
|
TaskManager::ScopedTask(task_id, task_manager_);
|
||||||
|
|
||||||
const pb::tagreader::ReadGoogleDriveResponse& msg =
|
const pb::tagreader::ReadCloudFileResponse& msg =
|
||||||
reply->message().read_google_drive_response();
|
reply->message().read_cloud_file_response();
|
||||||
if (!msg.has_metadata() || !msg.metadata().filesize()) {
|
if (!msg.has_metadata() || !msg.metadata().filesize()) {
|
||||||
qLog(Debug) << "Failed to tag:" << metadata.title();
|
qLog(Debug) << "Failed to tag:" << metadata.title();
|
||||||
return;
|
return;
|
||||||
|
@ -135,7 +135,7 @@ void UbuntuOneService::MaybeAddFileToDatabase(const QVariantMap& file) {
|
|||||||
QUrl content_url(kContentRoot);
|
QUrl content_url(kContentRoot);
|
||||||
content_url.setPath(content_path);
|
content_url.setPath(content_path);
|
||||||
|
|
||||||
TagReaderClient::ReplyType* reply = app_->tag_reader_client()->ReadGoogleDrive(
|
TagReaderClient::ReplyType* reply = app_->tag_reader_client()->ReadCloudFile(
|
||||||
content_url,
|
content_url,
|
||||||
file["path"].toString().mid(1),
|
file["path"].toString().mid(1),
|
||||||
file["size"].toInt(),
|
file["size"].toInt(),
|
||||||
@ -151,7 +151,7 @@ void UbuntuOneService::ReadTagsFinished(
|
|||||||
TagReaderClient::ReplyType* reply, const QVariantMap& file, const QUrl& url) {
|
TagReaderClient::ReplyType* reply, const QVariantMap& file, const QUrl& url) {
|
||||||
qLog(Debug) << reply->message().DebugString().c_str();
|
qLog(Debug) << reply->message().DebugString().c_str();
|
||||||
Song song;
|
Song song;
|
||||||
song.InitFromProtobuf(reply->message().read_google_drive_response().metadata());
|
song.InitFromProtobuf(reply->message().read_cloud_file_response().metadata());
|
||||||
song.set_directory_id(0);
|
song.set_directory_id(0);
|
||||||
song.set_etag(file["hash"].toString());
|
song.set_etag(file["hash"].toString());
|
||||||
song.set_mtime(
|
song.set_mtime(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user