# Cleanup Storyblok assets
[![PyPI version storyblok-assets-cleanup](https://img.shields.io/pypi/v/storyblok-assets-cleanup.svg)](https://pypi.python.org/pypi/storyblok-assets-cleanup/)
[![CI/CD](https://github.com/significa/storyblok-assets-cleanup/actions/workflows/ci-cd.yaml/badge.svg)](https://github.com/significa/storyblok-assets-cleanup/actions/workflows/ci-cd.yaml)
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](https://app.storyblok.com/#/me/account?tab=token)
### Installation
`pip3 install storyblok-assets-cleanup`
## Usage
<!--
To update the code block with the usage below:
1. Resize your terminal to 100 columns. On most systems just run: `stty cols 100 rows 50`.
2. Run `storyblok-assets-cleanup --help` to get the usage output.
-->
```
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`.
Raw data
{
"_id": null,
"home_page": "https://github.com/significa/storyblok-assets-cleanup",
"name": "storyblok-assets-cleanup",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "storyblok",
"author": "Significa",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/9c/51/0c2a10718a0543f2d0188cd3c1a01ba3b2e49fdde29436a877e5e5646136/storyblok-assets-cleanup-1.0.1.tar.gz",
"platform": null,
"description": "# Cleanup Storyblok assets\n\n\n[![PyPI version storyblok-assets-cleanup](https://img.shields.io/pypi/v/storyblok-assets-cleanup.svg)](https://pypi.python.org/pypi/storyblok-assets-cleanup/)\n[![CI/CD](https://github.com/significa/storyblok-assets-cleanup/actions/workflows/ci-cd.yaml/badge.svg)](https://github.com/significa/storyblok-assets-cleanup/actions/workflows/ci-cd.yaml)\n\nstoryblok-assets-cleanup is an utility to find and delete unused assets\n(images, videos, documents, etc) in the Storyblok CMS.\n\nFeatures:\n\n- Find assets without references;\n- Output a summary of file to be deleted, grouped by folder;\n- Perform a backup of assets before deletion;\n\n\n## Getting started\n\n### Requirements\n\n- Have a Storyblok space and create a\n [personal access token](https://app.storyblok.com/#/me/account?tab=token)\n\n### Installation\n\n`pip3 install storyblok-assets-cleanup`\n\n## Usage\n\n<!--\n To update the code block with the usage below:\n \n 1. Resize your terminal to 100 columns. On most systems just run: `stty cols 100 rows 50`.\n 2. Run `storyblok-assets-cleanup --help` to get the usage output.\n-->\n\n```\nusage: storyblok_assets_cleanup.py [-h] [--token TOKEN] --space-id SPACE_ID\n [--region {eu,us,ca,au,cn}] [--delete | --no-delete]\n [--backup | --no-backup] [--backup-directory BACKUP_DIRECTORY]\n [--cache | --no-cache] [--cache-directory CACHE_DIRECTORY]\n [--continue-download-on-failure | --no-continue-download-on-failure]\n [--blacklisted-path BLACKLISTED_PATH]\n [--blacklisted-word BLACKLISTED_WORD]\n\nstoryblok-assets-cleanup an utility to delete unused assets.\n\noptions:\n -h, --help show this help message and exit\n --token TOKEN Storyblok personal access token, alternatively use the env var\n STORYBLOK_PERSONAL_ACCESS_TOKEN.\n --space-id SPACE_ID Storyblok space ID, alternatively use the env var STORYBLOK_SPACE_ID.\n --region {eu,us,ca,au,cn}\n Storyblok region (default: EU)\n --delete, --no-delete\n If we should delete assets, default to false.\n --backup, --no-backup\n If we should backup assets (to the directory specified in `--backup-\n directory`), defaults to true.\n --backup-directory BACKUP_DIRECTORY\n Backup directory, defaults to ./assets_backup.\n --cache, --no-cache If we should use cache the assets index. Defaults to True (recommended).\n --cache-directory CACHE_DIRECTORY\n Cache directory, defaults to ./cache.\n --continue-download-on-failure, --no-continue-download-on-failure\n If we should continue if the download of an asset fails. Defaults to true.\n --blacklisted-path BLACKLISTED_PATH\n Filepaths that should be ignored. Optional, defaults to no blacklisted\n paths.\n --blacklisted-word BLACKLISTED_WORD\n Will not delete assets which contains the specified words in its filename.\n Default to none/empty list.\n```\n\n## Development\n\n- Ensure you have `make` installed.\n- Create a virtual environment: `make setup-venv`.\n- Install dependencies: `make install-deps`.\n\nThen you can install (link) the repo globally with `make local-install`.\n\nBefore pushing changes ensure your code is properly formatted with `make lint`.\nAuto format the code with `make format`.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Utility to clean unused storyblok assets.",
"version": "1.0.1",
"project_urls": {
"Homepage": "https://github.com/significa/storyblok-assets-cleanup"
},
"split_keywords": [
"storyblok"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "cba882d628100c1599f063ec9e9fbce1a859b76ab400cd6a25a29cd198fcf010",
"md5": "a44c3bd2fe1dfe60399ee4e54485b5fb",
"sha256": "846fa56e3192114f9588fc50ab08cc5f9736ae7bb81246e6cf469a6b2af6a442"
},
"downloads": -1,
"filename": "storyblok_assets_cleanup-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a44c3bd2fe1dfe60399ee4e54485b5fb",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 7862,
"upload_time": "2024-09-30T21:43:39",
"upload_time_iso_8601": "2024-09-30T21:43:39.958376Z",
"url": "https://files.pythonhosted.org/packages/cb/a8/82d628100c1599f063ec9e9fbce1a859b76ab400cd6a25a29cd198fcf010/storyblok_assets_cleanup-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9c510c2a10718a0543f2d0188cd3c1a01ba3b2e49fdde29436a877e5e5646136",
"md5": "5f21c825ba2bfd0d2572efe8b2586781",
"sha256": "962ccbd327dc3b4f4802b410270cde67482d1ddda36b957153ebf84ad90397bc"
},
"downloads": -1,
"filename": "storyblok-assets-cleanup-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "5f21c825ba2bfd0d2572efe8b2586781",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 7173,
"upload_time": "2024-09-30T21:43:40",
"upload_time_iso_8601": "2024-09-30T21:43:40.798387Z",
"url": "https://files.pythonhosted.org/packages/9c/51/0c2a10718a0543f2d0188cd3c1a01ba3b2e49fdde29436a877e5e5646136/storyblok-assets-cleanup-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-30 21:43:40",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "significa",
"github_project": "storyblok-assets-cleanup",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "requests",
"specs": [
[
"==",
"2.32.3"
]
]
}
],
"lcname": "storyblok-assets-cleanup"
}