beetbox / beetbox/beets

Allow "unsafe" paths which contain directories.

Open
#6,009 0 comments 1 reaction 0 assignees View on GitHub
convert
Dominant language
Python
Stars
15.7k
Forks
2.1k
Avg merge
4d 21h
Merged PRs (30d)
31

Description

### Proposed solution

I want to be able to use the `convert` plugin to transcode (for example):
```
/mnt/foo/Music/albums/Album Artist/Album Name/
```
to
```
/mnt/bar/Music/albums/Album Artist/Album Name/
```

It's driving me mad that beets escapes every `os.pathsep` to `_` or `__` resulting in:
```
/mnt/bar/Music_albums_Album Artist_Album Name_01 baz.ogg
```

I tried overriding `sanitize_path()` in `beets/util/__init__.py` to simply:
```
def sanitize_path(path):
return path
```
But `destination` in `beets/library.py` appears to be applying sanitization to each field of the path.

Can a config flag like `unsafe_paths: true` be added for users who know what they're doing which prevents this behaviour?

I'd be happy to leave the flag undocumented if you're especially concerned?

I can _probably_ make the PR myself but I won't start unless there is a will to merge it.

Contributor guide

Open the contributing guide

Research direction

Start with the convert plugin and inspect sanitize_path() in beets/util/__init__.py and destination in beets/library.py, where the issue reports that path fields are sanitized. Trace how configured destinations are assembled, then define the unsafe_paths behavior so directory separators can be preserved without changing the default; verify the example destination and add coverage if the relevant tests are found.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.