summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorByteHamster <ByteHamster@users.noreply.github.com>2024-10-03 21:14:44 +0200
committerGitHub <noreply@github.com>2024-10-03 21:14:44 +0200
commit4990d95f33bd6abef19cb14ccc0dbe4d85c5414e (patch)
tree19a452fff91138fc2c25e87bdd946edfc6e6038b
parent993a1eb171d8d51325db6add6ce7b8c84461f442 (diff)
downloadAntennaPod-4990d95f33bd6abef19cb14ccc0dbe4d85c5414e.zip
Work around Android 5 returning 'null' duration for opus files (#7440)
-rw-r--r--net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/feed/local/LocalFeedUpdater.java5
1 files changed, 4 insertions, 1 deletions
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);