summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorMartin Fietz <Martin.Fietz@gmail.com>2017-05-01 18:06:09 +0200
committerMartin Fietz <Martin.Fietz@gmail.com>2017-05-01 18:07:44 +0200
commit2a2b5fec9068917a150eec63fee4bbfd7f3a0fea (patch)
treefa4ede322abf4f3189f8a6aba26d9b197a2b6558 /core
parent932748ef701fc2b823e70c77646370f05447f47e (diff)
downloadAntennaPod-2a2b5fec9068917a150eec63fee4bbfd7f3a0fea.zip
Catch exception when reading duration via metadata retriever
Diffstat (limited to 'core')
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java
index 4a1047eb2..64f6ec774 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java
@@ -972,17 +972,18 @@ public class DownloadService extends Service {
// Get duration
MediaMetadataRetriever mmr = new MediaMetadataRetriever();
- mmr.setDataSource(media.getFile_url());
- String durationStr = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION);
+ String durationStr = null;
try {
+ mmr.setDataSource(media.getFile_url());
+ durationStr = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION);
media.setDuration(Integer.parseInt(durationStr));
Log.d(TAG, "Duration of file is " + media.getDuration());
} catch (NumberFormatException e) {
Log.d(TAG, "Invalid file duration: " + durationStr);
+ } catch(Exception e) {
+ Log.e(TAG, "Get duration failed", e);
} finally {
- if (mmr != null) {
- mmr.release();
- }
+ mmr.release();
}
final FeedItem item = media.getItem();