From ca4e5500f68f466e95fbf8fd682bc887de3a57e9 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Sat, 8 Feb 2020 00:32:50 +0100 Subject: [PATCH] Set file size after downlaod Fixes media size being unknown even if item is downloaded --- .../core/service/download/handler/MediaDownloadedHandler.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/handler/MediaDownloadedHandler.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/handler/MediaDownloadedHandler.java index 40be2895c..9ecabd14b 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/handler/MediaDownloadedHandler.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/handler/MediaDownloadedHandler.java @@ -6,6 +6,7 @@ import android.util.Log; import androidx.annotation.NonNull; +import java.io.File; import java.util.concurrent.ExecutionException; import de.danoeh.antennapod.core.event.UnreadItemsUpdateEvent; @@ -50,6 +51,7 @@ public class MediaDownloadedHandler implements Runnable { boolean broadcastUnreadStateUpdate = media.getItem() != null && media.getItem().isNew(); media.setDownloaded(true); media.setFile_url(request.getDestination()); + media.setSize(new File(request.getDestination()).length()); media.checkEmbeddedPicture(); // enforce check // check if file has chapters