Example #1
0
function startRecording (window) {
  win = window // keep a reference for async operations, etc.

  // check frame size for mp4 recording
  if (config.getPreference('video_recording_codec') === 'h264') {
    if (win.getSize()[0] % 2 !== 0 || win.getSize()[1] % 2 !== 0) {
      win.rpc.emit('status:error', {
        'body': 'Window dimensions must be even numbers'
      })
      return
    }
  }

  // check if ffmpeg is around
  try {
    execSync('ffmpeg -h', 'ignore')
  } catch (err) {
    win.rpc.emit('status:error', {
      'body': 'Can\'t find ffmpeg'
    })
    return
  }

  win.setResizable(false)
  app.dock.setBadge('R')
  if (config.getPreference('hide_status_while_recording')) win.rpc.emit('status:hide')

  // video size
  const electronScreen = require('electron').screen
  let currentDisplay = electronScreen.getDisplayMatching(win.getBounds())
  let width = win.getSize()[0] * currentDisplay.scaleFactor
  let height = win.getSize()[1] * currentDisplay.scaleFactor
  let size = width + 'x' + height

  // name
  let name = 'o-recording-' + timestamp()

  let args = [
    // input
    '-y',
    '-f', 'rawvideo',             // no codec, just raw data
    '-s', size,
    '-framerate', 60,
    '-pix_fmt', 'rgb32',          // that's what electron gives us
    '-i', '-',
    '-vcodec', 'mjpeg',
    '-q:v', '2',                  // max out quality
    // output
    '-r', 30,                     // 30fps keeps the file size down
    '-pix_fmt', 'yuvj420p'        // legacy (?) fmt to enable preview in macOS
  ]

  // output format
  switch (config.getPreference('video_recording_codec')) {
    case 'h264':
      args.push(
        '-vcodec', 'libx264',     // h264 codec
        '-preset', 'slow'         // don't compromise quality for speed
      )
      args.push(app.getPath('downloads') + '/' + name + '.mp4')
      break
    case 'prores':
      args.push(
        '-vcodec', 'prores_ks'    // prores codec
      )
      args.push(app.getPath('downloads') + '/' + name + '.mov')
      break
  }

  imageStream = new stream.PassThrough()

  ffmpeg = spawn('ffmpeg', args)
  imageStream.pipe(ffmpeg.stdin)

  status = 'recording'
  menus.refresh()
  win.rpc.emit('recorder:start')
  console.log(win.webContents.isOffscreen())
  win.webContents.beginFrameSubscription(addFrame)

  showTray()
  console.log('[recorder] Recording...')
}
Example #2
0
            setTimeout(() => {

                stream.write('ghijkl');
                stream.end();
            }, 100);
Example #3
0
File: server.js Project: 4yu/hapi
            setTimeout(function () {

                s.emit('end');
            }, 40);
Example #4
0
const Player = function() {
	var _this = this;
	var passThru$ = new stream.PassThrough();
	var reader;
	var speaker;
	var Play = cp.fork('./Play.js');
	this.events = {};
	this.on = function(name, fn) {
		var _this = this;
		_this.events[name] = fn;
	}
	this.off = function(name){
		var _this = this;
		delete _this.events[name];
	}

	this.Pause = function() {
		if(passThru$){
			passThru$.pause();
		}
	}
	this.Stop = function() {
		destroy();
	}

	var format = function(format) {
		speaker = new Speaker(format);
		reader.pipe(speaker);
		if(_this.events['format']) { _this.events['format'](format);}
	}

	var destroy = function() {
	 	if(passThru$) passThru$.unpipe();
		reader = null;
		passThru$ = null;
		speaker = null;
		if(_this.events['end']) { _this.events['end']();}
	}

	var error = function(err){}
	var progress = function(progress){}
	var decoded = function() {}
	
	this.Play = function(file) {
		console.log(file);
		try{
			Play.send(file);
			Play.on('message', function(obj){
			    if(obj.Type === 'end') {		
					if(_this.events['end']) { _this.events['end']();}
				} else if(obj.Type === 'progress') {
					if(_this.events['end']) { _this.events['progress'](obj.Data);}
				}
			});
		} catch(err) { console.log('ERROR', err);}

	//	var ls = run('node Play.js', [JSON.stringify(file)], { stdio : ['pipe', 'pipe', 'pipe']});
//
//		ls.stdout.on('data', (d) => console.log(d));
//		ls.stderr.on('data', (d) => console.log(d));
//		ls.on('close', (d) => console.log(d));
	} 
	return this;
}
Example #5
0
Tables.prototype.parse = function() {
  var thisTables = this;
  var bar = this.bar();
  var parsedCount = 0;
  var parsedByteCount = 0;
  var info = (this.data && this.data[this.options.id]) ? this.data[this.options.id] : undefined;
  var tickStart = 0;
  var tickStarted = false;
  var options = {};
  var persistentOptions;
  var b;
  var s;

  // Output head
  this.output.heading("Streaming");

  // Reset batch
  this.batch = [];

  // Attach autoparser; helpful for custom parsing
  this.autoParser = autoParser;

  // Create stream
  if (!this.options.stdin) {
    this.output.item("Streaming: " + this.options.input);

    // Check if we should start from middle.  Works for CSV for now, as JSON
    // requires a begninng string.  Or resumable set to true.  TODO: get JSON resume to work
    if (!this.options.restart && info && info.current && info.current < info.total &&
      (this.options.inputType === "csv" || this.options.resumable)) {
      options.start = parsedByteCount = info.current;
      options.end = info.total;
      this.options.inputOptions = _.defaultsDeep(info.inputOptions, this.options.inputOptions);
      tickStart = info.current;
    }

    // Create stream
    s = fs.createReadStream(this.options.input, options);
  }
  else {
    this.output.item("Streaming stdin");

    // Create stream from what was buffered
    b = new stream.PassThrough();
    b.end(Buffer.concat(this.guessBuffers));

    // Merge with anything that is left.
    s = b;
    if (!thisTables.guessStream.destroyed) {
      s = merge(b, thisTables.guessStream);
    }
  }

  // On streaming data, update bar and counts
  s.on("data", function(data) {
    parsedByteCount = parsedByteCount + data.length;
    bar.tick((!tickStarted) ? tickStart + data.length : data.length);
    tickStarted = true;
  });

  // On end, update output
  s.on("end", function() {
    if (!bar.complete) {
      bar.terminate();
    }

    thisTables.output.item("Streaming done");
  });

  // Handle error
  s.on("error", function(error) {
    thisTables.done(new Error(error));
  });

  // Add main parser
  s.pipe(this.inputParser())
    .on("data", function(data) {
      // To resume a stream, we need to save the headers
      persistentOptions = persistentOptions ||
        ((thisTables.options.inputType === "csv") ? { headers: _.keys(data) } : {});
      var parsed = data;

      // Parse with autoparser
      if (thisTables.options.autoparse) {
        parsed = autoParser(data, thisTables.options.models, {
          dateFormat: thisTables.options.dateFormat,
          datetimeFormat: thisTables.options.datetimeFormat
        });
      }

      // Check for custom parser
      if (_.isFunction(thisTables.options.parser)) {
        parsed = _.bind(thisTables.options.parser, thisTables)(parsed, data);
      }

      // In case of bad data
      if (!parsed) {
        return;
      }

      // Insert into database (as needed)
      thisTables.insertBatch(parsed, s, this, parsedByteCount, persistentOptions, false);

      // Track rows
      parsedCount++;
      if (bar.rows) {
        bar.rows(parsedCount);
      }
    })
    .on("end", function() {
      thisTables.insertBatch(null, s, this, parsedByteCount, persistentOptions, true);

      // Complete bar
      if (!bar.complete) {
        bar.terminate();
      }
      thisTables.output.item("Parsing done");
      thisTables.done(null);
    })
    .on("error", function(error) {
      thisTables.done(new Error(error));
    });
};
Example #6
0
function RefUnrefFilter(context) {
  PassThrough.call(this);
  this.context = context;
  this.context.ref();
  this.unreffedYet = false;
}
Example #7
0
function FakeInput() {
  PassThrough.call(this);
}
Example #8
0
 lstream.on('error', function(err) {
   self.logger.error({err: err}, 'search error: @{err.message}');
   stream.end();
 });
Example #9
0
File: mic.js Project: DerKorb/mic
var mic = function mic(options) {
    options = options || {};
    var that = {};
    var endian = options.endian || 'little';
    var bitwidth = options.bitwidth || '16';
    var encoding = options.encoding || 'signed-integer';
    var rate = options.rate || '16000';
    var bufferSize = options.bufferSize || 2048;
    var channels = options.channels || '1';
    var device = options.device || 'plughw:1,0';
    var exitOnSilence = options.exitOnSilence || 0;
    var fileType = options.fileType || 'raw';
    var debug = options.debug || false;
    var format, formatEndian, formatEncoding;
    var audioProcess = null;
    var infoStream = new PassThrough;
    var audioStream = new IsSilence({debug: debug});
    var audioProcessOptions = {
        stdio: ['ignore', 'pipe', 'ignore']
    };

    if(debug) {
        audioProcessOptions.stdio[2] = 'pipe';
    }

    // Setup format variable for arecord call
    if(endian === 'big') {
        formatEndian = 'BE';
    } else {
        formatEndian = 'LE';
    }
    if(encoding === 'unsigned-integer') {
        formatEncoding = 'U';
    } else {
        formatEncoding = 'S';
    }
    format = formatEncoding + bitwidth + '_' + formatEndian;
    audioStream.setNumSilenceFramesExitThresh(parseInt(exitOnSilence, 10));
        
    that.start = function start() {
        if(audioProcess === null) {
            audioProcess = isMac
            ? spawn('rec', ['-b', bitwidth, '--endian', endian, '-c', channels, '-r', rate, '-e', encoding, '-t', fileType, '-'], audioProcessOptions)
            : spawn('arecord', ['-c', channels, '-r', rate, '-f', format, '-D', device, '--buffer-size', bufferSize], audioProcessOptions);
            audioProcess.on('exit', function(code, sig) {
                    if(code != null && sig === null) {
                        audioStream.emit('audioProcessExitComplete');
                        if(debug) console.log("recording audioProcess has exited with code = %d", code);
                    }
                });
            audioProcess.stdout.pipe(audioStream);
            if(debug) {
                audioProcess.stderr.pipe(infoStream);
            }
            audioStream.emit('startComplete');
        } else {
            if(debug) {
                throw new Error("Duplicate calls to start(): Microphone already started!");
            }
        }
    };

    that.stop = function stop() {
        if(audioProcess != null) {
            audioProcess.kill('SIGTERM');
            audioProcess = null;
            audioStream.emit('stopComplete');
            if(debug) console.log("Microhphone stopped");
        }
    };

    that.pause = function pause() {
        if(audioProcess != null) {
            audioProcess.kill('SIGSTOP');
            audioStream.pause();
            audioStream.emit('pauseComplete');
            if(debug) console.log("Microphone paused");
        }
    };

    that.resume = function resume() {
        if(audioProcess != null) {
            audioProcess.kill('SIGCONT');
            audioStream.resume();
            audioStream.emit('resumeComplete');
            if(debug) console.log("Microphone resumed");
        }
    }

    that.getAudioStream = function getAudioStream() {
        return audioStream;
    }

    if(debug) {
        infoStream.on('data', function(data) {
                console.log("Received Info: " + data);
            });
        infoStream.on('error', function(error) {
                console.log("Error in Info Stream: " + error);
            });
    }

    return that;
}
Example #10
0
 zs.on('error', function (er) { ostream.emit('error', er) })
Example #11
0
 process.nextTick(function () {
   s.write('bar')
 })
Example #12
0
 parseTemplate = () => {
     const st = new PassThrough();
     st.statusCode = '503';
     st.end('');
     return st;
 };
Example #13
0
 setImmediate(() => st.emit('error', 'Something bad happened'));
Example #14
0
 mockTemplate.returns(() => {
     const st = new PassThrough();
     setImmediate(() => st.emit('error', 'Something bad happened'));
     return st;
 });
 setTimeout(() => {
     readStream.emit('response', {
         statusCode: 404,
         statusMessage: 'TEST MESSAGE - 404',
     });
 }, 10);
Example #16
0
 req.addListener("data", function(data){
     bstr += data.toString("binary");
     stream.write(data);
 });
    it('publishes an analysis on the complexity trend for a given javascript file in the repository', function(done) {
      var revisionStream1 = new stream.PassThrough();
      var revisionStream2 = new stream.PassThrough();

      mockVcs.revisions.and.returnValue([
        { revisionId: 123, date: '2015-04-29T23:00:00.000Z' },
        { revisionId: 456, date: '2015-05-04T23:00:00.000Z' }
      ]);
      mockVcs.showRevisionStream.and.returnValues(revisionStream1, revisionStream2);

      runtime = cfHelpers.runtimeSetup(javascriptTasks, null, { dateFrom: '2015-03-01', targetFile: 'test_abs.js' });

      runtime.executePromiseTask('javascript-complexity-trend-analysis').then(function(taskOutput) {
        return Bluebird.all([
            taskOutput.assertOutputReport('2015-03-01_2015-10-22_complexity-trend-data.json', [
            { revision: 123, date: '2015-04-29T23:00:00.000Z', path: 'test_abs.js', totalComplexity: 2, averageComplexity: 1, methodComplexity: [{ name: 'abs', complexity: 1 }] },
            { revision: 456, date: '2015-05-04T23:00:00.000Z', path: 'test_abs.js', totalComplexity: 3, averageComplexity: 2, methodComplexity: [{ name: 'abs', complexity: 2 }] }
          ]),
          taskOutput.assertManifest({
            reportName: 'complexity-trend',
            parameters: { targetFile: 'test_abs.js' },
            dateRange: '2015-03-01_2015-10-22',
            enabledDiagrams: ['total', 'func-mean', 'func-sd']
          })
        ]);
      })
      .then(done)
      .catch(done.fail);

      revisionStream1.push("function abs(a,b) {\n");
      revisionStream2.push("function abs(a,b) {\n");
      revisionStream2.push("if (a < b) {\n;");
      revisionStream2.push("return b - a;\n};\n");
      revisionStream1.push("return a - b;\n};");
      revisionStream1.end();
      revisionStream2.push("return a - b;\n");
      revisionStream2.push("};\n");
      revisionStream2.end();
    });
Example #18
0
 req.addListener("end", function(){
     stream.end();
     callback({bstr,stream});
 });
Example #19
0
 step(function () {
     var input = new stream.PassThrough()
     input.end('a=1', 'utf8')
     once(step, 'fixtures//verb', ['put'], input)
 }, function (response) {
Example #20
0
 contentChunks.forEach(function(item) {
   fakeStream.write(new Buffer(item));
 });
	fixture.forEach(i => pre.write(i));
Example #22
0
 solClient.on('end', function() {
     var head = Buffer.concat(solBufs).toString('binary').split('\r\n')[0];
     solutionOut.write(head);
     solutionOut.end();
 });
Example #23
0
	this.Pause = function() {
		if(passThru$){
			passThru$.pause();
		}
	}
Example #24
0
 setImmediate(function() {
   stream.end('corns')
 })
Example #25
0
            setTimeout(() => {

                stream.write(new Buffer('ghijkl'));
                stream.end();
            }, 100);
Example #26
0
test('cli', function(t) {
  var help = ['-h', '--help']
  var version = ['-v', '--version']
  var stream

  t.plan(10)

  execa('./cli.js', ['syllables']).then(function(result) {
    t.equal(result.stdout, '3', 'Should accept an argument')
  }, t.ifErr)

  execa('./cli.js', ['syllables', 'unicorns']).then(function(result) {
    t.equal(result.stdout, '6', 'Should accept arguments')
  }, t.ifErr)

  execa('./cli.js', ['syllables unicorns']).then(function(result) {
    t.equal(result.stdout, '6', 'Should accept values')
  }, t.ifErr)

  execa('./cli.js', ['  ']).then(
    function() {},
    function(error) {
      t.equal(error.code, 1, 'should exit with `1` without input')
      t.ok(
        /\s*Usage: syllable \[options] <words...>/.test(error.stderr),
        'Should emit the help message'
      )
    }
  )

  help.forEach(function(flag) {
    execa('./cli.js', [flag]).then(function(result) {
      t.ok(
        /\s*Usage: syllable \[options] <words...>/.test(result.stdout),
        'Should accept `' + flag + '`'
      )
    }, t.ifErr)
  })

  version.forEach(function(flag) {
    execa('./cli.js', [flag]).then(function(result) {
      t.equal(result.stdout, pack.version, 'Should accept `' + flag + '`')
    }, t.ifErr)
  })

  stream = new Stream()

  execa('./cli.js', {input: stream}).then(function(result) {
    t.equal(result.stdout, '6', 'Should accept stdin')
  }, t.ifErr)

  setImmediate(function() {
    stream.write('syllab')

    setImmediate(function() {
      stream.write('les uni')

      setImmediate(function() {
        stream.end('corns')
      })
    })
  })
})
Example #27
0
            setTimeout(() => {

                stream.write({ a: 3, b: '4' });
                stream.end();
            }, 100);
Example #28
0
                setTimeout(function () {

                    ended = true;
                    s.emit('end');
                }, 150);
Example #29
0
function request() {
  // https://github.com/mscdex/busboy/blob/master/test/test-types-multipart.js

  var stream = new Stream.PassThrough()

  stream.headers = {
    'content-type': 'multipart/form-data; boundary=---------------------------paZqsnEHRufoShdX6fh0lUhXBP4k'
  }

  stream.write([
    '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k',
    'Content-Disposition: form-data; name="file_name_0"',
    '',
    'super alpha file',
    '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k',
    'Content-Disposition: form-data; name="file_name_0"',
    '',
    'super beta file',
    '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k',
    'Content-Disposition: form-data; name="file_name_0"',
    '',
    'super gamma file',
    '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k',
    'Content-Disposition: form-data; name="file_name_1"',
    '',
    'super gamma file',
    '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k',
    'Content-Disposition: form-data; name="_csrf"',
    '',
    'ooxx',
    '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k',
    'Content-Disposition: form-data; name="hasOwnProperty"',
    '',
    'super bad file',

    '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k',
    'Content-Disposition: form-data; name="someCollection[0][foo]"',
    '',
    'foo',
    '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k',
    'Content-Disposition: form-data; name="someCollection[0][bar]"',
    '',
    'bar',
    '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k',
    'Content-Disposition: form-data; name="someCollection[1][0]"',
    '',
    'foo',
    '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k',
    'Content-Disposition: form-data; name="someCollection[1][1]"',
    '',
    'bar',
    '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k',
    'Content-Disposition: form-data; name="someField[foo]"',
    '',
    'foo',
    '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k',
    'Content-Disposition: form-data; name="someField[bar]"',
    '',
    'bar',

    '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k',
    'Content-Disposition: form-data; name="upload_file_0"; filename="1k_a.dat"',
    'Content-Type: application/octet-stream',
    '',
    'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB',
    '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k',
    'Content-Disposition: form-data; name="upload_file_2"; filename="hack.exe"',
    'Content-Type: application/octet-stream',
    '',
    'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
    '-----------------------------paZqsnEHRufoShdX6fh0lUhXBP4k--'
  ].join('\r\n'))

  return stream
}
 command.on('end', function() {
   console.log('Sox command Ended!');
   currentStream.end();
   currentStream.finish();
   res.status(200).json({ Sox: 'Sox command Ended!' });
 });