+
+// ---------------------------------------------------------------------------
+
+function checkVideoExists (id, res, callback) {
+ db.Video.loadAndPopulateAuthorAndPodAndTags(id, function (err, video) {
+ if (err) {
+ logger.error('Error in video request validator.', { error: err })
+ return res.sendStatus(500)
+ }
+
+ if (!video) return res.status(404).send('Video not found')
+
+ res.locals.video = video
+ callback()
+ })
+}