Skip to content

Instantly share code, notes, and snippets.

@rcampbell
Created February 18, 2016 14:56
Show Gist options
  • Save rcampbell/7fb74a8fa6bbd5ac2f02 to your computer and use it in GitHub Desktop.
Save rcampbell/7fb74a8fa6bbd5ac2f02 to your computer and use it in GitHub Desktop.
@RequestMapping("zencoder.htm")
public void zen(final HttpServletRequest request, final HttpServletResponse response) throws AttachSystemFileException, IOException {
final String body = IOUtils.toString(request.getReader());
logger.info("Received Zencoder notification:\n" + body);
final Notification notification = zen.notification(body);
final Job job = notification.getJob();
final Output output = notification.getOutput();
final String filename = decodeLabel(output.getLabel());
if (job.isFinished()) {
logger.debug("zen CALL downloader.execute filename: " + filename);
downloader.execute(newDownloader(filename, notification));
} else if (job.isFailed()) {
videoService.encodingFailed(filename, output.getErrorMessage(), output.getErrorLink());
}
replyOk(response);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment