diff options
author | daneren2005 <daneren2005@gmail.com> | 2013-12-05 17:17:39 -0800 |
---|---|---|
committer | daneren2005 <daneren2005@gmail.com> | 2013-12-05 17:17:39 -0800 |
commit | f53152091f41bdeb4785db203d8da088fa4ffa3f (patch) | |
tree | d1d918000f2e75f0c93864d539d25430e977cb9a /src/github | |
parent | 798922c5898ec363cf275e2d6510cfbee973fa4d (diff) | |
download | dsub-f53152091f41bdeb4785db203d8da088fa4ffa3f.tar.gz dsub-f53152091f41bdeb4785db203d8da088fa4ffa3f.tar.bz2 dsub-f53152091f41bdeb4785db203d8da088fa4ffa3f.zip |
Added album details logic
Diffstat (limited to 'src/github')
-rw-r--r-- | src/github/daneren2005/dsub/fragments/SubsonicFragment.java | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java index 48157c34..478f788d 100644 --- a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java +++ b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java @@ -271,6 +271,9 @@ public class SubsonicFragment extends Fragment { case R.id.album_menu_delete:
deleteRecursively(entry);
break;
+ case R.id.album_menu_info:
+ displaySongInfo(entry);
+ break;
case R.id.song_menu_play_now:
getDownloadService().clear();
getDownloadService().download(songs, false, true, true, false);
@@ -877,25 +880,27 @@ public class SubsonicFragment extends Fragment { Integer bitrate = null;
String format = null;
long size = 0;
- try {
- DownloadFile downloadFile = new DownloadFile(context, song, false);
- File file = downloadFile.getCompleteFile();
- if(file.exists()) {
- MediaMetadataRetriever metadata = new MediaMetadataRetriever();
- metadata.setDataSource(file.getAbsolutePath());
- String tmp = metadata.extractMetadata(MediaMetadataRetriever.METADATA_KEY_BITRATE);
- bitrate = Integer.parseInt((tmp != null) ? tmp : "0") / 1000;
- format = FileUtil.getExtension(file.getName());
- size = file.length();
-
- if(Util.isOffline(context)) {
- song.setGenre(metadata.extractMetadata(MediaMetadataRetriever.METADATA_KEY_GENRE));
- String year = metadata.extractMetadata(MediaMetadataRetriever.METADATA_KEY_YEAR);
- song.setYear(Integer.parseInt((year != null) ? year : "0"));
+ if(!song.isDirectory()) {
+ try {
+ DownloadFile downloadFile = new DownloadFile(context, song, false);
+ File file = downloadFile.getCompleteFile();
+ if(file.exists()) {
+ MediaMetadataRetriever metadata = new MediaMetadataRetriever();
+ metadata.setDataSource(file.getAbsolutePath());
+ String tmp = metadata.extractMetadata(MediaMetadataRetriever.METADATA_KEY_BITRATE);
+ bitrate = Integer.parseInt((tmp != null) ? tmp : "0") / 1000;
+ format = FileUtil.getExtension(file.getName());
+ size = file.length();
+
+ if(Util.isOffline(context)) {
+ song.setGenre(metadata.extractMetadata(MediaMetadataRetriever.METADATA_KEY_GENRE));
+ String year = metadata.extractMetadata(MediaMetadataRetriever.METADATA_KEY_YEAR);
+ song.setYear(Integer.parseInt((year != null) ? year : "0"));
+ }
}
+ } catch(Exception e) {
+ Log.i(TAG, "Device doesn't properly support MediaMetadataRetreiver");
}
- } catch(Exception e) {
- Log.i(TAG, "Device doesn't properly support MediaMetadataRetreiver");
}
String msg = "";
|