iaupload.py 911 B

12345678910111213141516171819202122232425262728293031323334
  1. import logging
  2. import internetarchive
  3. from terroroftinytown.release.baseuploader import BaseUploaderBootstrap
  4. logger = logging.getLogger(__name__)
  5. class IAUploaderBootstrap(BaseUploaderBootstrap):
  6. def upload(self):
  7. item = internetarchive.get_item(self.identifier)
  8. metadata = dict(
  9. title=self.title,
  10. collection=self.collection,
  11. mediatype='software',
  12. subject=self.subject,
  13. description=self.description,
  14. )
  15. logger.info('Begin upload %s %s.', self.identifier, self.filenames)
  16. item.upload(self.filenames, metadata=metadata,
  17. verify=True, verbose=True,
  18. access_key=self.access_key, secret_key=self.secret_key,
  19. retries=10)
  20. logger.info('Done upload.')
  21. if __name__ == '__main__':
  22. bootstrap = IAUploaderBootstrap()
  23. bootstrap.start()