From 5c4db8635facc00df744c3e6421cbec5bb88a370 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Wed, 21 Sep 2016 17:35:19 -0700 Subject: Don't scrobble/load image for Internet Radio Stations (closes #172) --- .../daneren2005/dsub/service/DownloadServiceLifecycleSupport.java | 4 +++- app/src/main/java/github/daneren2005/dsub/service/Scrobbler.java | 3 ++- app/src/main/java/github/daneren2005/dsub/util/ImageLoader.java | 8 ++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) (limited to 'app/src/main') diff --git a/app/src/main/java/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java b/app/src/main/java/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java index 726840b2..1c80b622 100644 --- a/app/src/main/java/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java +++ b/app/src/main/java/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java @@ -36,6 +36,8 @@ import android.telephony.PhoneStateListener; import android.telephony.TelephonyManager; import android.util.Log; import android.view.KeyEvent; + +import github.daneren2005.dsub.domain.InternetRadioStation; import github.daneren2005.dsub.domain.MusicDirectory; import github.daneren2005.dsub.domain.PlayerQueue; import github.daneren2005.dsub.domain.PlayerState; @@ -310,7 +312,7 @@ public class DownloadServiceLifecycleSupport { FileUtil.serialize(downloadService, state, FILENAME_DOWNLOADS_SER); // If we are on Subsonic 5.2+, save play queue - if(serializeRemote && ServerInfo.canSavePlayQueue(downloadService) && !Util.isOffline(downloadService) && state.songs.size() > 0) { + if(serializeRemote && ServerInfo.canSavePlayQueue(downloadService) && !Util.isOffline(downloadService) && state.songs.size() > 0 && !(state.songs.get(0) instanceof InternetRadioStation)) { // Cancel any currently running tasks if(currentSavePlayQueueTask != null) { currentSavePlayQueueTask.cancel(); diff --git a/app/src/main/java/github/daneren2005/dsub/service/Scrobbler.java b/app/src/main/java/github/daneren2005/dsub/service/Scrobbler.java index 168a7777..c7ad639e 100644 --- a/app/src/main/java/github/daneren2005/dsub/service/Scrobbler.java +++ b/app/src/main/java/github/daneren2005/dsub/service/Scrobbler.java @@ -3,6 +3,7 @@ package github.daneren2005.dsub.service; import android.content.Context; import android.util.Log; +import github.daneren2005.dsub.domain.InternetRadioStation; import github.daneren2005.dsub.domain.MusicDirectory; import github.daneren2005.dsub.domain.PodcastEpisode; import github.daneren2005.dsub.util.SilentBackgroundTask; @@ -69,7 +70,7 @@ public class Scrobbler { return null; } // Ignore podcasts - else if(song.getSong() instanceof PodcastEpisode) { + else if(song.getSong() instanceof PodcastEpisode || song.getSong() instanceof InternetRadioStation) { return null; } diff --git a/app/src/main/java/github/daneren2005/dsub/util/ImageLoader.java b/app/src/main/java/github/daneren2005/dsub/util/ImageLoader.java index a85141df..2321e69e 100644 --- a/app/src/main/java/github/daneren2005/dsub/util/ImageLoader.java +++ b/app/src/main/java/github/daneren2005/dsub/util/ImageLoader.java @@ -43,6 +43,7 @@ import java.lang.ref.WeakReference; import github.daneren2005.dsub.R; import github.daneren2005.dsub.domain.ArtistInfo; +import github.daneren2005.dsub.domain.InternetRadioStation; import github.daneren2005.dsub.domain.MusicDirectory; import github.daneren2005.dsub.domain.Playlist; import github.daneren2005.dsub.domain.PodcastChannel; @@ -221,8 +222,11 @@ public class ImageLoader { return loadImage(view, entry, large, size, crossfade); } public SilentBackgroundTask loadImage(View view, MusicDirectory.Entry entry, boolean large, int size, boolean crossfade) { - // TODO: If we know this a artist, try to load artist info instead - if(entry != null && !entry.isAlbum() && ServerInfo.checkServerVersion(context, "1.11") && !Util.isOffline(context)) { + if(entry != null && entry instanceof InternetRadioStation) { + // Continue on and load a null bitmap + } + // If we know this a artist, try to load artist info instead + else if(entry != null && !entry.isAlbum() && ServerInfo.checkServerVersion(context, "1.11") && !Util.isOffline(context)) { SilentBackgroundTask task = new ArtistImageTask(view.getContext(), entry, size, imageSizeLarge, large, view, crossfade); task.execute(); return task; -- cgit v1.2.3