From acbe6123d4e92a626ef253ba688e722a1fe44d3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Tue, 9 Jan 2018 11:51:09 +0100 Subject: [PATCH] captures: only reshoot if parameter is given --- static/img/sources/integrations-graphiques/generate.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/static/img/sources/integrations-graphiques/generate.py b/static/img/sources/integrations-graphiques/generate.py index 24742ec..6834933 100644 --- a/static/img/sources/integrations-graphiques/generate.py +++ b/static/img/sources/integrations-graphiques/generate.py @@ -2,6 +2,7 @@ import os import subprocess +import sys captures = [ ('https://cournonterral.test-eservices.montpellier3m.fr/', @@ -43,11 +44,12 @@ captures = [ svg_src = open('screen-with-capture.svg').read() 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]) + if '--reshoot' in sys.argv or not os.path.exists('captures/%s' % filename): + 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' + print 'putting capture 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)