beets
beets copied to clipboard
%asciify{} doesn't replace path separators
Problem
This is maybe related to https://github.com/beetbox/beets/issues/323. It seems like %asciify{} messes with the path_sep_replace option. The path separation substitution just doesn't work at all.
Running this command in verbose mode:
$ beet -vv import music
Led to this problem:
user configuration: /home/main/.beets/config.yaml
data directory: /home/main/.beets
plugin paths:
Sending event: pluginload
library database: /home/main/.beets/library.db
library directory: /home/main/Music
Sending event: library_opened
Sending event: import_begin
Sending event: import_task_created
Sending event: import_task_start
Looking up: /home/main/music
Tagging Steven Wilson - 4 ½
Searching for discovered album ID: e85f41ab-9eac-492e-a566-1fdbaf9f42e1
Sending event: albuminfo_received
Candidate: Steven Wilson - 4 ½
Success. Distance: 0.00
Album ID match recommendation is Recommendation.strong
ID match.
/home/main/music (6 items)
Sending event: before_choose_candidate
Tagging:
Steven Wilson - 4 ½
URL:
http://musicbrainz.org/release/e85f41ab-9eac-492e-a566-1fdbaf9f42e1
(Similarity: 99.9%) (tracks) (CD, 2016, XW, Kscope)
* My Book of Regrets (9:35) -> My Book of Regrets (9:23) (length)
Sending event: import_task_choice
Sending event: import_task_apply
0 of 6 items replaced
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: item_copied
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: after_write
Sending event: item_copied
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: after_write
Sending event: item_copied
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: after_write
Sending event: item_copied
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: after_write
Sending event: item_copied
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: after_write
Sending event: item_copied
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: after_write
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: import_task_files
Sending event: album_imported
Sending event: import
Sending event: cli_exit
Where then the files get moved to a "wrong" directory:
main@htpc:~$ beet ls -f '$path'
/home/main/Music/Steven Wilson/4 1/2/01-01.mp3
/home/main/Music/Steven Wilson/4 1/2/01-02.mp3
/home/main/Music/Steven Wilson/4 1/2/01-03.mp3
/home/main/Music/Steven Wilson/4 1/2/01-04.mp3
/home/main/Music/Steven Wilson/4 1/2/01-05.mp3
/home/main/Music/Steven Wilson/4 1/2/01-06.mp3
Setup
- OS: Linux 4.5.2-040502-generic
- Python version: Python 2.7.11+
- beets version: 1.3.18
My configuration is:
paths:
default: '%asciify{$albumartist}/%asciify{$album}/%if{$disc,$disc,01}-$track'
path_sep_replace: _
Thanks! This does look like a problem. It's a tricky one because path functions are intended to preserve directory separators—for example, you can use %asciify{$albumartist/$album/$title}
and expect the slashes inside the argument to be preserved. But it still seems solvable.
In the mean time, you might consider using the asciify_paths
config option that just applies the transformation to your whole paths.
Thanks, will give the asciify_paths a try and post results asap.
On Thu, Jul 14, 2016 at 1:23 AM, Adrian Sampson [email protected] wrote:
Thanks! This does look like a problem. It's a tricky one because path functions are intended to preserve directory separators—for example, you can use %asciify{$albumartist/$album/$title} and expect the slashes inside the argument to be preserved. But it still seems solvable.
In the mean time, you might consider using the asciify_paths config option that just applies the transformation to your whole paths.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/beetbox/beets/issues/2126#issuecomment-232515367, or mute the thread https://github.com/notifications/unsubscribe/AHa0XNwFFvFV8fnWhI1YVui2ZI5zlzo9ks5qVXN3gaJpZM4JLr_v .
No luck.
main@htpc:~/.beets$ beet config
asciify_paths: yes
main@htpc:~$ beet -vv import music
user configuration: /home/main/.beets/config.yaml
data directory: /home/main/.beets
plugin paths:
Sending event: pluginload
library database: /home/main/.beets/library.db
library directory: /home/main/Music
Sending event: library_opened
Sending event: import_begin
Sending event: import_task_created
Sending event: import_task_start
Looking up: /home/main/music
Tagging Steven Wilson - 4 ½
Searching for discovered album ID: e85f41ab-9eac-492e-a566-1fdbaf9f42e1
Sending event: albuminfo_received
Candidate: Steven Wilson - 4 ½
Success. Distance: 0.00
Album ID match recommendation is Recommendation.strong
ID match.
/home/main/music (6 items)
Sending event: before_choose_candidate
Tagging:
Steven Wilson - 4 ½
URL:
http://musicbrainz.org/release/e85f41ab-9eac-492e-a566-1fdbaf9f42e1
(Similarity: 99.9%) (tracks) (CD, 2016, XW, Kscope)
* My Book of Regrets (9:35) -> My Book of Regrets (9:23) (length)
Sending event: import_task_choice
Sending event: import_task_apply
0 of 6 items replaced
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: item_copied
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: after_write
Sending event: item_copied
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: after_write
Sending event: item_copied
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: after_write
Sending event: item_copied
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: after_write
Sending event: item_copied
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: after_write
Sending event: item_copied
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: after_write
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: import_task_files
Sending event: album_imported
Sending event: import
Sending event: cli_exit
main@htpc:~$ beet ls -f '$path'
/home/main/Music/Steven Wilson/4 1/2/01 My Book of Regrets.mp3
/home/main/Music/Steven Wilson/4 1/2/02 Year of the Plague.mp3
/home/main/Music/Steven Wilson/4 1/2/03 Happiness 3.mp3
/home/main/Music/Steven Wilson/4 1/2/04 Sunday Rain Sets In.mp3
/home/main/Music/Steven Wilson/4 1/2/05 Vermillioncore.mp3
/home/main/Music/Steven Wilson/4 1/2/06 Don't Hate Me.mp3
Seems like this issue has been around for quite a while. @sampsyo do you have a fix for this thing planned?
No. But I would love help investigating and fixing it! Please consider pitching in.
I have the same problem as the thread starter. Do we have hope for a solution?
I can't reproduce the bug, works fine for me as of today, can you give more insights ?
➜ ~ beet ls steven wilson -f '$path'
/media/drive3/BEETS/Steven Wilson/4 1_2/01-01.mp3
/media/drive3/BEETS/Steven Wilson/4 1_2/01-02.mp3
/media/drive3/BEETS/Steven Wilson/4 1_2/01-03.mp3
/media/drive3/BEETS/Steven Wilson/4 1_2/01-04.mp3
/media/drive3/BEETS/Steven Wilson/4 1_2/01-05.mp3
/media/drive3/BEETS/Steven Wilson/4 1_2/01-06.mp3
original path is
Looking up: /media/drive1/toadd/Steven Wilson - 4½ (2016) [V0]
If this still occurs, one could presumably work around it by adding a template func to a local plugin which provides a function that replaces os.sep with path_sep_replace? i.e. %path_sep{%asciify{$album}}
. You'd only use it when you know don't want it to preserve a sep, of course. I'm not sure if that'd be clean enough, but it'd preserve current semantics when it isn't used, at least.