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] [--token TOKEN] --space-id SPACE_ID
[--region {eu,us,ca,au,cn}] [--delete | --no-delete]
[--backup | --no-backup] [--backup-directory BACKUP_DIRECTORY]
[--cache | --no-cache] [--cache-directory CACHE_DIRECTORY]
[--continue-download-on-failure | --no-continue-download-on-failure]
[--blacklisted-folder-paths BLACKLISTED_FOLDER_PATHS]
[--blacklisted-words BLACKLISTED_WORDS]
storyblok-assets-cleanup an utility to delete unused assets.
options:
-h, --help show this help message and exit
--token TOKEN Storyblok personal access token, alternatively use the env var
STORYBLOK_PERSONAL_ACCESS_TOKEN.
--space-id SPACE_ID Storyblok space ID, alternatively use the env var STORYBLOK_SPACE_ID.
--region {eu,us,ca,au,cn}
Storyblok region (default: EU)
--delete, --no-delete
If we should delete assets, default to false.
--backup, --no-backup
If we should backup assets (to the directory specified in `--backup-
directory`), defaults to true.
--backup-directory BACKUP_DIRECTORY
Backup directory, defaults to ./assets_backup.
--cache, --no-cache If we should use cache the assets index. Defaults to True (recommended).
--cache-directory CACHE_DIRECTORY
Cache directory, defaults to ./cache.
--continue-download-on-failure, --no-continue-download-on-failure
If we should continue if the download of an asset fails. Defaults to true.
--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.
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.dev12.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd11d67fdeb69adb812795bf1244069a1c3b6aa62ff2cffce5b1f8150b3f4518 |
|
MD5 | d348a9b5e956f700d11617f9672ed89f |
|
BLAKE2b-256 | d1d4e3f57fc69ffb5276a9efeb28d7488052c3f0aba5a5f5d49037d3fc76bdad |
Close
Hashes for storyblok_assets_cleanup-0.0.1.dev12-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0dc7198a3cc72f52d73b70d1e7e4c6784d5efec94759c3d587d6785c20ae009f |
|
MD5 | 9163490c35567042da76f655be424063 |
|
BLAKE2b-256 | cb831b568030d9b07cd32c874b5082f69357553c7aa54ae264f8439b4bb3accc |