Workaround for issue #78: https://github.com/xbmc/Kore/issues/78
This commit is contained in:
parent
bed4b37b67
commit
5509c99243
|
@ -571,6 +571,25 @@ public class HostConnectionObserver
|
|||
notifySomethingIsPlaying(getActivePlayersResult, getPropertiesResult, getItemResult, observer);
|
||||
}
|
||||
}
|
||||
|
||||
// Workaround for when playing has started but time info isn't updated yet.
|
||||
// See https://github.com/xbmc/Kore/issues/78#issuecomment-104148064
|
||||
// If the playing time returned is 0sec, we'll schedule another check
|
||||
// to give Kodi some time to report the correct playing time
|
||||
if ((currentCallResult == PlayerEventsObserver.PLAYER_IS_PLAYING) &&
|
||||
(connection.getProtocol() == HostConnection.PROTOCOL_TCP) &&
|
||||
(getPropertiesResult.time.ToSeconds() == 0)) {
|
||||
LogUtils.LOGD(TAG, "Scheduling new call to check what's playing.");
|
||||
final int RECHECK_INTERVAL = 3000;
|
||||
checkerHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
forceReply = true;
|
||||
checkWhatsPlaying();
|
||||
}
|
||||
}, RECHECK_INTERVAL);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -43,6 +43,14 @@ public class GlobalType {
|
|||
minutes = JsonUtils.intFromJsonNode(node, MINUTES, 0);
|
||||
seconds = JsonUtils.intFromJsonNode(node, SECONDS, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the seconds from midnight that this time object represents
|
||||
* @return Seconds from midnight
|
||||
*/
|
||||
public int ToSeconds() {
|
||||
return hours * 3600 + minutes * 60 + seconds;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -72,7 +72,6 @@ public class NotificationService extends Service
|
|||
// We do not create any thread because all the works is supposed to
|
||||
// be done on the main thread, so that the connection observer
|
||||
// can be shared with the app, and notify it on the UI thread
|
||||
LogUtils.LOGD(TAG, "onCreate");
|
||||
|
||||
// Create the intent to start the remote when the user taps the notification
|
||||
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
|
||||
|
@ -359,7 +358,6 @@ public class NotificationService extends Service
|
|||
}
|
||||
|
||||
private PendingIntent buildActionPendingIntent(int playerId, String action) {
|
||||
LogUtils.LOGD(TAG, "Build action: " + action);
|
||||
Intent intent = new Intent(this, IntentActionsService.class)
|
||||
.setAction(action)
|
||||
.putExtra(IntentActionsService.EXTRA_PLAYER_ID, playerId);
|
||||
|
|
Loading…
Reference in New Issue