Set file size after downlaod

Fixes media size being unknown even if item is downloaded
This commit is contained in:
ByteHamster 2020-02-08 00:32:50 +01:00
parent 67971af3aa
commit ca4e5500f6
1 changed files with 2 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import android.util.Log;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import java.io.File;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import de.danoeh.antennapod.core.event.UnreadItemsUpdateEvent; import de.danoeh.antennapod.core.event.UnreadItemsUpdateEvent;
@ -50,6 +51,7 @@ public class MediaDownloadedHandler implements Runnable {
boolean broadcastUnreadStateUpdate = media.getItem() != null && media.getItem().isNew(); boolean broadcastUnreadStateUpdate = media.getItem() != null && media.getItem().isNew();
media.setDownloaded(true); media.setDownloaded(true);
media.setFile_url(request.getDestination()); media.setFile_url(request.getDestination());
media.setSize(new File(request.getDestination()).length());
media.checkEmbeddedPicture(); // enforce check media.checkEmbeddedPicture(); // enforce check
// check if file has chapters // check if file has chapters