diff --git a/beem/cli.py b/beem/cli.py index 2de7923b00df95afbad74e31a2b6d21f19d27ce5..30c51a039393a6a1612ab9a045192517641b8943 100644 --- a/beem/cli.py +++ b/beem/cli.py @@ -44,6 +44,7 @@ from beemgraphenebase.account import PrivateKey, PublicKey, BrainKey from beemgraphenebase.base58 import Base58 from beem.nodelist import NodeList from beem.conveyor import Conveyor +from beem.imageuploader import ImageUploader from beem.rc import RC @@ -1485,6 +1486,27 @@ def beneficiaries(authorperm, beneficiaries): print(tx) +@cli.command() +@click.argument('image', nargs=1) +@click.option('--account', '-a', help='Account name') +@click.option('--image-name', '-n', help='Image name') +def uploadimage(image, account, image_name): + stm = shared_steem_instance() + if stm.rpc is not None: + stm.rpc.rpcconnect() + if not account: + account = stm.config["default_account"] + author = account + if not unlock_wallet(stm): + return + iu = ImageUploader(steem_instance=stm) + tx = iu.upload(image, account, image_name) + if image_name is None: + print("" % tx["url"]) + else: + print("" % (image_name, tx["url"])) + + @cli.command() @click.argument('body', nargs=1) @click.option('--account', '-a', help='Account are you posting from')