aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-10-17 13:42:38 -0700
committerScott Jackson <daneren2005@gmail.com>2015-10-17 13:42:38 -0700
commitdbf8a12eb38102f02ff4b0ed0636a4fe59d702a4 (patch)
tree6ecf514f42792baa54944e72f5a259c19a321e3d
parenta3d66eb3a0bc6df2b071f9477d83129118e9f2e3 (diff)
downloaddsub-dbf8a12eb38102f02ff4b0ed0636a4fe59d702a4.tar.gz
dsub-dbf8a12eb38102f02ff4b0ed0636a4fe59d702a4.tar.bz2
dsub-dbf8a12eb38102f02ff4b0ed0636a4fe59d702a4.zip
#574 Last.FM artwork fails if done by POST now
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java b/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java
index 88489e10..b405211d 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java
@@ -41,7 +41,9 @@ import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.conn.params.ConnManagerParams;
import org.apache.http.conn.params.ConnPerRouteBean;
@@ -1902,7 +1904,7 @@ public class RESTMusicService implements MusicService {
while (true) {
attempts++;
HttpContext httpContext = new BasicHttpContext();
- final HttpPost request = new HttpPost(url);
+ final HttpRequestBase request = (url.indexOf("rest") == -1) ? new HttpGet(url) : new HttpPost(url);
if (task != null) {
// Attempt to abort the HTTP request if the task is cancelled.
@@ -1929,12 +1931,12 @@ public class RESTMusicService implements MusicService {
});
}
- if (parameterNames != null) {
+ if (parameterNames != null && request instanceof HttpPost) {
List<NameValuePair> params = new ArrayList<NameValuePair>();
for (int i = 0; i < parameterNames.size(); i++) {
params.add(new BasicNameValuePair(parameterNames.get(i), String.valueOf(parameterValues.get(i))));
}
- request.setEntity(new UrlEncodedFormEntity(params, Constants.UTF_8));
+ ((HttpPost) request).setEntity(new UrlEncodedFormEntity(params, Constants.UTF_8));
}
if (requestParams != null) {