From 691b2f792ea5f171a8b50766721b1188edf758cd Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Fri, 28 Mar 2014 19:57:58 -0700 Subject: Fix for when people have non numbers in disc number field --- src/github/daneren2005/dsub/domain/MusicDirectory.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/github/daneren2005') diff --git a/src/github/daneren2005/dsub/domain/MusicDirectory.java b/src/github/daneren2005/dsub/domain/MusicDirectory.java index f3521252..fefbb682 100644 --- a/src/github/daneren2005/dsub/domain/MusicDirectory.java +++ b/src/github/daneren2005/dsub/domain/MusicDirectory.java @@ -145,7 +145,11 @@ public class MusicDirectory implements Serializable { if(slashIndex > 0) { discNumber = discNumber.substring(0, slashIndex); } - setDiscNumber(Integer.parseInt(discNumber)); + try { + setDiscNumber(Integer.parseInt(discNumber)); + } catch(Exception e) { + Log.w(TAG, "Non numbers in disc field!"); + } String bitrate = metadata.extractMetadata(MediaMetadataRetriever.METADATA_KEY_BITRATE); setBitRate(Integer.parseInt((bitrate != null) ? bitrate : "0") / 1000); String length = metadata.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION); @@ -160,7 +164,7 @@ public class MusicDirectory implements Serializable { } metadata.release(); } catch(Exception e) { - Log.i(TAG, "Device doesn't properly support MediaMetadataRetreiver"); + Log.i(TAG, "Device doesn't properly support MediaMetadataRetreiver", e); } } -- cgit v1.2.3