Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var fs = require('fs');
- var parse = require('csv-parse');
- var transform = require('stream-transform');
- var output = [];
- var parser = parse({delimiter: ','})
- var input = fs.createReadStream('lines.csv');
- input.pipe(parser).pipe(transform(function(record, callback){
- var pos = record[3];
- var line = parseInt(record[0]);
- if(!pipes[pos]) { console.log('x ' + pos);
- pipes[pos] = {};
- pipes[pos][1999] = '------------------------------------------------';
- pipes[pos][2000] = '------------------- CENTRE ---------------------';
- pipes[pos][2001] = '------------------------------------------------';
- };
- pipes[pos][line-1] = '------------------------------------------------';
- if(line == 2000) {
- pipes[pos][line] = '---------------- LIGHT / CENTRE ----------------';
- } else {
- pipes[pos][line] = '-------------------- LIGHT ---------------------';
- }
- pipes[pos][line+1] = '------------------------------------------------';
- pipes[pos][line+3] = record[4];
- pipes[pos][line+4] = 'Universe: ' + record[1];
- pipes[pos][line+5] = 'DMX / Patch: ' + record[2];
- pipes[pos][line+6] = 'Offset: ' + record[5] + 'm';
- callback();
- }));
- var pipes = {};
- setTimeout(function() {
- for(var myPipe in pipes) {
- console.log(myPipe);
- for(var i = 1; i <= 4000; i++) {
- var line = pipes[myPipe][i];
- if(line) {
- fs.appendFileSync(myPipe + '.txt', line + '\n');
- } else {
- fs.appendFileSync(myPipe + '.txt', '\n');
- }
- }
- }
- }, 5000);
- /*
- Line,Universe,Address,Position,Type,X (From SL)
- 195,1,108,LX1,Strand Lighting Cantata 18/32,-6.69
- 967,1,112,LX1,1200 High Performance Fresnel,-3.83
- 1050,1,113,LX1,1200 High Performance Fresnel,-3.52
- 1137,1,115,LX1,Source 4 ,-3.2
- 1226,1,116,LX1,1200 High Performance Fresnel,-2.87
- 1323,1,117,LX1,1200 High Performance Fresnel,-2.51
- 1911,1,120,LX1,1200 High Performance Fresnel,-0.33
- 2000,1,121,LX1,Source 4 ,0
- 2086,1,122,LX1,1200 High Performance Fresnel,0.32
- 2691,1,125,LX1,1200 High Performance Fresnel,2.56
- 2780,1,126,LX1,1200 High Performance Fresnel,2.89
- 2863,1,127,LX1,Source 4 ,3.2
- 2950,1,129,LX1,1200 High Performance Fresnel,3.52
- 3031,1,130,LX1,1200 High Performance Fresnel,3.82
- 3781,1,134,LX1,Strand Lighting Cantata 18/32,6.6
- 724,2,428,Line 3,LED Strip HO,-4.73
- 1520,2,440,Line 3,LED Strip HO,-1.78
- 2451,2,452,Line 3,LED Strip HO,1.67
- 3274,2,464,Line 3,LED Strip HO,4.72
- 1393,1,379,Line 8,Pendant Bulb,-2.25
- 1503,1,380,Line 8,Pendant Bulb,-1.84
- 1614,1,381,Line 8,Pendant Bulb,-1.43
- 1725,1,382,Line 8,Pendant Bulb,-1.02
- 1835,1,383,Line 8,Pendant Bulb,-0.61
- 1946,1,384,Line 8,Pendant Bulb,-0.2
- 2054,1,385,Line 8,Pendant Bulb,0.2
- 2165,1,386,Line 8,Pendant Bulb,0.61
- 2275,1,387,Line 8,Pendant Bulb,1.02
- 2386,1,388,Line 8,Pendant Bulb,1.43
- 2497,1,389,Line 8,Pendant Bulb,1.84
- 2607,1,390,Line 8,Pendant Bulb,2.25
- 1393,1,367,Line 12,Pendant Bulb,-2.25
- 1503,1,368,Line 12,Pendant Bulb,-1.84
- 1614,1,369,Line 12,Pendant Bulb,-1.43
- 1725,1,370,Line 12,Pendant Bulb,-1.02
- 1835,1,371,Line 12,Pendant Bulb,-0.61
- 1946,1,372,Line 12,Pendant Bulb,-0.2
- 2054,1,373,Line 12,Pendant Bulb,0.2
- 2165,1,374,Line 12,Pendant Bulb,0.61
- 2275,1,375,Line 12,Pendant Bulb,1.02
- 2386,1,376,Line 12,Pendant Bulb,1.43
- 2497,1,377,Line 12,Pendant Bulb,1.84
- 2607,1,378,Line 12,Pendant Bulb,2.25
- 853,3,38,LX2,Mac 550,-4.25
- 969,1,144,LX2,1200 High Performance Fresnel,-3.82
- 1053,1,145,LX2,1200 High Performance Fresnel,-3.51
- 1137,1,147,LX2,Source 4 ,-3.2
- 1228,1,148,LX2,1200 High Performance Fresnel,-2.86
- 1323,1,149,LX2,1200 High Performance Fresnel,-2.51
- 1552,3,26,LX2,Honeycomb Mini,-1.66
- 1814,3,65,LX2,Mac 550,-0.69
- 1914,1,152,LX2,1200 High Performance Fresnel,-0.32
- 2000,1,153,LX2,Source 4 ,0
- 2084,1,154,LX2,1200 High Performance Fresnel,0.31
- 2183,3,92,LX2,Mac 550,0.68
- 2475,3,32,LX2,Honeycomb Mini,1.76
- 2688,1,158,LX2,1200 High Performance Fresnel,2.55
- 2777,1,159,LX2,1200 High Performance Fresnel,2.88
- 2863,1,160,LX2,Source 4 ,3.2
- 2947,1,161,LX2,1200 High Performance Fresnel,3.51
- 3028,1,162,LX2,1200 High Performance Fresnel,3.81
- 3139,3,119,LX2,Mac 550,4.22
- 915,2,404,Line 15,LED Strip HO,-4.02
- 3082,2,416,Line 15,LED Strip HO,4.01
- 1393,1,355,Line 16,Pendant Bulb,-2.25
- 1503,1,356,Line 16,Pendant Bulb,-1.84
- 1614,1,357,Line 16,Pendant Bulb,-1.43
- 1725,1,358,Line 16,Pendant Bulb,-1.02
- 1835,1,359,Line 16,Pendant Bulb,-0.61
- 1946,1,360,Line 16,Pendant Bulb,-0.2
- 2054,1,361,Line 16,Pendant Bulb,0.2
- 2165,1,362,Line 16,Pendant Bulb,0.61
- 2275,1,363,Line 16,Pendant Bulb,1.02
- 2386,1,364,Line 16,Pendant Bulb,1.43
- 2497,1,365,Line 16,Pendant Bulb,1.84
- 2607,1,366,Line 16,Pendant Bulb,2.25
- 1393,1,343,LX3,Pendant Bulb,-2.25
- 1503,1,344,LX3,Pendant Bulb,-1.84
- 1614,1,345,LX3,Pendant Bulb,-1.43
- 1725,1,346,LX3,Pendant Bulb,-1.02
- 1835,1,347,LX3,Pendant Bulb,-0.61
- 1946,1,348,LX3,Pendant Bulb,-0.2
- 2054,1,349,LX3,Pendant Bulb,0.2
- 2165,1,350,LX3,Pendant Bulb,0.61
- 2275,1,351,LX3,Pendant Bulb,1.02
- 2386,1,352,LX3,Pendant Bulb,1.43
- 2497,1,353,LX3,Pendant Bulb,1.84
- 2607,1,354,LX3,Pendant Bulb,2.25
- 516,1,174,LX4,PAR 64,-5.5
- 629,1,175,LX4,PAR 64,-5.08
- 1018,3,2,LX4,Honeycomb Mini,-3.64
- 1137,1,179,LX4,Source 4 ,-3.2
- 1557,1,183,LX4,PAR 64,-1.64
- 1655,3,8,LX4,Honeycomb Mini,-1.28
- 1765,1,184,LX4,PAR 64,-0.87
- 1997,1,185,LX4,Source 4 ,-0.01
- 2240,1,186,LX4,PAR 64,0.89
- 2343,3,14,LX4,Honeycomb Mini,1.27
- 2451,1,187,LX4,PAR 64,1.67
- 2866,1,190,LX4,Source 4 ,3.21
- 2966,3,20,LX4,Honeycomb Mini,3.58
- 3371,1,195,LX4,PAR 64,5.08
- 3490,1,196,LX4,PAR 64,5.52
- 1393,1,331,Line 24,Pendant Bulb,-2.25
- 1503,1,332,Line 24,Pendant Bulb,-1.84
- 1611,1,333,Line 24,Pendant Bulb,-1.44
- 1722,1,334,Line 24,Pendant Bulb,-1.03
- 1833,1,335,Line 24,Pendant Bulb,-0.62
- 1941,1,336,Line 24,Pendant Bulb,-0.22
- 2051,1,337,Line 24,Pendant Bulb,0.19
- 2162,1,338,Line 24,Pendant Bulb,0.6
- 2270,1,339,Line 24,Pendant Bulb,1
- 2380,1,340,Line 24,Pendant Bulb,1.41
- 2491,1,341,Line 24,Pendant Bulb,1.82
- 2602,1,342,Line 24,Pendant Bulb,2.23
- 1350,2,344,Line 25,Legend 230SR Beam,-2.41
- 1784,2,359,Line 25,Legend 230SR Beam,-0.8
- 2219,2,374,Line 25,Legend 230SR Beam,0.81
- 2650,2,389,Line 25,Legend 230SR Beam,2.41
- 1727,2,230,Line 28,MAC 301 Wash,-1.01
- 1838,2,249,Line 28,MAC 301 Wash,-0.6
- 1946,2,268,Line 28,MAC 301 Wash,-0.2
- 2054,2,287,Line 28,MAC 301 Wash,0.2
- 2162,2,306,Line 28,MAC 301 Wash,0.6
- 2273,2,325,Line 28,MAC 301 Wash,1.01
- 648,2,148,LX5,Titan 400i,-5.01
- 1099,2,152,LX5,Titan 400i,-3.34
- 1549,2,156,LX5,Titan 400i,-1.67
- 1781,2,176,LX5,Mac 550,-0.81
- 2003,1,65,LX5,Strand Lighting Cantata 18/32,0.01
- 2103,2,160,LX5,Titan 400i,0.38
- 2216,2,203,LX5,Mac 550,0.8
- 2451,2,164,LX5,Titan 400i,1.67
- 2901,2,168,LX5,Titan 400i,3.34
- 3352,2,172,LX5,Titan 400i,5.01
- 1137,2,73,Line 32,Legend 230SR Beam,-3.2
- 1568,2,88,Line 32,Legend 230SR Beam,-1.6
- 2000,2,103,Line 32,Legend 230SR Beam,0
- 2432,2,118,Line 32,Legend 230SR Beam,1.6
- 2863,2,133,Line 32,Legend 230SR Beam,3.2
- 921,2,1,Line 34,LED Strip HO,-4
- 1352,2,13,Line 34,LED Strip HO,-2.4
- 1784,2,25,Line 34,LED Strip HO,-0.8
- 2216,2,37,Line 34,LED Strip HO,0.8
- 2648,2,49,Line 34,LED Strip HO,2.4
- 3079,2,61,Line 34,LED Strip HO,4
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement