Don't allow downloading already downloaded episdoes again (#7076)

This commit is contained in:
ByteHamster 2024-04-09 22:33:31 +02:00 committed by GitHub
parent e578f4ca93
commit bd4e9e19d7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View File

@ -91,12 +91,14 @@ public class EpisodeMultiSelectActionHandler {
private void downloadChecked(List<FeedItem> items) {
// download the check episodes in the same order as they are currently displayed
int downloaded = 0;
for (FeedItem episode : items) {
if (episode.hasMedia() && !episode.getFeed().isLocalFeed()) {
if (episode.hasMedia() && !episode.isDownloaded() && !episode.getFeed().isLocalFeed()) {
DownloadServiceInterface.get().download(activity, episode);
downloaded++;
}
}
showMessage(R.plurals.downloading_batch_label, items.size());
showMessage(R.plurals.downloading_batch_label, downloaded);
}
private void deleteChecked(List<FeedItem> items) {

View File

@ -36,6 +36,9 @@ public class DownloadServiceInterfaceImpl extends DownloadServiceInterface {
}
public void download(Context context, FeedItem item) {
if (item.isDownloaded()) {
return;
}
OneTimeWorkRequest.Builder workRequest = getRequest(context, item);
workRequest.setConstraints(getConstraints());
WorkManager.getInstance(context).enqueueUniqueWork(item.getMedia().getDownloadUrl(),