diff options
author | Scott Jackson <daneren2005@gmail.com> | 2013-06-20 20:53:25 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2013-06-20 20:53:25 -0700 |
commit | 6d82bc108e596f0f09a699b599213e09fbaf1fa6 (patch) | |
tree | d25f88b054145a2423ff28fc3c799bc54c61f69c | |
parent | 36662f56d577883921aa544ce451ec8dc9d0ce90 (diff) | |
download | dsub-6d82bc108e596f0f09a699b599213e09fbaf1fa6.tar.gz dsub-6d82bc108e596f0f09a699b599213e09fbaf1fa6.tar.bz2 dsub-6d82bc108e596f0f09a699b599213e09fbaf1fa6.zip |
Add starring of offline songs while in online mode
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java b/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java index 75867fdc..73a9f43b 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java @@ -791,7 +791,19 @@ public class RESTMusicService implements MusicService { @Override public void setStarred(String id, boolean starred, Context context, ProgressListener progressListener) throws Exception { checkServerVersion(context, "1.8", "Starring is not supported."); - Reader reader = getReader(context, progressListener, starred ? "star" : "unstar", null, "id", id); + + SharedPreferences prefs = Util.getPreferences(context); + String cacheLocn = prefs.getString(Constants.PREFERENCES_KEY_CACHE_LOCATION, null); + if(id.indexOf(cacheLocn) != -1) { + String searchCriteria = Util.parseOfflineIDSearch(context, id, cacheLocn); + SearchCritera critera = new SearchCritera(searchCriteria, 0, 0, 1); + SearchResult result = searchNew(critera, context, progressListener); + if(result.getSongs().size() == 1){ + id = result.getSongs().get(0).getId(); + } + } + + Reader reader = getReader(context, progressListener, starred ? "star" : "unstar", null, "id", id); try { new ErrorParser(context).parse(reader); } finally { |