Skip to main content

Utility to clean unused storyblok assets.

Project description

Cleanup Storyblok assets

PyPI version storyblok-assets-cleanup CI/CD

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

Installation

pip3 install storyblok-assets-cleanup

Usage

usage: storyblok_assets_cleanup.py [-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-path BLACKLISTED_PATH]
                                   [--blacklisted-word BLACKLISTED_WORD]

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-path BLACKLISTED_PATH
                        Filepaths that should be ignored. Optional, defaults to no blacklisted
                        paths.
  --blacklisted-word BLACKLISTED_WORD
                        Will not delete assets which contains the specified words in its filename.
                        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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

storyblok-assets-cleanup-1.0.1.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

storyblok_assets_cleanup-1.0.1-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file storyblok-assets-cleanup-1.0.1.tar.gz.

File metadata

File hashes

Hashes for storyblok-assets-cleanup-1.0.1.tar.gz
Algorithm Hash digest
SHA256 962ccbd327dc3b4f4802b410270cde67482d1ddda36b957153ebf84ad90397bc
MD5 5f21c825ba2bfd0d2572efe8b2586781
BLAKE2b-256 9c510c2a10718a0543f2d0188cd3c1a01ba3b2e49fdde29436a877e5e5646136

See more details on using hashes here.

File details

Details for the file storyblok_assets_cleanup-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for storyblok_assets_cleanup-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 846fa56e3192114f9588fc50ab08cc5f9736ae7bb81246e6cf469a6b2af6a442
MD5 a44c3bd2fe1dfe60399ee4e54485b5fb
BLAKE2b-256 cba882d628100c1599f063ec9e9fbce1a859b76ab400cd6a25a29cd198fcf010

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page