beetbox / beets

music library manager and MusicBrainz tagger
http://beets.io/
MIT License
12.58k stars 1.8k forks source link

"scrub" isn't scrubbing. Is the "scrub" plugin broken? #5165

Open jaimet opened 3 months ago

jaimet commented 3 months ago

Problem

According to the docs, if I enable the scrub plugin then "beets will first strip all types of tags entirely and then write the database-tracked metadata to the file."

But when I import a music file with "extraneous metadata" (i.e. a tag/frame that I do not want to keep), the scrub plugin is not removing that tag/frame from the file:

# Check that the music file contains "extraneous metadata":
$ mid3v2 track.mp3 
IDv2 tag info for track.mp3
COMM==eng=I am an invincible comment! The scrub plugin is powerless against me!

# Now import the track:
$ beet -vv import track.mp3 
user configuration: /home/user/.config/beets/config.yaml
data directory: /home/user/.config/beets
plugin paths: 
Sending event: pluginload
library database: /home/user/.config/beets/library.db
library directory: /home/user/music
Sending event: library_opened
Sending event: import_begin
state file could not be read: [Errno 2] No such file or directory: '/home/user/.config/beets/state.pickle'
Sending event: import_task_created
Sending event: import_task_start
Looking up: /home/user/track.mp3
Tagging  - 
No album ID found.
Search terms:  - 
Album might be VA: True
Evaluating 0 candidates.

/home/user/track.mp3 (1 items)
Sending event: import_task_before_choice
Sending event: before_choose_candidate
No matching release found for 1 tracks.
For help, see: https://beets.readthedocs.org/en/latest/faq.html#nomatch
[S]kip, Use as-is, as Tracks, Group albums, Enter search, enter Id, aBort? T
Sending event: import_task_choice
Sending event: import_task_created
Sending event: import_task_start
Looking up: /home/user/track.mp3
Item search terms:  - 
Found 0 candidates.

/home/user/track.mp3
Sending event: before_choose_candidate
No matching recordings found.
[S]kip, Use as-is, Enter search, enter Id, aBort? I
Enter recording ID: 4d19d9d5-9174-4037-9dec-21b6c2cbcbb9
Searching for track ID: 4d19d9d5-9174-4037-9dec-21b6c2cbcbb9
Sending event: mb_track_extract
Sending event: trackinfo_received
Sending event: before_choose_candidate
Correcting track tags from:
     - 
To:
    Pinkfong - Baby Shark
URL:
    https://musicbrainz.org/recording/4d19d9d5-9174-4037-9dec-21b6c2cbcbb9
(Similarity: 0.0%) (title, length)
Apply, More candidates, Skip, Use as-is, Enter search, enter Id, aBort? A
Sending event: import_task_choice
Sending event: import_task_apply
0 of 1 items replaced
Sending event: database_change
Sending event: database_change
Sending event: item_copied
Sending event: database_change
Sending event: write
Sending event: after_write
Sending event: database_change
Sending event: import_task_files
scrub: auto-scrubbing /home/user/music/Non-Album/Pinkfong/Baby Shark.mp3
scrub: writing new tags after scrub
Sending event: write
Sending event: after_write
state file could not be read: [Errno 2] No such file or directory: '/home/user/.config/beets/state.pickle'
Sending event: item_imported
Sending event: import
Sending event: cli_exit
# I note the line above that says "scrub: auto-scrubbing .../Baby Shark.mp3"

# Now check whether the scrub plugin has removed the "extraneous metadata":
$ mid3v2 ~/music/Non-Album/Pinkfong/Baby\ Shark.mp3 
IDv2 tag info for /home/user/music/Non-Album/Pinkfong/Baby Shark.mp3
COMM==XXX=I am an invincible comment! The scrub plugin is powerless against me!
TBPM=0
TCMP=0
TDOR=0000
TDRC=0000
TIPL=[unrepresentable data]
TIT2=Baby Shark
TPE1=Pinkfong
TPOS=0/0
TRCK=0/0
TSOP=Pinkfong
TSRC=KRE671700001
TXXX=Artist Credit=Pinkfong
TXXX=MusicBrainz Artist Id=1af169ca-2cbd-4280-adcf-23963301448e
UFID=http://musicbrainz.org=b'4d19d9d5-9174-4037-9dec-21b6c2cbcbb9'
USLT==XXX=

So the scrub plugin has NOT removed the comment.

Setup

My configuration is:

$ beet config
directory: ~/music

plugins: scrub
scrub:
    auto: yes

Can anyone get the scrub plugin to actually scrub?

pngdeity commented 3 months ago

This isn't the answer to your question about the scrub plugin, but your use case might be served by enabling the from_scratch option in your config.

jaimet commented 3 months ago

Hi @pngdeity Thank you for the suggestion, but unfortunately I have already tried from_scratch without success - here is the bug report that I wrote in 2020 in which Adrian suggested that I use the scrub plugin instead.

(Here I talked about creating a bug report for the scrub plugin. It's only taken me a little over three and a half years to get round to posting this!)