"scrub" isn't scrubbing. Is the "scrub" plugin broken?
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 2.1k
- Avg merge
- 4d 21h
- Merged PRs (30d)
- 31
Description
### Problem
According to [the docs](https://beets.readthedocs.io/en/stable/plugins/scrub.html), 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
* OS: Debian bookworm
* Python version: 3.11.2
* beets version: 1.6.0
* Turning off plugins made problem go away (yes/no): n/a
My configuration is:
```
$ beet config
directory: ~/music
plugins: scrub
scrub:
auto: yes
```
Can anyone get the `scrub` plugin to actually scrub?
Contributor guide
Research direction
The issue names the scrub plugin and the beet import and mid3v2 entry points, but no source files or tests. Start by reproducing the import with an MP3 containing a COMM frame and plugins: scrub with scrub.auto enabled. Done means the extraneous comment is removed while the database-tracked metadata remains.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 44/100