-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcc-cli.js
More file actions
executable file
·46 lines (43 loc) · 2.01 KB
/
Copy pathcc-cli.js
File metadata and controls
executable file
·46 lines (43 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env node
var fs = require('fs')
var theSlidesJSON = require('./cc/data/slides.json')
var myCsv = "videoTitle,url,id,start,stop"
console.log(`Going to log out all of the objectIDs of all of the slides, of which there are ${theSlidesJSON.slides.length}`);
for (var i = 0; i < theSlidesJSON.slides.length; i++) {
console.log(`working on slide ${i+1} which has ${theSlidesJSON.slides[i].pageElements.length} pageElements`);
for (var j = 0; j < theSlidesJSON.slides[i].pageElements.length; j++) {
if (theSlidesJSON.slides[i].pageElements[j].video) {
myCsv+=`\n${
theSlidesJSON.slides[i].pageElements[j].title
},${
theSlidesJSON.slides[i].pageElements[j].video.url
},${
theSlidesJSON.slides[i].pageElements[j].video.id
},${
theSlidesJSON.slides[i].pageElements[j].video.videoProperties.start ?
theSlidesJSON.slides[i].pageElements[j].video.videoProperties.start :
0
},${
theSlidesJSON.slides[i].pageElements[j].video.videoProperties.end ?
theSlidesJSON.slides[i].pageElements[j].video.videoProperties.end :
"END"
}`
// console.log(`element ${j} is a video`);
// console.log(`the title is ${theSlidesJSON.slides[i].pageElements[j].title}`);
// console.log(`the url is ${theSlidesJSON.slides[i].pageElements[j].video.url}`);
// console.log(`the start is ${
// theSlidesJSON.slides[i].pageElements[j].video.videoProperties.start ?
// theSlidesJSON.slides[i].pageElements[j].video.videoProperties.start :
// 0
// }`);
// console.log(`the end is ${
// theSlidesJSON.slides[i].pageElements[j].video.videoProperties.end ?
// theSlidesJSON.slides[i].pageElements[j].video.videoProperties.end :
// "the whole thing"
// }`);
}
}
}
console.log(myCsv);
fs.writeFileSync(`/Users/casey/Development/scripting-for-media-pros/cc/data/output.csv`, myCsv, {encoding: "utf8"});
console.log(`done`);