Remove episode from queue when gpodder notifies as played (#4562)
This commit is contained in:
parent
3e147c97fe
commit
91f9c19bae
|
@ -39,6 +39,7 @@ import de.danoeh.antennapod.core.sync.model.ISyncService;
|
||||||
import de.danoeh.antennapod.core.sync.model.SubscriptionChanges;
|
import de.danoeh.antennapod.core.sync.model.SubscriptionChanges;
|
||||||
import de.danoeh.antennapod.core.sync.model.SyncServiceException;
|
import de.danoeh.antennapod.core.sync.model.SyncServiceException;
|
||||||
import de.danoeh.antennapod.core.sync.model.UploadChangesResponse;
|
import de.danoeh.antennapod.core.sync.model.UploadChangesResponse;
|
||||||
|
import de.danoeh.antennapod.core.util.LongList;
|
||||||
import de.danoeh.antennapod.core.util.URLChecker;
|
import de.danoeh.antennapod.core.util.URLChecker;
|
||||||
import de.danoeh.antennapod.core.util.gui.NotificationUtils;
|
import de.danoeh.antennapod.core.util.gui.NotificationUtils;
|
||||||
import io.reactivex.Completable;
|
import io.reactivex.Completable;
|
||||||
|
@ -456,7 +457,7 @@ public class SyncService extends Worker {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
LongList queueToBeRemoved = new LongList();
|
||||||
List<FeedItem> updatedItems = new ArrayList<>();
|
List<FeedItem> updatedItems = new ArrayList<>();
|
||||||
for (EpisodeAction action : mostRecentPlayAction.values()) {
|
for (EpisodeAction action : mostRecentPlayAction.values()) {
|
||||||
FeedItem playItem = DBReader.getFeedItemByUrl(action.getPodcast(), action.getEpisode());
|
FeedItem playItem = DBReader.getFeedItemByUrl(action.getPodcast(), action.getEpisode());
|
||||||
|
@ -467,10 +468,12 @@ public class SyncService extends Worker {
|
||||||
if (playItem.getMedia().hasAlmostEnded()) {
|
if (playItem.getMedia().hasAlmostEnded()) {
|
||||||
Log.d(TAG, "Marking as played");
|
Log.d(TAG, "Marking as played");
|
||||||
playItem.setPlayed(true);
|
playItem.setPlayed(true);
|
||||||
|
queueToBeRemoved.add(playItem.getId());
|
||||||
}
|
}
|
||||||
updatedItems.add(playItem);
|
updatedItems.add(playItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DBWriter.removeQueueItem(getApplicationContext(), false, queueToBeRemoved.toArray());
|
||||||
DBWriter.setItemList(updatedItems);
|
DBWriter.setItemList(updatedItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue