aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-09-12 14:38:19 -0700
committerScott Jackson <daneren2005@gmail.com>2014-09-12 14:38:19 -0700
commit11dd40a7a4aec9d4317aa49636a9cf01e3ad83f3 (patch)
treefd730f2a691436bff257effed639ab70eab437c5
parent3cd0c587c2883a43e8adbe20825e13f8e1bc2814 (diff)
downloaddsub-11dd40a7a4aec9d4317aa49636a9cf01e3ad83f3.tar.gz
dsub-11dd40a7a4aec9d4317aa49636a9cf01e3ad83f3.tar.bz2
dsub-11dd40a7a4aec9d4317aa49636a9cf01e3ad83f3.zip
Fix offline starring of albums while tag browsing
-rw-r--r--src/github/daneren2005/dsub/service/RESTMusicService.java22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/github/daneren2005/dsub/service/RESTMusicService.java b/src/github/daneren2005/dsub/service/RESTMusicService.java
index 3d0fc8ed..53b20634 100644
--- a/src/github/daneren2005/dsub/service/RESTMusicService.java
+++ b/src/github/daneren2005/dsub/service/RESTMusicService.java
@@ -1405,18 +1405,24 @@ public class RESTMusicService implements MusicService {
try{
SearchCritera critera = new SearchCritera(search, 0, 1, 1);
SearchResult result = searchNew(critera, context, progressListener);
- if(result.getSongs().size() == 1){
- Log.i(TAG, "Query '" + search + "' returned song " + result.getSongs().get(0).getTitle() + " by " + result.getSongs().get(0).getArtist() + " with id " + result.getSongs().get(0).getId());
- setStarred(Arrays.asList(result.getSongs().get(0)), null, null, starred, progressListener, context);
- } else if(result.getAlbums().size() == 1){
- Log.i(TAG, "Query '" + search + "' returned song " + result.getAlbums().get(0).getTitle() + " by " + result.getAlbums().get(0).getArtist() + " with id " + result.getAlbums().get(0).getId());
- setStarred(Arrays.asList(result.getAlbums().get(0)), null, null, starred, progressListener, context);
+ if(result.getSongs().size() == 1) {
+ MusicDirectory.Entry song = result.getSongs().get(0);
+ Log.i(TAG, "Query '" + search + "' returned song " + song.getTitle() + " by " + song.getArtist() + " with id " + song.getId());
+ setStarred(Arrays.asList(song), null, null, starred, progressListener, context);
+ } else if(result.getAlbums().size() == 1) {
+ MusicDirectory.Entry album = result.getAlbums().get(0);
+ Log.i(TAG, "Query '" + search + "' returned album " + album.getTitle() + " by " + album.getArtist() + " with id " + album.getId());
+ if(Util.isTagBrowsing(context, getInstance(context))) {
+ setStarred(null, null, Arrays.asList(album), starred, progressListener, context);
+ } else {
+ setStarred(Arrays.asList(album), null, null, starred, progressListener, context);
+ }
}
- else{
+ else {
throw new Exception("Song not found on server");
}
}
- catch(Exception e){
+ catch(Exception e) {
Log.e(TAG, e.toString());
retry++;
}