{"size": 1787, "ext": "js", "max_stars_repo_path": "videoservice/lib/index.js", "max_stars_repo_name": "PaintWithBob/paint-with-bob", "max_stars_repo_stars_event_min_datetime": "2018-02-08T18:13:37.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-28T07:39:00.000Z", "max_issues_repo_path": "videoservice/lib/index.js", "max_issues_repo_name": "PaintWithBob/paint-with-bob", "max_issues_repo_issues_event_min_datetime": "2018-02-08T01:04:41.000Z", "max_issues_repo_issues_event_max_datetime": "2018-05-26T00:51:07.000Z", "max_forks_repo_path": "videoservice/lib/index.js", "max_forks_repo_name": "PaintWithBob/paint-with-bob", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 5, "max_issues_count": 64, "max_forks_count": null, "avg_line_length": 25.8985507246, "max_line_length": 92, "alphanum_fraction": 0.6620033576}
// Public CLI like node file

// Our dependencies
const chalk = require('chalk');
const gradient = require('gradient-string');
const figlet = require('figlet');

// Require our server
const paintWithBobVideoServer = require('./server.js');

// Set up our minimist CLI
const argv = require('minimist')(process.argv.slice(2), {
  string: ['port', 'secret', 'name'],
  boolean: ['help'],
  alias: {
    h: 'help',
    p: 'port',
    s: 'secret',
    n: 'name'
  },
});

// Function to print our usage
/**
* Function to print the CLI Usage
*/
const printUsage = () => {
  console.log(`

    See Node Media Server ( https://www.npmjs.com/package/node-media-server )
    For Urls and tools to use the video service

    Usage:
      node index.js [Video Directory] [OPTIONS]
      Options:
        -h, --help    Print usage information
        -n, --name    Name of the stream (protocol://localhost/live/NAME)
        -p, --port    Port to receive http connections (http://localhost:PORT/live/NAME)
  `);
  process.exit();
}

// Print the header
console.log('');
const fonts = figlet.fontsSync();

const paintWithBobHeader = figlet.textSync("Paint With Bob Video", {
  font: fonts[Math.floor(fonts.length * Math.random())]
});

console.log(gradient('blue', 'green', 'red', 'cyan', 'purple', 'pink')(paintWithBobHeader));
console.log('');

// Check our CLI Input
if (argv.help || argv._.length != 1) {
  printUsage();
}

// Get our variables from the CLI
let VIDEO_DIRECTORY = argv._[0];
if(VIDEO_DIRECTORY.charAt(VIDEO_DIRECTORY.length - 1) !== "/") {
  VIDEO_DIRECTORY = VIDEO_DIRECTORY + "/"
}
const STREAM_NAME = argv.name || 'paintwithbob-1';
const PORT = argv.port || '8000';

paintWithBobVideoServer.initialize(VIDEO_DIRECTORY, STREAM_NAME, PORT);
paintWithBobVideoServer.startStream();
