File with .mp3 extension deleted by remux_mp3_in_wav
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 2.1k
- Avg merge
- 4d 21h
- Merged PRs (30d)
- 31
Description
If a file with a .mp3 extension is identified as a WAV file and triggers the remux_mp3_in_wav logic, the source .mp3 file will be rewritten and then deleted, so the file is lost.
### Problem
Running this command in verbose (`-vv`) mode:
```
D:\Music>beet -vv import "Rock, Metal, Alternative\The Cardigans"
user configuration: C:\Users\todd\AppData\Roaming\beets\config.yaml
data directory: C:\Users\todd\AppData\Roaming\beets
plugin paths: []
Loading plugins: albumtypes, chroma, discogs, embedart, fetchart, filetote, fromfilename, inline, lastgenre, lyrics, musicbrainz, rewrite
fetchart: lastfm: Disabling art source
due to missing key
fetchart: google: Disabling art source due to missing key
lastgenre: Loading whitelist D:\py-venv\Lib\site-packages\beetsplug\lastgenre\genres.txt
inline: adding item field disc_and_track
rewrite: adding template field artist Guns N’ Roses
rewrite: adding template field artist Blink-182
Sending event: pluginload
library database: C:\Users\todd\data\musiclibrary.db
library directory: D:\Music - Beets
Sending event: library_opened
Sending event: import_begin
Remuxed MPEGLAYER3 WAV to MP3: D:\Music\Rock, Metal, Alternative\The Cardigans\The Cardigans - Our Space.mp3
No files imported from D:\Music\Rock, Metal, Alternative\The Cardigans
Sending event: import
Sending event: cli_exit
```
Led to this problem:
"The Cardigans - Our Space.mp3" was deleted.
Here's a link to the music files that trigger the bug (if relevant):
[The Cardigans - Our Space.zip](https://github.com/user-attachments/files/29028696/The.Cardigans.-.Our.Space.zip)
### Setup
* OS: Windows 11
* Python version: 3.14.0
* beets version: 2.11.0
* Turning off plugins made problem go away (yes/no): No
My configuration (output of `beet config`) is:
```yaml
directory: D:\Music - Beets
# --------------- Main ---------------
library: ~/data/musiclibrary.db
original_date: yes
# --------------- Tagging ---------------
per_disc_numbering: yes
aunique:
keys: albumartist album
disambiguators: albumtype year country label catalognum albumdisambig releasegroupdisambig
bracket: '[]'
import:
move: yes
bell: yes
log: D:/Music/beets-import.log
# --------------- Plugins ---------------
plugins:
- musicbrainz
- chroma
- fetchart
- lastgenre
- fromfilename
- embedart
- discogs
- albumtypes
- lyrics
- inline
- filetote
- rewrite
lyrics:
auto: no
auto_ignore:
translate:
api_key: REDACTED
from_languages: []
to_language:
dist_thresh: 0.11
google_API_key: REDACTED
google_engine_ID: REDACTED
genius_api_key: REDACTED
fallback:
force: no
keep_synced: no
local: no
print: no
synced: no
sources: [lrclib, google, genius]
discogs:
user_token: REDACTED
search_limit: 5
data_source_mismatch_penalty: 0.5
search_query_ascii: no
apikey: REDACTED
apisecret: REDACTED
tokenfile: discogs_token.json
separator: ', '
index_tracks: no
append_style_genre: no
strip_disambiguation: yes
featured_string: Feat.
extra_tags: []
anv:
artist_credit: yes
artist: no
album_artist: no
lastgenre:
count: 3
whitelist: yes
min_weight: 10
fallback:
canonical: no
cleanup_existing: no
source: album
force: no
keep_existing: no
auto: yes
prefer_specific: no
title_case: yes
pretend: no
ignorelist: {}
item_fields:
disc_and_track: f"{disc:02d}.{track:02d}" if disctotal > 1 else f"{track:02d}"
paths:
default: $albumartist/($original_year) $album%aunique{albumartist album,albumtype year country albumdisambig releasegroupdisambig label catalognum} $atypes/$disc_and_track $title
albumtype:soundtrack: Various Artists/($original_year) $album%aunique{} $atypes/$disc_and_track $title
comp: Various Artists/($original_year) $album%aunique{} $atypes/$disc_and_track $title
singleton: $artist/$title
replace:
'[\\/]': _
^\.: _
'[\x00-\x1f]': _
'[<>"\*\|]': _
'[:]': "\uFF1A"
'[\?]': "\uFF1F"
\s+$: ''
^\s+: ''
^-: _
filetote:
patterns:
all: ['*.*']
artworkdir: ['[sS]cans/', '[aA]rtwork/']
paths:
artworkdir: $albumpath/$old_filename
all: $albumpath/$old_filename
exclude:
filenames: [Thumbs.DB, .DS_Store]
extensions: ''
patterns: {}
session:
operation:
_beets_lib:
_library_path:
import_path:
extensions: ''
filenames: ''
pairing:
enabled: no
pairing_only: no
extensions: .*
print_ignored: no
duplicate_action: merge
# --------------- Import ---------------
clutter: [Thumbs.DB, .DS_Store]
rewrite:
"artist Guns N\u2019 Roses": Guns N' Roses
artist Blink-182: blink-182
match:
preferred:
media: [CD]
disabled_plugins: []
musicbrainz:
search_limit: 5
data_source_mismatch_penalty: 0.5
search_query_ascii: no
genres: no
genres_tag: genre
external_ids:
discogs: no
bandcamp: no
spotify: no
deezer: no
tidal: no
extra_tags: []
chroma:
search_limit: 5
data_source_mismatch_penalty: 0.5
auto: yes
fetchart:
auto: yes
minwidth: 0
maxwidth: 0
quality: 0
max_filesize: 0
enforce_ratio: no
cautious: no
cover_names:
- cover
- front
- art
- album
- folder
fallback:
sources:
- filesystem
- coverart
- itunes
- amazon
- albumart
- cover_art_url
store_source: no
high_resolution: no
deinterlace: no
cover_format:
fanarttv_key: REDACTED
lastfm_key: REDACTED
google_key: REDACTED
google_engine: REDACTED
embedart:
maxwidth: 0
auto: yes
compare_threshold: 0
ifempty: no
remove_art_file: no
quality: 0
clearart_on_import: no
albumtypes:
types:
- [ep, EP]
- [single, Single]
- [soundtrack, OST]
- [live, Live]
- [compilation, Anthology]
- [remix, Remix]
ignore_va: [compilation]
bracket: '[]'
pathfields: {}
album_fields: {}
```
Contributor guide
Research direction
Start at the remux_mp3_in_wav logic reached by the verbose `beet import` command and reproduce the issue with the provided `.mp3` sample. Trace the import and rewrite flow to determine why the source path is deleted, then verify that a `.mp3` identified as WAV is remuxed without losing the source file.
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
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 57/100