intel-screenbot

An Ingress Intel Map Bot for Hangoutsbot
git clone git://archive.git.mtrnord.blog/MTRNord/intel-screenbot.git
Log | Files | Refs | README | LICENSE

commit 94644fed75b6a18f931d74b29dae1d8d43dfda7d
parent c7903021cc03e6598d7969c288753dd3209e28d0
Author: Marcel <MTRNord@users.noreply.github.com>
Date:   Sun, 13 Nov 2016 01:31:26 +0100

Check if plugins is defined
Diffstat:
M__init__.py | 30+++++++++++++++++++++---------
1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/__init__.py b/__init__.py @@ -85,16 +85,28 @@ def _get_lines(shell_command): def _screencap(maptype, url, filepath, filename, SACSID, CSRF, plugins, search, bot, event): loop = asyncio.get_event_loop() logger.info("screencapping {} and saving as {}".format(url, filepath)) - if search == False: - command = 'phantomjs hangupsbot/plugins/intel_screenbot/screencap_' + maptype + '.js "' + SACSID + '" "' + CSRF + '" "' + url + '" "' + filepath + '" "' + plugins + '"' - task = _get_lines(command) - task = asyncio.wait_for(task, 180.0, loop=self.loop) - exitcode, stdout = loop.run_until_complete(task) + if plugins is '': + if search == False: + command = 'phantomjs hangupsbot/plugins/intel_screenbot/screencap_' + maptype + '.js "' + SACSID + '" "' + CSRF + '" "' + url + '" "' + filepath + '"' + task = _get_lines(command) + task = asyncio.wait_for(task, 180.0, loop=self.loop) + exitcode, stdout = loop.run_until_complete(task) + else: + command = 'phantomjs hangupsbot/plugins/intel_screenbot/screencap_' + maptype + '.js "' + SACSID + '" "' + CSRF + '" "' + url + '" "' + filepath + '" "' + search + '"' + task = _get_lines(command) + task = asyncio.wait_for(task, 180.0, loop=loop) + exitcode, stdout = yield from task else: - command = 'phantomjs hangupsbot/plugins/intel_screenbot/screencap_' + maptype + '.js "' + SACSID + '" "' + CSRF + '" "' + url + '" "' + filepath + '" "' + search + '" "' + plugins + '"' - task = _get_lines(command) - task = asyncio.wait_for(task, 180.0, loop=loop) - exitcode, stdout = yield from task + if search == False: + command = 'phantomjs hangupsbot/plugins/intel_screenbot/screencap_' + maptype + '.js "' + SACSID + '" "' + CSRF + '" "' + url + '" "' + filepath + '" "' + plugins + '"' + task = _get_lines(command) + task = asyncio.wait_for(task, 180.0, loop=self.loop) + exitcode, stdout = loop.run_until_complete(task) + else: + command = 'phantomjs hangupsbot/plugins/intel_screenbot/screencap_' + maptype + '.js "' + SACSID + '" "' + CSRF + '" "' + url + '" "' + filepath + '" "' + search + '" "' + plugins + '"' + task = _get_lines(command) + task = asyncio.wait_for(task, 180.0, loop=loop) + exitcode, stdout = yield from task # read the resulting file into a byte array file_resource = yield from _open_file(filepath)