aboutsummaryrefslogtreecommitdiff
path: root/subsonic-android/src/github/daneren2005
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-06-10 06:23:23 -0700
committerScott Jackson <daneren2005@gmail.com>2013-06-10 06:23:23 -0700
commitbc2cb9c471472bb250a32a1a1beed89201e18ec7 (patch)
tree94ab247964ab607ef98875fdcd800ee1976efea3 /subsonic-android/src/github/daneren2005
parent6a7ce1c3963bc09ac56b90f2129d84e9dc730e1b (diff)
downloaddsub-bc2cb9c471472bb250a32a1a1beed89201e18ec7.tar.gz
dsub-bc2cb9c471472bb250a32a1a1beed89201e18ec7.tar.bz2
dsub-bc2cb9c471472bb250a32a1a1beed89201e18ec7.zip
Breaks stuff
Diffstat (limited to 'subsonic-android/src/github/daneren2005')
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java21
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/view/SongView.java17
2 files changed, 21 insertions, 17 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java b/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java
index 606eab88..17afbbcc 100644
--- a/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java
+++ b/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java
@@ -166,6 +166,27 @@ public class OfflineMusicService extends RESTMusicService {
// Failed parseInt, just means track filled out
}
}
+
+ 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);
+ }
+ entry.setDiscNumber(Integer.parseInt(discNumber));
+ String bitrate = metadata.extractMetadata(MediaMetadataRetriever.METADATA_KEY_BITRATE);
+ entry.setBitRate(Integer.parseInt((bitrate != null) ? bitrate : "0") / 1000);
+ String length = metadata.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION);
+ entry.setDuration(Integer.parseInt(length) / 1000);
+ metadata.release();
+ } catch(Exception e) {
+ Log.i(TAG, "Device doesn't properly support MediaMetadataRetreiver");
+ }
}
entry.setTitle(title);
diff --git a/subsonic-android/src/github/daneren2005/dsub/view/SongView.java b/subsonic-android/src/github/daneren2005/dsub/view/SongView.java
index 51927304..40bedad6 100644
--- a/subsonic-android/src/github/daneren2005/dsub/view/SongView.java
+++ b/subsonic-android/src/github/daneren2005/dsub/view/SongView.java
@@ -72,23 +72,6 @@ public class SongView extends UpdateView implements Checkable {
public void setSong(MusicDirectory.Entry song, boolean checkable) {
this.song = song;
- if(Util.isOffline(context)) {
- DownloadFile downloadFile = new DownloadFile(context, song, false);
- File file = downloadFile.getCompleteFile();
- if(file.exists()) {
- try {
- MediaMetadataRetriever metadata = new MediaMetadataRetriever();
- metadata.setDataSource(file.getAbsolutePath());
- 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);
- song.setDuration(Integer.parseInt(length) / 1000);
- } catch(Exception e) {
- Log.i(TAG, "Device doesn't properly support MediaMetadataRetreiver");
- }
- }
- }
-
StringBuilder artist = new StringBuilder(40);
String bitRate = null;