UNPKG

1.09 kBJavaScriptView Raw
1"use strict";
2
3var events = require("events");
4var util = require("util");
5var _ = require("underscore");
6var count = 0;
7
8var ccg = module.exports = function (host, port) {
9 events.EventEmitter.call(this);
10
11 this.options = _.extend({}, this.options);
12
13 if (typeof(host) == "string") {
14 this.options.host = host;
15 } else if (typeof(host) == "object") {
16 _.extend(this.options, host);
17 }
18
19 if (port) {
20 this.options.port = port;
21 }
22
23 this.index = count++;
24};
25
26util.inherits(ccg, events.EventEmitter);
27
28ccg.prototype.options = {
29 reconnect: true,
30 host: "localhost",
31 port: 5250,
32 debug: false
33};
34
35ccg.prototype.log = function () {
36 if (!this.options.debug) return;
37
38 var args = _.values(arguments);
39 args.unshift("CCG" + this.index + ":");
40
41 console.log.apply(console, args);
42};
43
44// connection management and command queing
45require("./lib/connection")(ccg);
46// query commands
47require("./lib/query")(ccg);
48// query commands
49require("./lib/playout")(ccg);
50// query data
51require("./lib/data")(ccg);
52// query templates
53require("./lib/template")(ccg);
54// mixer commands
55require("./lib/mixer")(ccg);