Don't allow downloading already downloaded episdoes again (#7076)
This commit is contained in:
parent
e578f4ca93
commit
bd4e9e19d7
|
@ -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) {
|
||||
|
|
|
@ -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(),
|
||||
|
|
Loading…
Reference in New Issue