summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2015-03-20 13:47:01 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2015-03-20 13:47:01 (GMT)
commitea9a92cd7b0740a28b321c83f6082f2254d83b58 (patch)
treeb5a2162c5cf62f4daacf4ad107eed7b657335165
parent4cfd5c0b28a00a932f5ce69e050f3c8876d35d59 (diff)
downloadpublik-website-ea9a92cd7b0740a28b321c83f6082f2254d83b58.zip
publik-website-ea9a92cd7b0740a28b321c83f6082f2254d83b58.tar.gz
publik-website-ea9a92cd7b0740a28b321c83f6082f2254d83b58.tar.bz2
totally automate production of mini screens
However the result is currently buggy for Meyzieu and Montpellier (uncentered page content) (phantomjs 0.9.0).
-rw-r--r--static/img/sources/integrations-graphiques/capture.js12
-rw-r--r--static/img/sources/integrations-graphiques/generate.py34
2 files changed, 45 insertions, 1 deletions
diff --git a/static/img/sources/integrations-graphiques/capture.js b/static/img/sources/integrations-graphiques/capture.js
new file mode 100644
index 0000000..7225d0b
--- /dev/null
+++ b/static/img/sources/integrations-graphiques/capture.js
@@ -0,0 +1,12 @@
+var page = require('webpage').create();
+var system = require('system');
+
+var address = system.args[1];
+var filename = system.args[2];
+
+page.viewportSize = { width: 1100, height: 640 };
+page.clipRect = { top: 0, left: 0, width: page.viewportSize.width, height: page.viewportSize.height };
+page.open(address, function() {
+ page.render(filename);
+ phantom.exit();
+});
diff --git a/static/img/sources/integrations-graphiques/generate.py b/static/img/sources/integrations-graphiques/generate.py
index 9d6d105..6f87c26 100644
--- a/static/img/sources/integrations-graphiques/generate.py
+++ b/static/img/sources/integrations-graphiques/generate.py
@@ -3,8 +3,33 @@
import os
import subprocess
+captures = [
+ ('https://cournonterral.test-eservices.montpellier3m.fr/',
+ 'cournonterral.png'),
+ ('https://fabregues.eservices.montpellier3m.fr/',
+ 'fabregues.png'),
+ ('https://marcoussis.au-quotidien.com/etat-civil/copie-d-acte-de-naissance/',
+ 'marcoussis.png'),
+ ('https://meyzieu.au-quotidien.com/inscriptions/ramassage-des-accueils-de-loisirs-du-mercredi-inscription-mensuelle-1/',
+ 'meyzieu.png'),
+ ('https://eservices.montpellier3m.fr/',
+ 'montpellier.png'),
+ ('https://sussargues.test-eservices.montpellier3m.fr/',
+ 'sussargues.png'),
+ ('https://vendargues.test-eservices.montpellier3m.fr/',
+ 'vendargues.png'),
+ ('https://demarches.vincennes.fr/question/votre-question-jeunesse/',
+ 'vincennes.png'),
+ ]
+
svg_src = open('screen-with-capture.svg').read()
-for filename in os.listdir('captures'):
+for url, filename in captures:
+ print url
+ print 'creating capture'
+ subprocess.call(['phantomjs', '--ssl-protocol=any',
+ '--ignore-ssl-errors=yes', 'capture.js', url, 'captures/%s' % filename])
+
+ print 'putting it in a mini screen'
svg_dst = svg_src.replace('xxx.png', 'captures/%s' % filename)
svg_path = open('/tmp/.xxx.svg', 'w')
svg_path.write(svg_dst)
@@ -16,6 +41,13 @@ for filename in os.listdir('captures'):
'--export-png', 'screen-%s' % filename,
'--export-width', '250'])
+filenames = [x[1] for x in captures]
+
+
# gm montage screen-*.png -geometry +10+0 -tile 8x1 -background none ../screens.png
# +10+0 <- 10 is the margin
# 8x1 <- 8 is the number of images
+print 'assembling mini screens'
+subprocess.call(['gm', 'montage'] + ['screen-%s' % x for x in filenames] +
+ ['-geometry', '+10+0', '-tile', '%sx1' % len(captures),
+ '-background', 'none', '../../screens.png'])