private String getCover(AbstractSessionItem item) { String cover = null; // Only use grandparentThumb if it's present in the session item // and if the session item is not a music track if (!isBlank(item.getGrandparentThumb()) && !item.getClass().equals(Track.class)) { cover = item.getGrandparentThumb(); } else if (!isBlank(item.getThumb())) { cover = item.getThumb(); } if (!isBlank(cover)) { cover = addDefaultQueryParameters(String.format("%s%s", connection.getUri().toString(), cover)); } return cover; }
private void fillSession(PlexSession session, AbstractSessionItem item) { Player player = item.getPlayer(); session.setSessionKey(item.getSessionKey()); session.setState(PlexPlayerState.of(player.getState())); if (!isBlank(item.getGrandparentTitle())) { session.setTitle(item.getGrandparentTitle() + " - " + item.getTitle()); } else { session.setTitle(item.getTitle()); } session.setType(item.getType()); session.setMachineIdentifier(player.getMachineIdentifier()); if (isNumeric(item.getDuration())) { session.setDuration(Integer.valueOf(item.getDuration())); } session.setCover(getCover(item)); session.setKey(item.getKey()); }