funkwhale/docs/administrator/manage-script/library.md

137 wiersze
2.8 KiB
Markdown
Czysty Zwykły widok Historia

2022-07-01 09:02:29 +00:00
# Prune your Funkwhale library
Funkwhale doesn't delete data objects from the database when you delete a file. This is because they might exist in users' playlists, favorites, and listening history. These objects might also be present in another user's private libraries.
Sometimes you may want to clear out dangling metadata. For example, if you import a lot of files with incorrect tags and then delete them.
To help with this, the `funkwhale-manage` command line interface includes commands to prune dangling metadata from your database. All prune commands are available under the `funkwhale-manage prune_library` namespace. To ensure you don't remove data by accident, all commands run in dry run mode by default. Run commands with the `--no-dry-run` flag to perform the pruning action.
2022-07-01 09:02:29 +00:00
```{warning}
Running `prune_library` commands with the `--no-dry-run` flag is irreversible. Make sure you [back up your data](../upgrade/backup.md).
2022-07-01 09:02:29 +00:00
```
## Commands
### Prune tracks with no associated uploads
2022-07-23 13:32:35 +00:00
::::{tab-set}
:::{tab-item} Debian
:sync: debian
2022-07-01 09:02:29 +00:00
```bash
venv/bin/funkwhale-manage prune_library --tracks
2022-07-01 09:02:29 +00:00
```
2022-07-23 13:32:35 +00:00
:::
2022-07-01 09:02:29 +00:00
2022-07-23 13:32:35 +00:00
:::{tab-item} Docker
:sync: docker
2022-07-01 09:02:29 +00:00
```bash
sudo docker compose run --rm api funkwhale-manage prune_library --tracks
2022-07-01 09:02:29 +00:00
```
2022-07-23 13:32:35 +00:00
:::
::::
2022-07-01 09:02:29 +00:00
### Prune albums with no associated tracks
2022-07-23 13:32:35 +00:00
::::{tab-set}
:::{tab-item} Debian
:sync: debian
2022-07-01 09:02:29 +00:00
2022-10-26 20:19:16 +00:00
```{code-block} sh
venv/bin/funkwhale-manage prune_library --albums
2022-07-01 09:02:29 +00:00
```
2022-07-23 13:32:35 +00:00
:::
2022-07-01 09:02:29 +00:00
2022-07-23 13:32:35 +00:00
:::{tab-item} Docker
:sync: docker
2022-07-01 09:02:29 +00:00
2022-10-26 20:19:16 +00:00
```{code-block} sh
sudo docker compose run --rm api funkwhale-manage prune_library --albums
2022-07-01 09:02:29 +00:00
```
2022-07-23 13:32:35 +00:00
:::
::::
2022-07-01 09:02:29 +00:00
### Prune artists with no associated tracks or albums
2022-07-23 13:32:35 +00:00
::::{tab-set}
:::{tab-item} Debian
:sync: debian
2022-07-01 09:02:29 +00:00
2022-10-26 20:19:16 +00:00
```{code-block} sh
venv/bin/funkwhale-manage prune_library --artists
2022-07-01 09:02:29 +00:00
```
2022-07-23 13:32:35 +00:00
:::
2022-07-01 09:02:29 +00:00
2022-07-23 13:32:35 +00:00
:::{tab-item} Docker
:sync: docker
2022-07-01 09:02:29 +00:00
2022-10-26 20:19:16 +00:00
```{code-block} sh
sudo docker compose run --rm api funkwhale-manage prune_library --artists
2022-07-01 09:02:29 +00:00
```
2022-07-23 13:32:35 +00:00
:::
::::
2022-07-01 09:02:29 +00:00
### Prune all tracks, albums, and artist without associated data
2022-07-23 13:32:35 +00:00
::::{tab-set}
:::{tab-item} Debian
:sync: debian
2022-07-01 09:02:29 +00:00
2022-10-26 20:19:16 +00:00
```{code-block} sh
venv/bin/funkwhale-manage prune_library --tracks --albums --artists
2022-07-01 09:02:29 +00:00
```
2022-07-23 13:32:35 +00:00
:::
2022-07-01 09:02:29 +00:00
2022-07-23 13:32:35 +00:00
:::{tab-item} Docker
:sync: docker
2022-07-01 09:02:29 +00:00
2022-10-26 20:19:16 +00:00
```{code-block} sh
sudo docker compose run --rm api funkwhale-manage prune_library --tracks --albums --artists
2022-07-01 09:02:29 +00:00
```
2022-07-23 13:32:35 +00:00
:::
::::
2022-07-01 09:02:29 +00:00
There are extra options for pruning your database. Check the command help for more options.
2022-07-23 13:32:35 +00:00
::::{tab-set}
:::{tab-item} Debian
:sync: debian
2022-07-01 09:02:29 +00:00
2022-10-26 20:19:16 +00:00
```{code-block} sh
venv/bin/funkwhale-manage prune_library --help
2022-07-01 09:02:29 +00:00
```
2022-07-23 13:32:35 +00:00
:::
2022-07-01 09:02:29 +00:00
2022-07-23 13:32:35 +00:00
:::{tab-item} Docker
:sync: docker
2022-07-01 09:02:29 +00:00
2022-10-26 20:19:16 +00:00
```{code-block} sh
sudo docker compose run --rm api funkwhale-manage prune_library --help
2022-07-01 09:02:29 +00:00
```
2022-07-23 13:32:35 +00:00
:::
::::
2022-07-01 09:02:29 +00:00
```{note}
The command excludes tracks that are in users' favorites, playlists, and listen history. To include these tracks, add the corresponding `ignore` flag:
- `--ignore-favorites`
- `--ignore-playlists`
- `--ignore-listenings`
```