mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-14 00:28:42 +00:00
Dropbox cloud service - Add format parameter
The format parameter allows to choose between JSON, FIT, TCX, PWX and CSV as the filetype to be used for the service instance. Default is JSON for backward compatibility and because it is the only format preserving all data. The use case is for coaches downloading FIT files from athletes Dropbox folders. Fixes #2710
This commit is contained in:
@@ -236,8 +236,8 @@ RideFile *
|
||||
CloudService::uncompressRide(QByteArray *data, QString name, QStringList &errors)
|
||||
{
|
||||
// make sure its named as we expect
|
||||
if ((downloadCompression== zip && !name.endsWith(".json.zip")) ||
|
||||
(downloadCompression== gzip && !name.endsWith(".json.gz"))) {
|
||||
if ((downloadCompression== zip && !name.endsWith(".zip")) ||
|
||||
(downloadCompression== gzip && !name.endsWith(".gz"))) {
|
||||
errors << tr("expected compressed activity file.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ Dropbox::Dropbox(Context *context) : CloudService(context), context(context), ro
|
||||
// config
|
||||
settings.insert(OAuthToken, GC_DROPBOX_TOKEN);
|
||||
settings.insert(Folder, GC_DROPBOX_FOLDER);
|
||||
settings.insert(Combo1, QString("%1::Format::JSON::FIT::TCX::PWX::CSV").arg(GC_DROPBOX_FORMAT));
|
||||
}
|
||||
|
||||
Dropbox::~Dropbox() {
|
||||
@@ -41,6 +42,14 @@ Dropbox::~Dropbox() {
|
||||
bool
|
||||
Dropbox::open(QStringList &errors)
|
||||
{
|
||||
// User selected file format, defaults to JSON
|
||||
const QString format = getSetting(GC_DROPBOX_FORMAT, "JSON").toString();
|
||||
if (format == "JSON") filetype = uploadType::JSON;
|
||||
else if (format == "FIT") filetype = uploadType::FIT;
|
||||
else if (format == "TCX") filetype = uploadType::TCX;
|
||||
else if (format == "PWX") filetype = uploadType::PWX;
|
||||
else if (format == "CSV") filetype = uploadType::CSV;
|
||||
|
||||
// do we have a token
|
||||
QString token = getSetting(GC_DROPBOX_TOKEN, "").toString();
|
||||
if (token == "") {
|
||||
|
||||
@@ -378,6 +378,7 @@
|
||||
//Dropbox oauth keys
|
||||
#define GC_DROPBOX_TOKEN "<athlete-private>dropbox/token"
|
||||
#define GC_DROPBOX_FOLDER "<athlete-private>dropbox/folder"
|
||||
#define GC_DROPBOX_FORMAT "<athlete-private>dropbox/format"
|
||||
|
||||
//Withings
|
||||
#define GC_WITHINGS_TOKEN "<athlete-private>withings_token"
|
||||
|
||||
Reference in New Issue
Block a user