Make sure episode contain media before adding them to queue

This commit is contained in:
txtd 2020-01-09 01:44:13 +01:00 committed by ByteHamster
parent ce659f5cb2
commit 7f1c24e26c

View File

@ -457,8 +457,15 @@ public class EpisodesApplyActionFragment extends Fragment {
}
private void queueChecked() {
DBWriter.addQueueItem(getActivity(), true, checkedIds.toArray());
close(R.plurals.added_to_queue_batch_label, checkedIds.size());
// Check if an episode actually contains any media files before adding it to queue
LongList toQueue = new LongList(checkedIds.size());
for (FeedItem episode : episodes) {
if (checkedIds.contains(episode.getId()) && episode.hasMedia()) {
toQueue.add(episode.getId());
}
}
DBWriter.addQueueItem(getActivity(), true, toQueue.toArray());
close(R.plurals.added_to_queue_batch_label, toQueue.size());
}
private void removeFromQueueChecked() {