0.0.1 • Published 5 years ago

pdoc-parser v0.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

pdoc-parser

Parses e:cue pdoc xml files to a javascript object.

Installation

npm install --save pdoc-parser

Usage

const Pdoc = require('pdoc-parser');
const fs = require('fs');

const pdocXml = fs.readFileSync('test-data/test.pdoc').toString();
const patch = Pdoc(pdocXml);

Sample object

{ sections:
   [ { name: 'Section#1',
       comment: '',
       sizeX: 10000,
       sizeY: 7500,
       bGLocked: false,
       zoom: 0.0564475,
       gridX: 250,
       gridY: 250,
       viewX: 4995.79,
       viewY: 3755.7,
       originX: 0,
       originY: 0,
       originZ: 0,
       rotationX: 0,
       rotationY: 0,
       rotationZ: 0,
       canvas: { left: 0, top: 0, right: 8000, bottom: 6000, width: 800, height: 600 } } ],
  fixtures:
   [ { id: 1,
       name: 'RGB',
       manufacturer: 'Generic',
       posX: 1000,
       posY: 1000,
       rotation: 0,
       comment: '',
       width: 100,
       height: 100,
       universeId: 1,
       dmxAddress: 1,
       screenId: 1,
       displayName: 'Unit',
       linkedTo: NaN,
       matrix: null,
       section: { name: 'Section#1' } },
     { id: 2,
       name: 'RGB',
       manufacturer: 'Generic',
       posX: 1250,
       posY: 1000,
       rotation: 0,
       comment: '',
       width: 100,
       height: 100,
       universeId: 1,
       dmxAddress: 4,
       screenId: 2,
       displayName: 'Unit',
       linkedTo: NaN,
       matrix: null,
       section: { name: 'Section#1' } },
     { id: 179,
       name: 'RGB',
       manufacturer: 'Generic',
       posX: 2750,
       posY: 1000,
       rotation: 0,
       comment: '',
       width: 100,
       height: 100,
       universeId: 2,
       dmxAddress: 22,
       screenId: 8,
       displayName: 'Unit',
       linkedTo: NaN,
       matrix: { id: 178 },
       section: { name: 'Section#1' } },
     { id: 180,
       name: 'RGB',
       manufacturer: 'Generic',
       posX: 3200,
       posY: 1000,
       rotation: 0,
       comment: '',
       width: 100,
       height: 100,
       universeId: 2,
       dmxAddress: 28,
       screenId: 9,
       displayName: 'Unit',
       linkedTo: 181,
       matrix: { id: 178 },
       section: { name: 'Section#1' } },
     { id: 181,
       name: 'RGB',
       manufacturer: 'Generic',
       posX: 2750,
       posY: 1450,
       rotation: 0,
       comment: '',
       width: 100,
       height: 100,
       universeId: 2,
       dmxAddress: 25,
       screenId: 10,
       displayName: 'Unit',
       linkedTo: 179,
       matrix: { id: 178 },
       section: { name: 'Section#1' } },
     { id: 182,
       name: 'RGB',
       manufacturer: 'Generic',
       posX: 3200,
       posY: 1450,
       rotation: 0,
       comment: '',
       width: 100,
       height: 100,
       universeId: 2,
       dmxAddress: 31,
       screenId: 11,
       displayName: 'Unit',
       linkedTo: 180,
       matrix: { id: 178 },
       section: { name: 'Section#1' } },
     { id: 188,
       name: 'Dskch',
       manufacturer: 'Generic',
       posX: 2000,
       posY: 1000,
       rotation: 0,
       comment: '',
       width: 100,
       height: 100,
       universeId: 2,
       dmxAddress: 37,
       screenId: 13,
       displayName: 'Unit',
       linkedTo: NaN,
       matrix: null,
       section: { name: 'Section#1' } } ],
  labels:
   [ { id: 183,
       text: 'RGB Matrix',
       posX: 3000,
       posY: 1750,
       rotation: 0,
       comment: '',
       font: { align: 'near', face: 'Arial', height: 120, style: 0, color: 0 } } ],
  devices:
   [ { name: 'Butler XT2',
       type: 'dmx_butler_xt2',
       typeDisplayName: 'Butler XT2',
       id: 'dmx_butler_xt2@00-16-1c-f1-46-eb',
       ipAddress: '192.168.123.1',
       macAddress: '00-16-1c-f1-46-eb',
       dmxPorts: [ { universe: 1, port: null }, { universe: 2, port: 1 } ],
       deviceId: null } ] }