From de902fb75c4573527ff86d8e6c6c155628efe94b Mon Sep 17 00:00:00 2001
From: Colin Fletcher <colin.m.fletcher@googlemail.com>
Date: Tue, 19 Jan 2016 11:31:54 +0000
Subject: [PATCH 4/4] Freesound: s/api_key/token/g

What used to be called an 'api_key' in the old Freesound API is now called
a token: renmae variables for consistency.
---
 gtk2_ardour/sfdb_freesound_mootcher.cc | 16 ++++++++--------
 gtk2_ardour/sfdb_freesound_mootcher.h  |  4 ++--
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/gtk2_ardour/sfdb_freesound_mootcher.cc b/gtk2_ardour/sfdb_freesound_mootcher.cc
index d3bdc26..1542bba 100644
--- a/gtk2_ardour/sfdb_freesound_mootcher.cc
+++ b/gtk2_ardour/sfdb_freesound_mootcher.cc
@@ -63,20 +63,20 @@ using namespace PBD;
 static const std::string base_url = "http://www.freesound.org/apiv2";
 
 // Ardour 4
-static const std::string default_api_key = "b2cc51878bd4fde055e3e84591eb289715d01503";
+static const std::string default_token = "b2cc51878bd4fde055e3e84591eb289715d01503";
 static const std::string client_id = "c7eff9328525c51775cb";
 
 static const std::string fields = "id,name,duration,filesize,samplerate,license,download,previews";
 
 //------------------------------------------------------------------------
-Mootcher::Mootcher(const std::string &the_api_key)
+Mootcher::Mootcher(const std::string &the_token)
 	: curl(curl_easy_init())
 {
 	DEBUG_TRACE(PBD::DEBUG::Freesound, "Created new Mootcher\n");
-	if  (the_api_key != "") {
-		api_key = the_api_key;
+	if  (the_token != "") {
+		token = the_token;
 	} else {
-		api_key = default_api_key;
+		token = default_token;
 	}
 	cancel_download_btn.set_label (_("Cancel"));
 	progress_hbox.pack_start (progress_bar, true, true);
@@ -190,9 +190,9 @@ std::string Mootcher::doRequest(std::string uri, std::string params)
 	// the url to get
 	std::string url = base_url + uri + "?";
 	if (params != "") {
-		url += params + "&token=" + api_key + "&format=xml";
+		url += params + "&token=" + token + "&format=xml";
 	} else {
-		url += "token=" + api_key + "&format=xml";
+		url += "token=" + token + "&format=xml";
 	}
 
 	curl_easy_setopt(curl, CURLOPT_URL, url.c_str() );
@@ -430,7 +430,7 @@ bool Mootcher::fetchAudioFile(std::string originalFileName, std::string theID, s
 	}
 
 	// create the download url
-	audioURL += "?token=" + api_key;
+	audioURL += "?token=" + token;
 
 	setcUrlOptions();
 	curl_easy_setopt(curl, CURLOPT_URL, audioURL.c_str() );
diff --git a/gtk2_ardour/sfdb_freesound_mootcher.h b/gtk2_ardour/sfdb_freesound_mootcher.h
index 6dfad6c..27cf793 100644
--- a/gtk2_ardour/sfdb_freesound_mootcher.h
+++ b/gtk2_ardour/sfdb_freesound_mootcher.h
@@ -66,7 +66,7 @@ enum sortMethod {
 class Mootcher: public sigc::trackable, public PBD::ScopedConnectionList
 {
 public:
-	Mootcher(const std::string &api_key = "");
+	Mootcher(const std::string &token = "");
 	~Mootcher();
 
 	bool		checkAudioFile(std::string originalFileName, std::string ID);
@@ -118,6 +118,6 @@ private:
 
 	std::string basePath;
 	std::string xmlLocation;
-	std::string api_key;
+	std::string token;
 };
 
-- 
2.7.0.rc3

