From abe7f243dee1b85a0f82fab3fe552c8ae4e6ee87 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Sat, 15 Feb 2014 14:20:48 -0800 Subject: Add album art to cast --- src/github/daneren2005/dsub/service/ChromeCastController.java | 7 ++++++- src/github/daneren2005/dsub/service/RESTMusicService.java | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src/github/daneren2005') 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; -- cgit v1.2.3