def main(argv): args = docopt(__doc__, argv=argv) # import modules dynamically scrtool = args["--tool"] if args["--tool"] else CONFIG.get(CONFIG.general, "screenshot_tool") storage = args["--storage"] if args["--storage"] else CONFIG.get(CONFIG.general, "storage") scrtool = import_module("screenshot." + scrtool) storage = import_module("storage." + storage) # build filename file = "{}/instantscreen_{}.png".format(gettempdir(), strftime("%Y-%m-%d_%H-%I-%S")) # take screenshot if args["--whole"]: scrtool.take_screenshot_whole(file) else: scrtool.take_screenshot_crop(file) if not os.path.isfile(file): # Capture screen cancelled logging.debug("Screen capture cancelled.") return # upload to storage url = storage.upload(file) logging.info("Uploaded screenshot to: " + url) # execute user defined action if CONFIG.getboolean(CONFIG.general, "cb_autocopy"): import tools.clipboard as c c.Clipboard().set(url) else: import webbrowser as w w.open_new_tab(url) # notify user if set if CONFIG.getboolean(CONFIG.general, "notification_sound"): import tools.audio as a a.play_wave_file("res/notification.wav")