]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/videos.js
Video lib/model/reqvalidator refractoring
[github/Chocobozzz/PeerTube.git] / server / lib / videos.js
index 3c6ee4a650605a1b4ccad24bea60a191300fbb58..a5fe7b0c47fe7519e649ab7cd23491a8754b03a3 100644 (file)
@@ -12,10 +12,21 @@ var Videos = require('../models/videos')
 var uploadDir = path.join(__dirname, '..', '..', config.get('storage.uploads'))
 
 var videos = {
+  getVideoState: getVideoState,
   seed: seed,
   seedAllExisting: seedAllExisting
 }
 
+function getVideoState (video, callback) {
+  var exist = (video !== null)
+  var owned = false
+  if (exist === true) {
+    owned = (video.namePath !== null)
+  }
+
+  return callback({ exist: exist, owned: owned })
+}
+
 function seed (path, callback) {
   logger.info('Seeding %s...', path)