aboutsummaryrefslogtreecommitdiff
path: root/subsonic-android
diff options
context:
space:
mode:
authorTom Briden <tom.briden@veritape.com>2013-06-05 08:33:40 +0100
committerTom Briden <tom.briden@veritape.com>2013-06-05 08:33:40 +0100
commit24bb93ce26cbe60fb2de373ddc914b8a74fe8ea2 (patch)
tree41c2ed90d2bf9bfcee33f3248d02b0978cafa5db /subsonic-android
parent240f7521c82f693863b3ba398d2a75a2d3b67399 (diff)
downloaddsub-24bb93ce26cbe60fb2de373ddc914b8a74fe8ea2.tar.gz
dsub-24bb93ce26cbe60fb2de373ddc914b8a74fe8ea2.tar.bz2
dsub-24bb93ce26cbe60fb2de373ddc914b8a74fe8ea2.zip
Revert "Moved metadata parsing back to createEntry, added disc number parsing"
This reverts commit 9e14459fb8691624febe20e9df3d35518c6ec422. This change made loading playlists while offline reallly slow
Diffstat (limited to 'subsonic-android')
-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, 17 insertions, 21 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java b/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java
index b8050bb2..d2f99d0b 100644
--- a/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java
+++ b/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java
@@ -172,27 +172,6 @@ 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 40bedad6..51927304 100644
--- a/subsonic-android/src/github/daneren2005/dsub/view/SongView.java
+++ b/subsonic-android/src/github/daneren2005/dsub/view/SongView.java
@@ -72,6 +72,23 @@ 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;