Utility to clean unused storyblok assets.
Project description
Cleanup Storyblok assets
storyblok-assets-cleanup is an utility to find and delete unused assets (images, videos, documents, etc) in the Storyblok CMS.
Features:
- Find assets without references;
- Output a summary of file to be deleted, grouped by folder;
- Perform a backup of assets before deletion;
Getting started
Requirements
- Have a Storyblok space and create a personal access token
Installation
pip3 install storyblok-assets-cleanup
Usage
usage: storyblok-assets-cleanup [-h] [--delete | --no-delete] [--backup | --no-backup]
[--cache | --no-cache]
[--continue-download-on-failure | --no-continue-download-on-failure]
[--space-id SPACE_ID] [--token TOKEN]
[--blacklisted-folder-paths BLACKLISTED_FOLDER_PATHS]
[--blacklisted-words BLACKLISTED_WORDS]
[--cache-directory CACHE_DIRECTORY]
[--backup-directory BACKUP_DIRECTORY]
storyblok-assets-cleanup an utility to delete unused assets.
options:
-h, --help show this help message and exit
--delete, --no-delete
If we should delete assets, default to false.
--backup, --no-backup
If we should backup assets (to ./assets_backup/<SPACE_ID>), defaults to
true.
--cache, --no-cache If we should use cache the assets index. Defaults to True (recommended).
--continue-download-on-failure, --no-continue-download-on-failure
If we should continue if the download of an asset fails. Defaults to true.
--space-id SPACE_ID Storyblok space ID, alternatively use the env var STORYBLOK_SPACE_ID.
--token TOKEN Storyblok personal access token, alternatively use the env var
STORYBLOK_PERSONAL_ACCESS_TOKEN.
--blacklisted-folder-paths BLACKLISTED_FOLDER_PATHS
Comma separated list of filepaths that should be ignored. Alternatively use
the env var BLACKLISTED_ASSET_FOLDER_PATHS. Default to none/empty list.
--blacklisted-words BLACKLISTED_WORDS
Comma separated list of words that should be used to ignore assets when they
are contained in its filename. Alternatively use the env var
BLACKLISTED_ASSET_FILENAME_WORDS. Default to none/empty list.
--cache-directory CACHE_DIRECTORY
Cache directory, defaults to ./cache.
--backup-directory BACKUP_DIRECTORY
Backup directory, defaults to ./assets_backup.
Development
- Ensure you have
make
installed. - Create a virtual environment:
make setup-venv
. - Install dependencies:
make install-deps
.
Then you can install (link) the repo globally with make local-install
.
Before pushing changes ensure your code is properly formatted with make lint
.
Auto format the code with make format
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for storyblok-assets-cleanup-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9fc31f76b1ffe027d17817c7755e0526b02e28e2eed3a14038aa27aace021ab8 |
|
MD5 | d8e85416f788810d7cd8346e6c09adce |
|
BLAKE2b-256 | b2d9695712d93982e79995b24ee7f725458affdcb66f58385f79a75dd63291b6 |
Close
Hashes for storyblok_assets_cleanup-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cfb18544f209587f4cecb171b4bce4ac08d53472ff28db15dc8a64d6a4c105e0 |
|
MD5 | 1d28834d91a09e7d1bb318ddc8efb10f |
|
BLAKE2b-256 | 889ffa9d50bd3ff9036d578e1e62e71b3c765a5ec624a2cfa713495142e2e940 |