Tooling for managing asset compression, storage, and retrieval
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

147 lines
3.9 KiB

  1. Asset Compression Manager (ACM)
  2. ========================
  3. ## About
  4. This tool exists to help compress, store, retrieve and validate media for games. The goal is to provide a simple workflow for checking assets for changes, generating new compressed versions based on those changes, storing those changed versions, and retrieving compressed files.
  5. This tool is designed to work with an S3 compatible bucket storage provider.
  6. ## Requirements
  7. - An S3 Compatible Storage Service
  8. - Python 3.7+
  9. - MozJpeg for jpeg compression
  10. - OptiPNG for png optimization
  11. - FFMpeg for video compression and audio decompression
  12. - Opusenc for audio compression
  13. ## Using
  14. ### Configuring
  15. ACM expects a configuration file specified with `--config` or as `acm-config.json` in the current directory.
  16. The S3 compatible endpoint needs to be configured in the `s3` object of the configuration file.
  17. ```json
  18. {
  19. "s3": {
  20. "secure": false,
  21. "host": "127.0.0.1:9000"
  22. }
  23. }
  24. ```
  25. - `secure` - specifies if __*https*__ protocol is used.
  26. - `host` - is the \<hostname>\[:\<port>] for the S3 compatible endpoint.
  27. Additionally the following environment variables need to be populated to interact with the S3 endpoint.
  28. - `ACM_S3_ACCESS` - A valid S3 Access Key for the endpoint.
  29. - `ACM_S3_SECRET` - A valid S3 Secret Key for the Access Key on the endpoint.
  30. ### Common Options
  31. - `-c, --config`: The config file to read. Default file is `acm-config.json` in the current directory.
  32. - `-x, --context`: The remote bucket to use. For `store` and `retrieve` operations it is `<value>-data`.
  33. - `-s, --stdin`: Read the file list to process from stdin.
  34. - `-p, --prefix`: The prefix to strip from the input. i.e. `acm.py -x test -p /tmp/data/storage/ check /tmp/data/storage/images/img1.jpg` => `images/img1.jpg`
  35. ### Listing Files
  36. List all files in a bucket
  37. ```bash
  38. $ ./acm.py -x <bucket> list
  39. ```
  40. List all files while adding a prefix and stripping a suffix
  41. ```bash
  42. $ ./acm.py -x <bucket> -p <prefix> list --suffix <suffix>
  43. ```
  44. List all files with sha256sum compatible output
  45. ```bash
  46. $ ./acm.py --context testing --prefix "/tmp/" --stdin list --suffix .json --sha256sum
  47. ```
  48. Print out a sha256sum compatible check list
  49. ### Checking For Matches
  50. Do a comparison of the remote bucket for files with a matching sha256sum value.
  51. Process a list of files
  52. ```bash
  53. $ ./acm.py -x <bucket> -p <prefix to strip> match FILES...
  54. ```
  55. Process a list from stdin
  56. ```bash
  57. $ find /tmp -name '*.jpg' | ./acm.py -x <bucket> -p <prefix to strip> match
  58. ```
  59. ### Checking For Changes
  60. Do a comparison of the remote bucket for missing files or files with a mismatch in their sha256sum values.
  61. Process a list of files
  62. ```bash
  63. $ ./acm.py -x <bucket> -p <prefix to strip> check FILES...
  64. ```
  65. Process a list from stdin
  66. ```bash
  67. $ find /tmp -name '*.jpg' | ./acm.py -x <bucket> -p <prefix to strip> check
  68. ```
  69. ### Updating Metadata For Changed Files
  70. Update the remote bucket with new metadata for the listed files. Calculates new sha256sum values.
  71. Process a list of files
  72. ```bash
  73. $ ./acm.py -x <bucket> -p <prefix to strip> update FILES...
  74. ```
  75. Process a list from stdin
  76. ```bash
  77. $ find /tmp -name '*.jpg' | ./acm.py -x <bucket> -p <prefix to strip> update
  78. ```
  79. ### Storing Files
  80. Store the listed files in `<bucket>-data`.
  81. Process a list of files
  82. ```bash
  83. $ ./acm.py -x <bucket> -p <prefix to strip> store FILES...
  84. ```
  85. Process a list from stdin
  86. ```bash
  87. $ find /tmp -name '*.jpg' | ./acm.py -x <bucket> -p <prefix to strip> store
  88. ```
  89. ### Retrieving Files
  90. Retrieve remote files matching listed files. Optionally place the downloaded files in a different destination.
  91. Process a list of files
  92. ```bash
  93. $ ./acm.py -x <bucket> -p <prefix to strip> retrieve [-d <destination>] FILES...
  94. ```
  95. Process a list from stdin
  96. ```bash
  97. $ find /tmp -name '*.jpg' | ./acm.py -x <bucket> -p <prefix to strip> retrieve [-d <destination>]
  98. ```
  99. ### Configuring Profiles
  100. ### Compressing Changed Assets
  101. ## Contributing
  102. ## License
  103. See [LICENSE.md](LICENSE.md)