M
M
MusicMan_082018-02-13 14:54:38
JavaScript
MusicMan_08, 2018-02-13 14:54:38

How to pass data to Kue?

Good afternoon.
I want to make a small service for converting video files on Node JS.
At the same time I want to learn a little programming in Node.
Essence of the question:
There is a watcher.js script:

var chokidar = require('chokidar');

var watcher = chokidar.watch('mediafiles', {
  ignored: /[\/\\]\./, persistent: true
});

var log = console.log.bind(console);

watcher
  .on('add', function(path) { log('File', path, 'has been added'); })
  .on('addDir', function(path) { log('Directory', path, 'has been added'); })
  .on('change', function(path) { log('File', path, 'has been changed'); })
  .on('unlink', function(path) { log('File', path, 'has been removed'); })
  .on('unlinkDir', function(path) { log('Directory', path, 'has been removed'); })
  .on('error', function(error) { log('Error happened', error); })
  .on('ready', function() { log('Initial scan complete. Ready for changes.'); })
  .on('raw', function(event, path, details) { log('Raw event info:', event, path, details); })

// 'add', 'addDir' and 'change' events also receive stat() results as second
// argument when available: http://nodejs.org/api/fs.html#fs_class_fs_stats
watcher.on('change', function(path, stats) {
  if (stats) console.log('File', path, 'changed size to', stats.size);
});

// Un-watch some files.
watcher.unwatch('/Users/slava/test_project/mediafiles/.DS_Store');

Next, when the video file gets into this folder, I want to transfer it to Kue and start converting using the ffmpeg script.
That's actually the question: how to transfer information to Kue that the file has been copied and you need to start converting the video?
Or have I taken the wrong approach altogether?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question