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 f42d1cff7cc8686042f4b2cb18e27517937bf6d1
parent 5be33286bf5d4f9c7504aae440590c0c4ce828da
Author: Marcel <MTRNord@users.noreply.github.com>
Date:   Sun, 13 Nov 2016 00:12:50 +0100

Add experimental plugin name to url
Diffstat:
M__init__.py | 21++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/__init__.py b/__init__.py @@ -86,12 +86,12 @@ def _screencap(maptype, url, filepath, filename, SACSID, CSRF, plugins, search, 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 + '"' + 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 + '"' + 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 @@ -243,8 +243,23 @@ def iitc(bot, event, *args): logger.debug("temporary screenshot file: {}".format(filepath)) if bot.conversation_memory_get(event.conv_id, 'iitc_plugins'): - plugins = bot.conversation_memory_get(event.conv_id, 'iitc_plugins') + plugin_names = bot.conversation_memory_get(event.conv_id, 'iitc_plugins').split(", ") + if bot.memory.exists(["iitc_plugins"]): + plugins = [] + for plugin_objects in bot.memory.get_by_path(["iitc_plugins"]): + url_helper = [] + x = 0 + for attribute, value in plugin_objects.items(): + for plugin_name in plugin_names: + if attribute == "url": + url_helper.append(value) + if attribute == "name": + if value == plugin_name: + plugin = url_helper[x] + plugins.append(value) + x++ + logger.info(plugin) try: loop = asyncio.get_event_loop() image_data = yield from _screencap("iitc", url, filepath, filename, SACSID, CSRF, plugins, search, bot, event)