From 4990d95f33bd6abef19cb14ccc0dbe4d85c5414e Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Thu, 3 Oct 2024 21:14:44 +0200 Subject: [PATCH] Work around Android 5 returning 'null' duration for opus files (#7440) --- .../net/download/service/feed/local/LocalFeedUpdater.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/feed/local/LocalFeedUpdater.java b/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/feed/local/LocalFeedUpdater.java index e5c4fea08..5c70ba39a 100644 --- a/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/feed/local/LocalFeedUpdater.java +++ b/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/feed/local/LocalFeedUpdater.java @@ -194,6 +194,7 @@ public class LocalFeedUpdater { try { loadMetadata(item, file, context); } catch (Exception e) { + e.printStackTrace(); item.setDescriptionIfLonger(e.getMessage()); } return item; @@ -222,7 +223,9 @@ public class LocalFeedUpdater { } String durationStr = mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION); - item.getMedia().setDuration((int) Long.parseLong(durationStr)); + if (durationStr != null && !durationStr.equals("null")) { + item.getMedia().setDuration((int) Long.parseLong(durationStr)); + } item.getMedia().setHasEmbeddedPicture(mediaMetadataRetriever.getEmbeddedPicture() != null);