Skip to content

Commit

Permalink
Merge pull request #43 from Alfred-builder/webp
Browse files Browse the repository at this point in the history
Support webp format
  • Loading branch information
Harvey1973 authored Oct 31, 2022
2 parents 7580fe4 + 25789ff commit 3453ecf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions script/src/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@
GAS_UNIT = 100
BATCH_NUMBER = 200
IPFS_GATEWAY = "https://cloudflare-ipfs.com/ipfs/"
SUPPORTED_IMAGE_FORMATS = ('.png', '.jpg', '.jpeg', '.tiff', '.bmp', '.gif', '.webp')
AR_RESOLVER = "https://arweave.net/"

8 changes: 5 additions & 3 deletions script/src/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
from arweave.arweave_lib import Wallet, Transaction
import logging

from script.src.constants import SUPPORTED_IMAGE_FORMATS

rest_client = RestClient(NODE_URL)
faucet_client = FaucetClient(FAUCET_URL, rest_client)

Expand Down Expand Up @@ -155,7 +157,7 @@ def uploadFolderToIpfs():
failed_file_names = []

for file in os.listdir():
if file.endswith(('.png', '.jpg', '.jpeg', '.tiff', '.bmp', '.gif')):
if file.endswith(SUPPORTED_IMAGE_FORMATS):
file_name = file.split('.')[0]
file_path = _ASSET_FOLDER + '/' + file
if isFileAlreadyUploaded(file_name, uri_list): continue
Expand Down Expand Up @@ -253,7 +255,7 @@ def uploadFolderToArweave():
os.chdir(_ASSET_FOLDER)
failed_file_names = []
for file in os.listdir():
if file.endswith(('.png', '.jpg', '.jpeg', '.tiff', '.bmp', '.gif')):
if file.endswith(SUPPORTED_IMAGE_FORMATS):
file_name, format = file.split('.')
file_path = _ASSET_FOLDER + '/' + file

Expand Down Expand Up @@ -305,7 +307,7 @@ def verifyMetadataFiles():
is_valid = True

assets = os.listdir(_ASSET_FOLDER)
images = [asset.split(".")[0] for asset in assets if asset.endswith(('.png', '.jpg', '.jpeg', '.tiff', '.bmp', '.gif'))]
images = [asset.split(".")[0] for asset in assets if asset.endswith(SUPPORTED_IMAGE_FORMATS)]
metadatas = [metadata for metadata in os.listdir(_METADATA_FOLDER) if metadata.endswith(".json")]
token_names = []
if len(metadatas) != _COLLECTION_SIZE:
Expand Down

1 comment on commit 3453ecf

@vercel
Copy link

@vercel vercel bot commented on 3453ecf Oct 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

ftmtest – ./

ftmtest-git-main-ftm-test.vercel.app
ftmtest.vercel.app
ftmtest-ftm-test.vercel.app

Please sign in to comment.