aboutsummaryrefslogtreecommitdiff
path: root/src/github/daneren2005
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-02-15 14:20:48 -0800
committerScott Jackson <daneren2005@gmail.com>2014-02-15 14:20:48 -0800
commitabe7f243dee1b85a0f82fab3fe552c8ae4e6ee87 (patch)
treef691997e6222a012764edb5b375b8b796459d15c /src/github/daneren2005
parent3c1de917b661cb105aaa80542d87a1e4bf6c2c77 (diff)
downloaddsub-abe7f243dee1b85a0f82fab3fe552c8ae4e6ee87.tar.gz
dsub-abe7f243dee1b85a0f82fab3fe552c8ae4e6ee87.tar.bz2
dsub-abe7f243dee1b85a0f82fab3fe552c8ae4e6ee87.zip
Add album art to cast
Diffstat (limited to 'src/github/daneren2005')
-rw-r--r--src/github/daneren2005/dsub/service/ChromeCastController.java7
-rw-r--r--src/github/daneren2005/dsub/service/RESTMusicService.java2
2 files changed, 7 insertions, 2 deletions
diff --git a/src/github/daneren2005/dsub/service/ChromeCastController.java b/src/github/daneren2005/dsub/service/ChromeCastController.java
index c70ccdcd..49f36997 100644
--- a/src/github/daneren2005/dsub/service/ChromeCastController.java
+++ b/src/github/daneren2005/dsub/service/ChromeCastController.java
@@ -15,6 +15,7 @@
package github.daneren2005.dsub.service;
+import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
@@ -26,9 +27,11 @@ import com.google.android.gms.cast.MediaMetadata;
import com.google.android.gms.cast.MediaStatus;
import com.google.android.gms.cast.RemoteMediaPlayer;
import com.google.android.gms.common.ConnectionResult;
+import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.ResultCallback;
import com.google.android.gms.common.api.Status;
+import com.google.android.gms.common.images.WebImage;
import java.io.IOException;
@@ -215,6 +218,8 @@ public class ChromeCastController extends RemoteController {
meta.putString(MediaMetadata.KEY_ARTIST, song.getArtist());
meta.putString(MediaMetadata.KEY_ALBUM_ARTIST, song.getArtist());
meta.putString(MediaMetadata.KEY_ALBUM_TITLE, song.getAlbum());
+ String coverArt = musicService.getCoverArtUrl(downloadService, song);
+ meta.addImage(new WebImage(Uri.parse(coverArt)));
}
// Load it into a MediaInfo wrapper
@@ -234,7 +239,7 @@ public class ChromeCastController extends RemoteController {
downloadService.setPlayerState(PlayerState.PREPARED);
}
} else if(result.getStatus().getStatusCode() != ConnectionResult.SIGN_IN_REQUIRED) {
- Log.e(TAG, "Failed to load");
+ Log.e(TAG, "Failed to load: " + result.getStatus().toString());
downloadService.setPlayerState(PlayerState.STOPPED);
error = true;
Util.toast(downloadService, downloadService.getResources().getString(R.string.download_failed_to_load));
diff --git a/src/github/daneren2005/dsub/service/RESTMusicService.java b/src/github/daneren2005/dsub/service/RESTMusicService.java
index 5c909d1f..37e2bf44 100644
--- a/src/github/daneren2005/dsub/service/RESTMusicService.java
+++ b/src/github/daneren2005/dsub/service/RESTMusicService.java
@@ -646,7 +646,7 @@ public class RESTMusicService implements MusicService {
@Override
public String getCoverArtUrl(Context context, MusicDirectory.Entry entry) throws Exception {
- StringBuilder builder = new StringBuilder(getRestUrl(context, "getCoverArt"));
+ StringBuilder builder = new StringBuilder(getRestUrl(context, "getCoverArt", false));
builder.append("&id=").append(entry.getId());
String url = rewriteUrlWithRedirect(context, builder.toString());
return url;