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.

128 lines
3.3 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. ### Common Options
  28. - `-c, --config`: The config file to read. Default file is `acm-config.json` in the current directory.
  29. - `-x, --context`: The remote bucket to use. For `store` and `retrieve` operations it is `<value>-data`.
  30. - `-s, --stdin`: Read the file list to process from stdin.
  31. - `-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`
  32. ### Listing Files
  33. List all files in a bucket
  34. ```bash
  35. $ ./acm.py -x <bucket> list
  36. ```
  37. List all files while adding a prefix and stripping a suffix
  38. ```bash
  39. $ ./acm.py -x <bucket> -p <prefix> list --suffix <suffix>
  40. ```
  41. List all files with sha256sum compatible output
  42. ```bash
  43. $ ./acm.py --context testing --prefix "/tmp/" --stdin list --suffix .json --sha256sum
  44. ```
  45. Print out a sha256sum compatible check list
  46. ### Checking For Changes
  47. Do a comparison of the remote bucket for missing files or files with a mismatch in their sha256sum values.
  48. Process a list of files
  49. ```bash
  50. $ ./acm.py -x <bucket> -p <prefix to strip> check FILES...
  51. ```
  52. Process a list from stdin
  53. ```bash
  54. $ find /tmp -name '*.jpg' | ./acm.py -x <bucket> -p <prefix to strip> check
  55. ```
  56. ### Updating Metadata For Changed Files
  57. Update the remote bucket with new metadata for the listed files. Calculates new sha256sum values.
  58. Process a list of files
  59. ```bash
  60. $ ./acm.py -x <bucket> -p <prefix to strip> update FILES...
  61. ```
  62. Process a list from stdin
  63. ```bash
  64. $ find /tmp -name '*.jpg' | ./acm.py -x <bucket> -p <prefix to strip> update
  65. ```
  66. ### Storing Files
  67. Store the listed files in `<bucket>-data`.
  68. Process a list of files
  69. ```bash
  70. $ ./acm.py -x <bucket> -p <prefix to strip> store FILES...
  71. ```
  72. Process a list from stdin
  73. ```bash
  74. $ find /tmp -name '*.jpg' | ./acm.py -x <bucket> -p <prefix to strip> store
  75. ```
  76. ### Retrieving Files
  77. Retrieve remote files matching listed files. Optionally place the downloaded files in a different destination.
  78. Process a list of files
  79. ```bash
  80. $ ./acm.py -x <bucket> -p <prefix to strip> retrieve [-d <destination>] FILES...
  81. ```
  82. Process a list from stdin
  83. ```bash
  84. $ find /tmp -name '*.jpg' | ./acm.py -x <bucket> -p <prefix to strip> retrieve [-d <destination>]
  85. ```
  86. ### Configuring Profiles
  87. ### Compressing Changed Assets
  88. ## Contributing
  89. ## License
  90. See [LICENSE.md](LICENSE.md)