beetbox / beetbox/beets

Replace empty path components by default

Open
#359 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
15.7k
Forks
2.1k
Avg merge
4d 21h
Merged PRs (30d)
31

Description

Currently, if a path template becomes empty, it can result in confusing directory hierarchies. For example, if you use the path template:

```
$albumartist/$album/$title
```

and a track has a missing album, then the audio file is placed in the _artist's_ directory (i.e., since $album is empty, the path is `artist//title.mp3`, which is equivalent to `artist/title.mp3`).

The function `util.sanitize_path` should permit the replacements configuration to detect these empty path components with the regex `^$` and replace them with something sensible like `_`. The default replacements should be extended to enable this.

Currently, `ancestry` (and, by extension, `components`) drops these empty components.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.