Closed gschmidl closed 4 years ago
Speculation: I assume beets interprets F: as a drive and adds a \ automatically, since it didn't happen with any other colon in a library of ~16000 files.
Huh; that's interesting! Any chance you could try this with the default (underscore-laden) replace
configuration? I wonder if anything weird is happening with those Unicode replacements.
Huh; that's interesting! Any chance you could try this with the default (underscore-laden)
replace
configuration? I wonder if anything weird is happening with those Unicode replacements.
Same result, but now the directory is named F_. I removed the entire "replace" and path_sep_replace blocks as well as the plugins again.
Very interesting; thanks! It seems like something real is going on here, but it's not entirely obvious where the root cause is. We must be, implicitly or explicitly, doing an os.path.split
on the completed path filename (not the template), which has this effect:
>>> import ntpath
>>> ntpath.split('A:B:C')
('A:', 'B:C')
>>> ntpath.split('AA:B:C')
('', 'AA:B:C')
(It's only a problem when it's a single letter and at the very beginning of the path.)
I believe the most likely candidate is in our path sanitation routines, where we need to split apart the path, do replacements on the components individually, and then glue it back together: https://github.com/beetbox/beets/blob/a2f66a042727964e18d698a7b1676a802b5f7050/beets/util/__init__.py#L598
So if we fill in the template with actual :
character and then try to do this, we will split in the wrong place!
This is the same reason we have a special fixed-function replacement for /
(and \
on Windows) that runs before all this, so we know where to split components:
https://github.com/beetbox/beets/blob/a2f66a042727964e18d698a7b1676a802b5f7050/beets/dbcore/db.py#L86
(See also #323.) It seems like we likely need to do a similar thing for :
on Windows.
I have an album containing an artist named "F:A.R.". When doing any activity that involves moving this artist, the file is not moved to "M:\F:A.R." (I'm using unicode replacements instead of underscores), but to "M:\F:\A.R.".
Problem
Running this command in verbose (
-vv
) mode:Led to this problem:
Here's what it looks like in the database: https://i.imgur.com/Z5lvGqE.png
Here's a link to the music files that trigger the bug (if relevant):
https://www.dropbox.com/s/pastihu349z6kce/01-01%20-%20Manipulation%20%28Live%20Extracts%29.mp3?dl=0
Setup
My configuration (output of
beet config
) is: