totally automate production of mini screens
However the result is currently buggy for Meyzieu and Montpellier (uncentered page content) (phantomjs 0.9.0).
This commit is contained in:
parent
4cfd5c0b28
commit
ea9a92cd7b
|
@ -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();
|
||||
});
|
|
@ -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'])
|
||||
|
|
Loading…
Reference in New Issue