def main(clear_conf=('c', False, 'Rewrite example config and noise'), dropbox_login=('d', False, 'Login to dropbox')): if dropbox_login: settings.dropbox_login() return if clear_conf: utils.install() return local_image = utils.screenshot() assert os.path.exists(local_image) filename = utils.get_filename() url = upload.upload(local_image, filename) print(url) utils.set_clipboard(url) conf = settings.get_conf() if conf.get('file').as_bool('keep'): dest_dir = os.path.expanduser(conf['file']['dir']) if not os.path.exists(dest_dir): os.mkdir(dest_dir) dest = os.path.join(dest_dir, filename) shutil.move(local_image, dest) else: os.unlink(local_image) if conf.get('upload').as_bool('noise'): utils.play_noise()
def get_conf(): if os.path.exists(confpath): return ConfigObj(confpath) else: print("Wrote example config to {0}".format(confpath)) utils.install()