infotrex / bulk-upload-to-opensea

BULK UPLOAD NFTs to OPENSEA
276 stars 202 forks source link

Code for Attributes from Blender Json #142

Closed DSquared21 closed 2 years ago

DSquared21 commented 2 years ago

I created my project in blender and I believe the issue I am running into is that the JSON file structure is not correct for the attributes and properties. The action stops once I get to the properties. I do not code with Python. I believe there should be something I could change in the upload_captcha.py to look for this file structure instead of what it is looking for. I have an example below. Could someone help me out? Thanks in advance.

Example of the beginning of the JSON file structure from Blender { "name": Project X", "NFT_DNA": "2-1-2-2-2-1-2-1-1-3-1-1", "NFT_Variants": { "Background": "Green_2_75",

Does something need to change here? if "attributes" in jsonData: jsonMetaData = jsonData['attributes']

            for key in jsonMetaData:
                input1 = driver.find_element(By.XPATH, '//tbody[@class="AssetTraitsForm--body"]/tr[last()]/td[1]/div/div/input')
                input2 = driver.find_element(By.XPATH, '//tbody[@class="AssetTraitsForm--body"]/tr[last()]/td[2]/div/div/input')
                #print(str(key['trait_type']))
                #print(str(key['value']))
                input1.send_keys(str(key['trait_type']))
                input2.send_keys(str(key['value']))
                addmore_button = driver.find_element(By.XPATH, '//button[text()="Add more"]')
                driver.execute_script("arguments[0].click();", addmore_button)
            time.sleep(0.95)

            try:
                save_button = driver.find_element(By.XPATH, '//button[text()="Save"]')
                driver.execute_script("arguments[0].click();", save_button)
                time.sleep(0.7)
            except:
                driver.find_element(By.XPATH, '//button[text()="Save"]').click()
                time.sleep(0.7)

        elif "properties" in jsonData:
            jsonMetaData = jsonData['properties']

            for key in jsonMetaData:
                input1 = driver.find_element(By.XPATH, '//tbody[@class="AssetTraitsForm--body"]/tr[last()]/td[1]/div/div/input')
                input2 = driver.find_element(By.XPATH, '//tbody[@class="AssetTraitsForm--body"]/tr[last()]/td[2]/div/div/input')
                #print(str(key['type']))
                #print(str(key['name']))
                input1.send_keys(str(key['type']))
                input2.send_keys(str(key['name']))
                addmore_button = driver.find_element(By.XPATH, '//button[text()="Add more"]')
                driver.execute_script("arguments[0].click();", addmore_button)
            time.sleep(0.9)
infotrex commented 2 years ago

@DSquared21 Please show me full json file. i think need to change something about the script..

DSquared21 commented 2 years ago

Thanks for taking a look. I appreciate it. Here it is.

{ "name": "Magic Friends_1", "NFT_DNA": "2-1-2-2-2-1-2-1-1-3-1-1", "NFT_Variants": { "Background": "Green_2_75", "Dolls": "Burlap_1_75", "EYES": "Thread_2_96", "Floor": "Dark Wood_2_99", "HAIR": "No Hair_2_50", "Item": "No Item_1_99", "Mouth": "Stitches_2_75", "Neck": "Stitched_1_100", "Object": "Candle_1_50", "PATCHES": "Heart Wood_3_25", "Pins": "Pins Multicolor_1_75", "Skull": "Real_1_99" } }

wagnerjeveaux commented 2 years ago

Exception in Tkinter callback Traceback (most recent call last): File "C:\Program Files\Python310\lib\tkinter__init.py", line 1921, in call__ return self.func(*args) File "C:\Users.......................\bulk-upload-to-opensea\upload.py", line 318, in main_program_loop input1.send_keys(str(key['type'])) TypeError: string indices must be integers

?

DSquared21 commented 2 years ago

@DSquared21 Please show me full json file. i think need to change something about the script..

Hello, were you able to see if there is something I can change?