}
}
if (videoEntry != null) {
try {
YtPublicationState state = videoEntry.getPublicationState();
String stateValue;
if (state == null) {
// TODO: Find some way to check whether the video is embeddable and/or private, and
// populate that info. Because we're getting the video from the authenticated
// uploads feed (by default), that info isn't easily exposed on the videoEntry
// object. An alternative would be to get an instance from the public video feed
// and check that.
List<YouTubeMediaRating> ratings = videoEntry.getMediaGroup().getYouTubeRatings();
if (ratings.size() == 0) {
stateValue = "OKAY";
} else {
StringBuffer restrictionBuffer = new StringBuffer("RESTRICTED IN: ");
for (YouTubeMediaRating rating : ratings) {
restrictionBuffer.append(rating.getCountries());
}
stateValue = restrictionBuffer.toString();
}
} else {
stateValue = state.getState().toString();
}
if (!stateValue.equals(videoSubmission.getYouTubeState())) {
LOG.info(String.format("YouTube state differs: '%s' (local) vs. '%s' (YT).",
videoSubmission.getYouTubeState(), stateValue));
videoSubmission.setYouTubeState(stateValue);