aboutsummaryrefslogtreecommitdiff
path: root/subsonic-android/src/github/daneren2005
diff options
context:
space:
mode:
authorTom Briden <tom.briden@veritape.com>2013-06-05 08:55:17 +0100
committerTom Briden <tom.briden@veritape.com>2013-06-05 08:55:17 +0100
commit081cd153f539a9b0627ec0ceac7fd8e68608f54d (patch)
treeced597c36f455db16f94a5b1a0c12fc58580978f /subsonic-android/src/github/daneren2005
parent24bb93ce26cbe60fb2de373ddc914b8a74fe8ea2 (diff)
downloaddsub-081cd153f539a9b0627ec0ceac7fd8e68608f54d.tar.gz
dsub-081cd153f539a9b0627ec0ceac7fd8e68608f54d.tar.bz2
dsub-081cd153f539a9b0627ec0ceac7fd8e68608f54d.zip
readded discnumber parsing to SongView createEntry
Diffstat (limited to 'subsonic-android/src/github/daneren2005')
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/view/SongView.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/view/SongView.java b/subsonic-android/src/github/daneren2005/dsub/view/SongView.java
index 51927304..fc50ff79 100644
--- a/subsonic-android/src/github/daneren2005/dsub/view/SongView.java
+++ b/subsonic-android/src/github/daneren2005/dsub/view/SongView.java
@@ -79,6 +79,15 @@ public class SongView extends UpdateView implements Checkable {
try {
MediaMetadataRetriever metadata = new MediaMetadataRetriever();
metadata.setDataSource(file.getAbsolutePath());
+ String discNumber = metadata.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DISC_NUMBER);
+ if(discNumber == null) {
+ discNumber = "1/1";
+ }
+ int slashIndex = discNumber.indexOf("/");
+ if(slashIndex > 0) {
+ discNumber = discNumber.substring(0, slashIndex);
+ }
+ song.setDiscNumber(Integer.parseInt(discNumber));
String bitrate = metadata.extractMetadata(MediaMetadataRetriever.METADATA_KEY_BITRATE);
song.setBitRate(Integer.parseInt((bitrate != null) ? bitrate : "0") / 1000);
String length = metadata.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION);