SketchfabUpload: log correct file size and fix spaces in tags

This commit is contained in:
ChemicalXandco 2020-01-24 17:53:04 +00:00
parent d661a2b928
commit 95a28cb0a7

View file

@ -232,7 +232,7 @@ class SketchfabUpload(desc.Node):
if len(chunk.node.description.value) > 1024: if len(chunk.node.description.value) > 1024:
chunk.logger.error('Description cannot be longer than 1024 characters.') chunk.logger.error('Description cannot be longer than 1024 characters.')
raise RuntimeError() raise RuntimeError()
tags = [ i.value for i in chunk.node.tags.value.values() ] tags = [ i.value.replace(' ', '-') for i in chunk.node.tags.value.values() ]
if all(len(i) > 48 for i in tags) and len(tags) > 0: if all(len(i) > 48 for i in tags) and len(tags) > 0:
chunk.logger.error('Tags cannot be longer than 48 characters.') chunk.logger.error('Tags cannot be longer than 48 characters.')
raise RuntimeError() raise RuntimeError()
@ -264,9 +264,7 @@ class SketchfabUpload(desc.Node):
zf.close() zf.close()
chunk.logger.debug('Files added to zip: {}'.format(str(files))) chunk.logger.debug('Files added to zip: {}'.format(str(files)))
chunk.logger.debug('Created {}'.format(uploadFile)) chunk.logger.debug('Created {}'.format(uploadFile))
chunk.logger.info('File size: {}MB'.format(round(os.path.getsize(uploadFile)/(1024*1024), 3)))
fileSize = os.path.getsize(uploadFile)/1000000
chunk.logger.info('File size: {}MB'.format(fileSize))
self.upload(chunk.node.apiToken.value, uploadFile, data, chunk) self.upload(chunk.node.apiToken.value, uploadFile, data, chunk)
chunk.logger.info('Upload successful. Your model is being processed on Sketchfab. It may take some time to show up on your "models" page.') chunk.logger.info('Upload successful. Your model is being processed on Sketchfab. It may take some time to show up on your "models" page.')