diff --git a/.DS_Store b/.DS_Store index 03d3ec9..e30611e 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/.gitignore b/.gitignore index ee1bf26..6b00d0a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ .python-version workspace.code-workspace +metadata/*.json +images/*.png +.ipynb_checkpoints/ diff --git a/update_cid.ipynb b/update_cid.ipynb new file mode 100644 index 0000000..86cbf2c --- /dev/null +++ b/update_cid.ipynb @@ -0,0 +1,41 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from IPython.display import display \n", + "from PIL import Image\n", + "import random\n", + "import json\n", + "import os\n", + "\n", + "f = open('./metadata/all-objects.json')\n", + "all_images = json.load(f)\n", + "\n", + "cid = input(\"IPFS Image CID (): \")\n", + "if len(cid) > 0:\n", + " if not cid.startswith(\"ipfs://\"):\n", + " cid = \"ipfs://{}\".format(cid)\n", + " if cid.endswith(\"/\"):\n", + " cid = cid[:-1]\n", + " for i, item in enumerate(all_images):\n", + " with open('./metadata/' + str(item[\"tokenId\"]) + '.json', 'r') as infile:\n", + " original_json = json.loads(infile.read())\n", + " original_json[\"image\"] = original_json[\"image\"] = f'{cid}/{str(item[\"tokenId\"])}.png'\n", + " with open('./metadata/' + str(item[\"tokenId\"]) + '.json', 'w') as outfile:\n", + " json.dump(original_json, outfile, indent=4)" + ] + } + ], + "metadata": { + "language_info": { + "name": "python" + }, + "orig_nbformat": 4 + }, + "nbformat": 4, + "nbformat_minor": 2 +}