Explorar o código

Add local content generation script

Johannes Zellner %!s(int64=10) %!d(string=hai) anos
pai
achega
1617644e15
Modificáronse 2 ficheiros con 16 adicións e 1 borrados
  1. 1 1
      beam.js
  2. 15 0
      createContentLocal.js

+ 1 - 1
beam.js

@@ -29,7 +29,7 @@ $(function () {
             nextContentContainer.css('background-image', 'url("' + img + '")');
             nextContentContainer.css('background-repeat', random(['no-repeat', 'space', 'repeat']));
             nextContentContainer.css('background-size', random(['cover', 'contain', 'unset', '50%', '120%', '30%']));
-            
+
             curContentContainer.fadeOut();
             nextContentContainer.fadeIn();
 

+ 15 - 0
createContentLocal.js

@@ -0,0 +1,15 @@
+
+var fs = require('fs'),
+    path = require('path');
+
+var data = {
+    content: []
+};
+
+fs.readdir(path.resolve(__dirname, 'content'), function (error, result) {
+    if (error) return console.error(error);
+
+    data.content = result.filter(function (a) { return path.extname(a) !== '.mp4'; }).map(function (a) { return path.join('content', a); });
+
+    fs.writeFileSync('./content.json', JSON.stringify(data));
+});