diff options
Diffstat (limited to 'subsonic-android')
14 files changed, 23 insertions, 21 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java index 142e284e..f1072e39 100644 --- a/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java +++ b/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java @@ -344,14 +344,14 @@ public class SelectAlbumActivity extends SubsonicTabActivity { return true; } - private void getMusicDirectory(final String id, String name) { + private void getMusicDirectory(final String id, final String name) { setTitle(name); new LoadTask() { @Override protected MusicDirectory load(MusicService service) throws Exception { boolean refresh = getIntent().getBooleanExtra(Constants.INTENT_EXTRA_NAME_REFRESH, false); - return service.getMusicDirectory(id, refresh, SelectAlbumActivity.this, this); + return service.getMusicDirectory(id, name, refresh, SelectAlbumActivity.this, this); } }.execute(); } diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicTabActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicTabActivity.java index 054e054d..ff63aae9 100644 --- a/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicTabActivity.java +++ b/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicTabActivity.java @@ -333,7 +333,7 @@ public class SubsonicTabActivity extends SherlockActivity { MusicService musicService = MusicServiceFactory.getMusicService(SubsonicTabActivity.this);
MusicDirectory root;
if(isDirectory)
- root = musicService.getMusicDirectory(id, false, SubsonicTabActivity.this, this);
+ root = musicService.getMusicDirectory(id, name, false, SubsonicTabActivity.this, this);
else
root = musicService.getPlaylist(id, name, SubsonicTabActivity.this, this);
List<MusicDirectory.Entry> songs = new LinkedList<MusicDirectory.Entry>();
@@ -353,7 +353,7 @@ public class SubsonicTabActivity extends SherlockActivity { }
for (MusicDirectory.Entry dir : parent.getChildren(true, false)) {
MusicService musicService = MusicServiceFactory.getMusicService(SubsonicTabActivity.this);
- getSongsRecursively(musicService.getMusicDirectory(dir.getId(), false, SubsonicTabActivity.this, this), songs);
+ getSongsRecursively(musicService.getMusicDirectory(dir.getId(), dir.getTitle(), false, SubsonicTabActivity.this, this), songs);
}
}
diff --git a/subsonic-android/src/github/daneren2005/dsub/service/CachedMusicService.java b/subsonic-android/src/github/daneren2005/dsub/service/CachedMusicService.java index cdd9a879..32807289 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/CachedMusicService.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/CachedMusicService.java @@ -110,12 +110,12 @@ public class CachedMusicService implements MusicService { } @Override - public MusicDirectory getMusicDirectory(String id, boolean refresh, Context context, ProgressListener progressListener) throws Exception { + public MusicDirectory getMusicDirectory(String id, String name, boolean refresh, Context context, ProgressListener progressListener) throws Exception { checkSettingsChanged(context); TimeLimitedCache<MusicDirectory> cache = refresh ? null : cachedMusicDirectories.get(id); MusicDirectory dir = cache == null ? null : cache.get(); if (dir == null) { - dir = musicService.getMusicDirectory(id, refresh, context, progressListener); + dir = musicService.getMusicDirectory(id, name, refresh, context, progressListener); cache = new TimeLimitedCache<MusicDirectory>(TTL_MUSIC_DIR, TimeUnit.SECONDS); cache.set(dir); cachedMusicDirectories.put(id, cache); diff --git a/subsonic-android/src/github/daneren2005/dsub/service/MusicService.java b/subsonic-android/src/github/daneren2005/dsub/service/MusicService.java index 1ccc2cdf..de3046d7 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/MusicService.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/MusicService.java @@ -49,7 +49,7 @@ public interface MusicService { Indexes getIndexes(String musicFolderId, boolean refresh, Context context, ProgressListener progressListener) throws Exception; - MusicDirectory getMusicDirectory(String id, boolean refresh, Context context, ProgressListener progressListener) throws Exception; + MusicDirectory getMusicDirectory(String id, String name, boolean refresh, Context context, ProgressListener progressListener) throws Exception; SearchResult search(SearchCritera criteria, Context context, ProgressListener progressListener) throws Exception; diff --git a/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java b/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java index fbb62e67..3d8a3881 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java @@ -81,7 +81,7 @@ public class OfflineMusicService extends RESTMusicService { } @Override - public MusicDirectory getMusicDirectory(String id, boolean refresh, Context context, ProgressListener progressListener) throws Exception { + public MusicDirectory getMusicDirectory(String id, String artistName, boolean refresh, Context context, ProgressListener progressListener) throws Exception { File dir = new File(id); MusicDirectory result = new MusicDirectory(); result.setName(dir.getName()); diff --git a/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java b/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java index ff2183ea..bf22521d 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java @@ -268,10 +268,10 @@ public class RESTMusicService implements MusicService { } @Override - public MusicDirectory getMusicDirectory(String id, boolean refresh, Context context, ProgressListener progressListener) throws Exception { + public MusicDirectory getMusicDirectory(String id, String name, boolean refresh, Context context, ProgressListener progressListener) throws Exception { Reader reader = getReader(context, progressListener, "getMusicDirectory", null, "id", id); try { - return new MusicDirectoryParser(context).parse(reader, progressListener); + return new MusicDirectoryParser(context).parse(name, reader, progressListener); } finally { Util.close(reader); } diff --git a/subsonic-android/src/github/daneren2005/dsub/service/parser/AlbumListParser.java b/subsonic-android/src/github/daneren2005/dsub/service/parser/AlbumListParser.java index 6cc33783..64145d67 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/parser/AlbumListParser.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/parser/AlbumListParser.java @@ -47,7 +47,7 @@ public class AlbumListParser extends MusicDirectoryEntryParser { if (eventType == XmlPullParser.START_TAG) { String name = getElementName(); if ("album".equals(name)) { - dir.addChild(parseEntry()); + dir.addChild(parseEntry("")); } else if ("error".equals(name)) { handleError(); } diff --git a/subsonic-android/src/github/daneren2005/dsub/service/parser/MusicDirectoryEntryParser.java b/subsonic-android/src/github/daneren2005/dsub/service/parser/MusicDirectoryEntryParser.java index d724f63c..89d8d52f 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/parser/MusicDirectoryEntryParser.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/parser/MusicDirectoryEntryParser.java @@ -30,7 +30,7 @@ public class MusicDirectoryEntryParser extends AbstractParser { super(context); } - protected MusicDirectory.Entry parseEntry() { + protected MusicDirectory.Entry parseEntry(String artist) { MusicDirectory.Entry entry = new MusicDirectory.Entry(); entry.setId(get("id")); entry.setParent(get("parent")); @@ -54,7 +54,9 @@ public class MusicDirectoryEntryParser extends AbstractParser { entry.setBitRate(getInteger("bitRate")); entry.setPath(get("path")); entry.setVideo(getBoolean("isVideo")); - } + } else if(!artist.isEmpty()) { + entry.setPath(artist + "/" + entry.getTitle()); + } return entry; } }
\ No newline at end of file diff --git a/subsonic-android/src/github/daneren2005/dsub/service/parser/MusicDirectoryParser.java b/subsonic-android/src/github/daneren2005/dsub/service/parser/MusicDirectoryParser.java index f34f1a81..370df305 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/parser/MusicDirectoryParser.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/parser/MusicDirectoryParser.java @@ -38,7 +38,7 @@ public class MusicDirectoryParser extends MusicDirectoryEntryParser { super(context); } - public MusicDirectory parse(Reader reader, ProgressListener progressListener) throws Exception { + public MusicDirectory parse(String artist, Reader reader, ProgressListener progressListener) throws Exception { long t0 = System.currentTimeMillis(); updateProgress(progressListener, R.string.parser_reading); @@ -51,7 +51,7 @@ public class MusicDirectoryParser extends MusicDirectoryEntryParser { if (eventType == XmlPullParser.START_TAG) { String name = getElementName(); if ("child".equals(name)) { - dir.addChild(parseEntry()); + dir.addChild(parseEntry(artist)); } else if ("directory".equals(name)) { dir.setName(get("name")); } else if ("error".equals(name)) { diff --git a/subsonic-android/src/github/daneren2005/dsub/service/parser/PlaylistParser.java b/subsonic-android/src/github/daneren2005/dsub/service/parser/PlaylistParser.java index b6f3ec39..8c6cfc6f 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/parser/PlaylistParser.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/parser/PlaylistParser.java @@ -46,7 +46,7 @@ public class PlaylistParser extends MusicDirectoryEntryParser { if (eventType == XmlPullParser.START_TAG) { String name = getElementName(); if ("entry".equals(name)) { - dir.addChild(parseEntry()); + dir.addChild(parseEntry("")); } else if ("error".equals(name)) { handleError(); } diff --git a/subsonic-android/src/github/daneren2005/dsub/service/parser/RandomSongsParser.java b/subsonic-android/src/github/daneren2005/dsub/service/parser/RandomSongsParser.java index bcddc0c7..3e62d3dc 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/parser/RandomSongsParser.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/parser/RandomSongsParser.java @@ -46,7 +46,7 @@ public class RandomSongsParser extends MusicDirectoryEntryParser { if (eventType == XmlPullParser.START_TAG) { String name = getElementName(); if ("song".equals(name)) { - dir.addChild(parseEntry()); + dir.addChild(parseEntry("")); } else if ("error".equals(name)) { handleError(); } diff --git a/subsonic-android/src/github/daneren2005/dsub/service/parser/SearchResult2Parser.java b/subsonic-android/src/github/daneren2005/dsub/service/parser/SearchResult2Parser.java index 171bd065..a0be07ac 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/parser/SearchResult2Parser.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/parser/SearchResult2Parser.java @@ -57,9 +57,9 @@ public class SearchResult2Parser extends MusicDirectoryEntryParser { artist.setName(get("name")); artists.add(artist); } else if ("album".equals(name)) { - albums.add(parseEntry()); + albums.add(parseEntry("")); } else if ("song".equals(name)) { - songs.add(parseEntry()); + songs.add(parseEntry("")); } else if ("error".equals(name)) { handleError(); } diff --git a/subsonic-android/src/github/daneren2005/dsub/service/parser/SearchResultParser.java b/subsonic-android/src/github/daneren2005/dsub/service/parser/SearchResultParser.java index 6b10047f..c8ef4031 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/parser/SearchResultParser.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/parser/SearchResultParser.java @@ -51,7 +51,7 @@ public class SearchResultParser extends MusicDirectoryEntryParser { if (eventType == XmlPullParser.START_TAG) { String name = getElementName(); if ("match".equals(name)) { - songs.add(parseEntry()); + songs.add(parseEntry("")); } else if ("error".equals(name)) { handleError(); } diff --git a/subsonic-android/src/github/daneren2005/dsub/service/parser/StarredListParser.java b/subsonic-android/src/github/daneren2005/dsub/service/parser/StarredListParser.java index bc1ed67c..2cb42f30 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/parser/StarredListParser.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/parser/StarredListParser.java @@ -47,7 +47,7 @@ public class StarredListParser extends MusicDirectoryEntryParser { if (eventType == XmlPullParser.START_TAG) { String name = getElementName(); if ("album".equals(name) || "song".equals(name)) { - dir.addChild(parseEntry()); + dir.addChild(parseEntry("")); } else if("artist".equals(name)) { } else if ("error".equals(name)) { |