Merge pull request #977 from TomHennen/fix964

Don't send Gpodder actions for items that don't have media.

fixes #968
This commit is contained in:
Tom Hennen 2015-06-27 18:24:48 -04:00
commit 23f666a24d
2 changed files with 11 additions and 21 deletions

View File

@ -97,19 +97,6 @@ public class DefaultActionButtonCallback implements ActionButtonCallback {
} else {
if (!item.isRead()) {
DBWriter.markItemRead(context, item, true, true);
if(GpodnetPreferences.loggedIn()) {
// gpodder: send played action
FeedMedia media = item.getMedia();
GpodnetEpisodeAction action = new GpodnetEpisodeAction.Builder(item, GpodnetEpisodeAction.Action.PLAY)
.currentDeviceId()
.currentTimestamp()
.started(media.getDuration() / 1000)
.position(media.getDuration() / 1000)
.total(media.getDuration() / 1000)
.build();
GpodnetPreferences.enqueueEpisodeAction(action);
}
}
}
}

View File

@ -158,6 +158,8 @@ public class FeedItemMenuHandler {
DBWriter.markItemRead(context, selectedItem, true, false);
if(GpodnetPreferences.loggedIn()) {
FeedMedia media = selectedItem.getMedia();
// not all items have media, Gpodder only cares about those that do
if (media != null) {
GpodnetEpisodeAction actionPlay = new GpodnetEpisodeAction.Builder(selectedItem, Action.PLAY)
.currentDeviceId()
.currentTimestamp()
@ -167,6 +169,7 @@ public class FeedItemMenuHandler {
.build();
GpodnetPreferences.enqueueEpisodeAction(actionPlay);
}
}
break;
case R.id.mark_unread_item:
selectedItem.setRead(false);