'use strict';

module.exports = {

  get: function(task) {
    return new Promise((resolve, reject) => {

      // Check type
      if ( task.type === undefined || ! ['show', 'move'].includes(task.type) ) {
        return reject('Invalid job type "' + task.type + '" specified');
      }

      // Get metadata, auth with trakt and get media information
      this.metadata.get(task.file).then((meta) => {
        task.meta = meta;
        return this[task.type](task.basename);
      }).then((info) => {
        task.details = info;
        return resolve(task);
      }).catch((err) => {
        return reject(err);
      });
    });
  },

  metadata: require('./metadata'),

  show: require('./show'),

  movie: require('./movie')
};

@@ -8,16 +8,282 @@
 rict';%0A%0A
+// Load requirements%0Aconst fs = require('fs'),%0A      path = require('path');%0A%0A// Define the config directory%0Alet configDir = path.resolve('./config');%0A%0A// Create config directory if we don't have one%0Aif ( ! fs.existsSync(configDir) ) %7B%0A  fs.mkdirSync(configDir);%0A%7D%0A%0A
 module.e

Create config directory if not present