beetbox / beets

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

albumtypes is converted from a string to a list of individual characters #4528

Closed MorgothSauron closed 1 year ago

MorgothSauron commented 1 year ago

Problem

After importing new files I will run beet update. Some of the tracks will have the albumtypes 'transformed' from a string (album) to a list of character (['a', 'l', 'b', 'u', 'm', ';', ' ', 'l', 'i', 'v', 'e']). The albumtype field will become a single character (album -> a)

I could not get the output with -vv because it doesn't seem to happen everytime. I deleted albums that previous triggered this problem and the problem didn't repeat on import and update again.

$ beet update

Led to this problem:

Ghost - Ceremony and Devotion - Square Hammer
  albumtypes: album; live -> ['a', 'l', 'b', 'u', 'm', ';', ' ', 'l', 'i', 'v', 'e']
  albumtype: live -> a
Ghost - Ceremony and Devotion - From the Pinnacle to the Pit
  albumtypes: album; live -> ['a', 'l', 'b', 'u', 'm', ';', ' ', 'l', 'i', 'v', 'e']
  albumtype: live -> a
Ghost - Ceremony and Devotion - Con clavi con dio
  albumtypes: album; live -> ['a', 'l', 'b', 'u', 'm', ';', ' ', 'l', 'i', 'v', 'e']
  albumtype: live -> a
Ghost - Ceremony and Devotion - Per aspera ad inferi
  albumtypes: album; live -> ['a', 'l', 'b', 'u', 'm', ';', ' ', 'l', 'i', 'v', 'e']
  albumtype: live -> a
Ghost - Ceremony and Devotion - Elizabeth
  albumtypes: album; live -> ['a', 'l', 'b', 'u', 'm', ';', ' ', 'l', 'i', 'v', 'e']
  albumtype: live -> a
Ghost - Ceremony and Devotion - Body and Blood
  albumtypes: album; live -> ['a', 'l', 'b', 'u', 'm', ';', ' ', 'l', 'i', 'v', 'e']
  albumtype: live -> a
Ghost - Ceremony and Devotion - Devil Church
  albumtypes: album; live -> ['a', 'l', 'b', 'u', 'm', ';', ' ', 'l', 'i', 'v', 'e']
  albumtype: live -> a
Ghost - Ceremony and Devotion - Cirice
  albumtypes: album; live -> ['a', 'l', 'b', 'u', 'm', ';', ' ', 'l', 'i', 'v', 'e']
  albumtype: live -> a
Ghost - Ceremony and Devotion - Ghuleh / Zombie Queen
  albumtypes: album; live -> ['a', 'l', 'b', 'u', 'm', ';', ' ', 'l', 'i', 'v', 'e']
  albumtype: live -> a
Ghost - Ceremony and Devotion - Year Zero
  albumtypes: album; live -> ['a', 'l', 'b', 'u', 'm', ';', ' ', 'l', 'i', 'v', 'e']
  albumtype: live -> a
Ghost - Ceremony and Devotion - Spöksonat
  albumtypes: album; live -> ['a', 'l', 'b', 'u', 'm', ';', ' ', 'l', 'i', 'v', 'e']
  albumtype: live -> a
Ghost - Ceremony and Devotion - He Is
  albumtypes: album; live -> ['a', 'l', 'b', 'u', 'm', ';', ' ', 'l', 'i', 'v', 'e']
  albumtype: live -> a
Ghost - Ceremony and Devotion - Mummy Dust
  albumtypes: album; live -> ['a', 'l', 'b', 'u', 'm', ';', ' ', 'l', 'i', 'v', 'e']
  albumtype: live -> a
Ghost - Ceremony and Devotion - Secular Haze
  albumtypes: album; live -> ['a', 'l', 'b', 'u', 'm', ';', ' ', 'l', 'i', 'v', 'e']
  albumtype: live -> a
Ghost - Ceremony and Devotion - Absolution
  albumtypes: album; live -> ['a', 'l', 'b', 'u', 'm', ';', ' ', 'l', 'i', 'v', 'e']
  albumtype: live -> a
Ghost - Ceremony and Devotion - Ritual
  albumtypes: album; live -> ['a', 'l', 'b', 'u', 'm', ';', ' ', 'l', 'i', 'v', 'e']
  albumtype: live -> a
Arch Enemy - Wages of Sin - Enemy Within
  albumtypes: album -> ['a', 'l', 'b', 'u', 'm']
  albumtype: album -> a
Arch Enemy - Wages of Sin - Burning Angel
  albumtypes: album -> ['a', 'l', 'b', 'u', 'm']
  albumtype: album -> a
Arch Enemy - Wages of Sin - Heart of Darkness
  albumtypes: album -> ['a', 'l', 'b', 'u', 'm']
  albumtype: album -> a
Arch Enemy - Wages of Sin - Ravenous
  albumtypes: album -> ['a', 'l', 'b', 'u', 'm']
  albumtype: album -> a
Arch Enemy - Wages of Sin - Savage Messiah
  albumtypes: album -> ['a', 'l', 'b', 'u', 'm']
  albumtype: album -> a
Glenn Tipton - Baptizm of Fire - Hard Core
  albumtypes: album -> ['a', 'l', 'b', 'u', 'm']
  albumtype: album -> a
Glenn Tipton - Baptizm of Fire - Paint It Black
  albumtypes: album -> ['a', 'l', 'b', 'u', 'm']
  albumtype: album -> a
Glenn Tipton - Baptizm of Fire - Enter the Storm
  albumtypes: album -> ['a', 'l', 'b', 'u', 'm']
  albumtype: album -> a
Glenn Tipton - Baptizm of Fire - Fuel Me Up
  albumtypes: album -> ['a', 'l', 'b', 'u', 'm']
  albumtype: album -> a
Glenn Tipton - Baptizm of Fire - Extinct
  albumtypes: album -> ['a', 'l', 'b', 'u', 'm']
  albumtype: album -> a
Glenn Tipton - Baptizm of Fire - Baptizm of Fire
  albumtypes: album -> ['a', 'l', 'b', 'u', 'm']
  albumtype: album -> a
Glenn Tipton - Baptizm of Fire - The Healer
  albumtypes: album -> ['a', 'l', 'b', 'u', 'm']
  albumtype: album -> a
Glenn Tipton - Baptizm of Fire - Cruise Control
  albumtypes: album -> ['a', 'l', 'b', 'u', 'm']
  albumtype: album -> a

Setup

My configuration (output of beet config) is:

lyrics:
    bing_lang_from: []
    auto: yes
    force: yes
    fallback: ''
    bing_client_secret: REDACTED
    bing_lang_to:
    google_API_key: REDACTED
    google_engine_ID: REDACTED
    genius_api_key: REDACTED
    local: no
    sources:
    - google
    - musixmatch
    - genius
    - tekstowo
library: /home/mcarpentier/Music/.beets/BeetMusicLibrary.blb
directory: /home/mcarpentier/Music

ui:
    color: yes
    colors:
        text_success: green
        text_warning: yellow
        text_error: red
        text_highlight: red
        text_highlight_minor: lightgray
        action_default: turquoise
        action: blue

import:
    copy: no
    write: yes
    move: yes

plugins: embedart fetchart info lyrics
embedart:
    auto: yes
    maxwidth: 0
    compare_threshold: 0
    ifempty: no
    remove_art_file: no
    quality: 0

paths:
    default: $albumartist/$album%aunique{}/$track $title
    singleton: Non-Album/$artist/$title
    comp: Compilations/$album%aunique{}/$track $title
fetchart:
    auto: yes
    minwidth: 0
    maxwidth: 0
    quality: 0
    max_filesize: 0
    enforce_ratio: no
    cautious: no
    cover_names:
    - cover
    - front
    - art
    - album
    - folder
    sources:
    - filesystem
    - coverart
    - itunes
    - amazon
    - albumart
    google_key: REDACTED
    google_engine: 001442825323518660753:hrh5ch1gjzm
    fanarttv_key: REDACTED
    lastfm_key: REDACTED
    store_source: no
    high_resolution: no
    deinterlace: no
    cover_format:
MorgothSauron commented 1 year ago

I checked the flac file metadata with metaflac and album type is defined multiple time ... one tag for each letter

RELEASETYPE=a
RELEASETYPE=l
RELEASETYPE=b
RELEASETYPE=u
RELEASETYPE=m
MUSICBRAINZ_ALBUMTYPE=a
MUSICBRAINZ_ALBUMTYPE=l
MUSICBRAINZ_ALBUMTYPE=b
MUSICBRAINZ_ALBUMTYPE=u
MUSICBRAINZ_ALBUMTYPE=m

How can I fix the broken tags ? Can I disable this plugin ?

MorgothSauron commented 1 year ago

I tried to investigate this issue a little bit. Lets hope this information will be useful

I started by re-importing the library: beet import ~/Music. The library is mostly comprised of FLAC files.,

There was nothing displayed when I ran beet update -p.

I used metaflac --export-tags-to to export tags for all tracks in my library.

Things got worse. Now every single file have these weird tags.

Example for /home/mcarpentier/Music/Trivium/Shogun/01 Kirisute Gomen.flac

metaflac:

RELEASETYPE=a
RELEASETYPE=l
RELEASETYPE=b
RELEASETYPE=u
RELEASETYPE=m
MUSICBRAINZ_ALBUMTYPE=a
MUSICBRAINZ_ALBUMTYPE=l
MUSICBRAINZ_ALBUMTYPE=b
MUSICBRAINZ_ALBUMTYPE=u
MUSICBRAINZ_ALBUMTYPE=m

beet info:

         acoustid_id: 
               album: Shogun
         albumartist: Trivium
  albumartist_credit: Trivium
    albumartist_sort: Trivium
        albumartists: 
       albumdisambig: 
         albumstatus: Official
           albumtype: a
          albumtypes: a; l; b; u; m

I deleted the tags from the FLAC files for this album:

metaflac --remove-tag MUSICBRAINZ_ALBUMTYPE *.flac
metaflac --remove-tag RELEASETYPE *.flac

I ran an update

$ beet update   
Trivium - Shogun - Kirisute Gomen
  albumtype: album -> 
  albumtypes: album -> []
Trivium - Shogun - Torn Between Scylla and Charybdis
  albumtype: album -> 
  albumtypes: album -> []
Trivium - Shogun - Down From the Sky
  albumtype: album -> 
  albumtypes: album -> []
Trivium - Shogun - Into the Mouth of Hell We March
  albumtype: album -> 
  albumtypes: album -> []
Trivium - Shogun - Throes of Perdition
  albumtype: album -> 
  albumtypes: album -> []
Trivium - Shogun - Insurrection
  albumtype: album -> 
  albumtypes: album -> []
Trivium - Shogun - The Calamity
  albumtype: album -> 
  albumtypes: album -> []
Trivium - Shogun - He Who Spawned the Furies
  albumtype: album -> 
  albumtypes: album -> []
Trivium - Shogun - Of Prometheus and the Crucifix
  albumtype: album -> 
  albumtypes: album -> []
Trivium - Shogun - Like Callisto to a Star in Heaven
  albumtype: album -> 
  albumtypes: album -> []
Trivium - Shogun - Shogun
  albumtype: album -> 
  albumtypes: album -> []
Trivium - Shogun - Poison, the Knife or the Noose
  albumtype: album -> 
  albumtypes: album -> []
Trivium - Shogun - Upon the Shores
  albumtype: album -> 
  albumtypes: album -> []
Trivium - Shogun - Iron Maiden
  albumtype: album -> 
  albumtypes: album -> []

I added the tag back with a proper value

metaflac --set-tag MUSICBRAINZ_ALBUMTYPE=album *.flac
metaflac --set-tag RELEASETYPE=album *.flac

And I ran update for the last time

$ beet update   
Trivium - Shogun - Kirisute Gomen
  albumtype:  -> album
  albumtypes: [] -> ['album']
Trivium - Shogun - Torn Between Scylla and Charybdis
  albumtype:  -> album
  albumtypes: [] -> ['album']
Trivium - Shogun - Down From the Sky
  albumtype:  -> album
  albumtypes: [] -> ['album']
Trivium - Shogun - Into the Mouth of Hell We March
  albumtype:  -> album
  albumtypes: [] -> ['album']
Trivium - Shogun - Throes of Perdition
  albumtype:  -> album
  albumtypes: [] -> ['album']
Trivium - Shogun - Insurrection
  albumtype:  -> album
  albumtypes: [] -> ['album']
Trivium - Shogun - The Calamity
  albumtype:  -> album
  albumtypes: [] -> ['album']
Trivium - Shogun - He Who Spawned the Furies
  albumtype:  -> album
  albumtypes: [] -> ['album']
Trivium - Shogun - Of Prometheus and the Crucifix
  albumtype:  -> album
  albumtypes: [] -> ['album']
Trivium - Shogun - Like Callisto to a Star in Heaven
  albumtype:  -> album
  albumtypes: [] -> ['album']
Trivium - Shogun - Shogun
  albumtype:  -> album
  albumtypes: [] -> ['album']
Trivium - Shogun - Poison, the Knife or the Noose
  albumtype:  -> album
  albumtypes: [] -> ['album']
Trivium - Shogun - Upon the Shores
  albumtype:  -> album
  albumtypes: [] -> ['album']
Trivium - Shogun - Iron Maiden
  albumtype:  -> album
  albumtypes: [] -> ['album']

I'm not sure I get it right, but it seems that the error comes from the tag in the FLAC file. beet sees, for example MUSICBRAINZ_ALBUMTYPE, mutliple times (once for each letter) than builds its own values for the database (~/Music/.beet/BeetMusicLibrary.blb)

At this point I will check every single file to make sure tags MUSICBRAINZ_ALBUMTYPE and RELEASETYPE are properly set. By properly set I mean to have a real value (e.g. album, live) and not a single character.

Edit: I have many more CDs to rip with K3b. I will check if the tag issue comes from the initial tag set by K3b.

MorgothSauron commented 1 year ago

I ripped a brand new CD with K3b. The tags set on the flac files are rather minimal at this point:

ARTIST=Deficiency
TITLE=Warenta
TRACKNUMBER=01
DATE=2022
ALBUM=Warenta

I ran an import and got those weird tags again:

RELEASETYPE=a
RELEASETYPE=l
RELEASETYPE=b
RELEASETYPE=u
RELEASETYPE=m
MUSICBRAINZ_ALBUMTYPE=a
MUSICBRAINZ_ALBUMTYPE=l
MUSICBRAINZ_ALBUMTYPE=b
MUSICBRAINZ_ALBUMTYPE=u
MUSICBRAINZ_ALBUMTYPE=m

I deleted the tracks to re-import them using beet -vv import

$ beet -vv import /tmp/music
overlaying configuration: /home/mcarpentier/Music/.beets/config.yaml
no user configuration found at /home/mcarpentier/.config/beets/config.yaml
data directory: /home/mcarpentier/.config/beets
plugin paths: 
lyrics: To use the google lyrics source, you must install the beautifulsoup4 module. See the documentation for further details.
lyrics: To use the genius lyrics source, you must install the beautifulsoup4 module. See the documentation for further details.
lyrics: To use the tekstowo lyrics source, you must install the beautifulsoup4 module. See the documentation for further details.
Sending event: pluginload
library database: /home/mcarpentier/Music/.beets/BeetMusicLibrary.blb
library directory: /home/mcarpentier/Music
Sending event: library_opened
Sending event: import_begin
Sending event: import_task_created
Sending event: import_task_start
Looking up: /tmp/music/Deficiency - Warenta
Tagging Deficiency - Warenta
No album ID found.
Search terms: Deficiency - Warenta
Album might be VA: False
Searching for MusicBrainz releases with: {'release': 'warenta', 'artist': 'deficiency', 'tracks': '10'}
Requesting MusicBrainz release fc2084ae-8986-4a4f-8303-dc7a2115a104
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_album_extract
Sending event: albuminfo_received
Candidate: Deficiency - Warenta (fc2084ae-8986-4a4f-8303-dc7a2115a104)
Computing track assignment...
...done.
Success. Distance: 0.00
Requesting MusicBrainz release cb50ed2e-df4c-4d61-bdb5-55065bfca1a4
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_album_extract
Sending event: albuminfo_received
Candidate: Deficiency - Warenta (cb50ed2e-df4c-4d61-bdb5-55065bfca1a4)
Computing track assignment...
...done.
Success. Distance: 0.00
Requesting MusicBrainz release 03a34296-0bdc-4549-861e-fa70a0c3be12
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_album_extract
Sending event: albuminfo_received
Candidate: Deficiency - The Prodigal Child (03a34296-0bdc-4549-861e-fa70a0c3be12)
Computing track assignment...
...done.
Success. Distance: 0.58
Requesting MusicBrainz release 15e4a67f-c7e6-49be-aa73-04366ad822ba
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_album_extract
Sending event: albuminfo_received
Candidate: Deficiency - The Dawn of Consciousness (15e4a67f-c7e6-49be-aa73-04366ad822ba)
Computing track assignment...
...done.
Success. Distance: 0.59
Requesting MusicBrainz release 5c531a47-85ca-4c4b-a85e-2a376ee4708c
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_track_extract
Sending event: mb_album_extract
Sending event: albuminfo_received
Candidate: Deficiency - The Dawn of Consciousness (5c531a47-85ca-4c4b-a85e-2a376ee4708c)
Computing track assignment...
...done.
Success. Distance: 0.59
Evaluating 5 candidates.

/tmp/music/Deficiency - Warenta (10 items)
Sending event: import_task_before_choice
Sending event: before_choose_candidate
Tagging:
    Deficiency - Warenta
URL:
    https://musicbrainz.org/release/fc2084ae-8986-4a4f-8303-dc7a2115a104
(Similarity: 100.0%) (CD, 2022, FR, Metal East Productions, MEP2202CD)
Sending event: import_task_choice
Sending event: import_task_apply
0 of 10 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: 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
fetchart: trying source filesystem for album Deficiency - Warenta
fetchart: trying source coverart for album Deficiency - Warenta
fetchart: getting URL: https://coverartarchive.org/release/fc2084ae-8986-4a4f-8303-dc7a2115a104
fetchart: Cover Art Archive: error loading response: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>404 Not Found</title>
<h1>Not Found</h1>
<p>No cover art found for release fc2084ae-8986-4a4f-8303-dc7a2115a104</p>

fetchart: trying source coverart for album Deficiency - Warenta
fetchart: getting URL: https://coverartarchive.org/release-group/743c85f5-6cd7-4c54-95fd-476de69c6b9b
fetchart: Cover Art Archive: error loading response: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>404 Not Found</title>
<h1>Not Found</h1>
<p>No cover art found for release group 743c85f5-6cd7-4c54-95fd-476de69c6b9b</p>

fetchart: trying source itunes for album Deficiency - Warenta
fetchart: getting URL: https://itunes.apple.com/search?term=Deficiency+Warenta&entity=album&media=music&limit=200
fetchart: downloading image: https://is2-ssl.mzstatic.com/image/thumb/Music116/v4/a5/a2/9e/a5a29e9d-3703-f397-9abb-cc55beb7c2e8/cover.jpg/1200x1200bb.jpg
fetchart: downloaded art to: /run/user/1000/tmpk1dailk4.jpg
fetchart: using remote image /run/user/1000/tmpk1dailk4.jpg
lyrics: failed to fetch: https://www.musixmatch.com/lyrics/Deficiency/Warenta (404)
lyrics: lyrics not found: Deficiency - Warenta - Warenta
lyrics: failed to fetch: https://www.musixmatch.com/lyrics/Deficiency/Dichtonomy (404)
lyrics: lyrics not found: Deficiency - Warenta - Dichtonomy
lyrics: failed to fetch: https://www.musixmatch.com/lyrics/Deficiency/I-Am-The-Misfortune-Herald (404)
lyrics: lyrics not found: Deficiency - Warenta - I Am the Misfortune Herald
lyrics: failed to fetch: https://www.musixmatch.com/lyrics/Deficiency/The-Black-Book (404)
lyrics: lyrics not found: Deficiency - Warenta - The Black Book
lyrics: failed to fetch: https://www.musixmatch.com/lyrics/Deficiency/The-Feathers (404)
lyrics: lyrics not found: Deficiency - Warenta - The Feathers
lyrics: failed to fetch: https://www.musixmatch.com/lyrics/Deficiency/Lumpendoktor (404)
lyrics: lyrics not found: Deficiency - Warenta - Lumpendoktor
lyrics: failed to fetch: https://www.musixmatch.com/lyrics/Deficiency/Ludma (404)
lyrics: lyrics not found: Deficiency - Warenta - Ludma
lyrics: failed to fetch: https://www.musixmatch.com/lyrics/Deficiency/A-Fire-Asleep (404)
lyrics: lyrics not found: Deficiency - Warenta - A Fire Asleep
lyrics: failed to fetch: https://www.musixmatch.com/lyrics/Deficiency/Alliviate-The-Suffering (404)
lyrics: lyrics not found: Deficiency - Warenta - Alliviate the Suffering
lyrics: failed to fetch: https://www.musixmatch.com/lyrics/Deficiency/Real-Is-Revealed (404)
lyrics: lyrics not found: Deficiency - Warenta - Real is Revealed
Sending event: before_item_moved
Sending event: item_moved
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: after_write
Sending event: before_item_moved
Sending event: item_moved
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: after_write
Sending event: before_item_moved
Sending event: item_moved
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: after_write
Sending event: before_item_moved
Sending event: item_moved
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: after_write
Sending event: before_item_moved
Sending event: item_moved
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: after_write
Sending event: before_item_moved
Sending event: item_moved
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: after_write
Sending event: before_item_moved
Sending event: item_moved
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: after_write
Sending event: before_item_moved
Sending event: item_moved
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: after_write
Sending event: before_item_moved
Sending event: item_moved
Sending event: database_change
Sending event: database_change
Sending event: write
Sending event: after_write
Sending event: before_item_moved
Sending event: item_moved
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: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: import_task_files
Sending event: art_set
embedart: Embedding album art into Deficiency - Warenta
embedart: embedding /home/mcarpentier/Music/Deficiency/Warenta/cover.jpg
Sending event: write
Sending event: after_write
embedart: embedding /home/mcarpentier/Music/Deficiency/Warenta/cover.jpg
Sending event: write
Sending event: after_write
embedart: embedding /home/mcarpentier/Music/Deficiency/Warenta/cover.jpg
Sending event: write
Sending event: after_write
embedart: embedding /home/mcarpentier/Music/Deficiency/Warenta/cover.jpg
Sending event: write
Sending event: after_write
embedart: embedding /home/mcarpentier/Music/Deficiency/Warenta/cover.jpg
Sending event: write
Sending event: after_write
embedart: embedding /home/mcarpentier/Music/Deficiency/Warenta/cover.jpg
Sending event: write
Sending event: after_write
embedart: embedding /home/mcarpentier/Music/Deficiency/Warenta/cover.jpg
Sending event: write
Sending event: after_write
embedart: embedding /home/mcarpentier/Music/Deficiency/Warenta/cover.jpg
Sending event: write
Sending event: after_write
embedart: embedding /home/mcarpentier/Music/Deficiency/Warenta/cover.jpg
Sending event: write
Sending event: after_write
embedart: embedding /home/mcarpentier/Music/Deficiency/Warenta/cover.jpg
Sending event: write
Sending event: after_write
Sending event: database_change
Sending event: album_imported
Sending event: import
Sending event: cli_exit
$ 

Finally, what would be changed by an update:

$ beet update -p
Deficiency - Warenta - Dichtonomy
  albumtypes: album -> ['a', 'l', 'b', 'u', 'm']
  albumtype: album -> a
Deficiency - Warenta - I Am the Misfortune Herald
  albumtypes: album -> ['a', 'l', 'b', 'u', 'm']
  albumtype: album -> a
Deficiency - Warenta - The Black Book
  albumtypes: album -> ['a', 'l', 'b', 'u', 'm']
  albumtype: album -> a
Deficiency - Warenta - The Feathers
  albumtypes: album -> ['a', 'l', 'b', 'u', 'm']
  albumtype: album -> a
Deficiency - Warenta - Lumpendoktor
  albumtypes: album -> ['a', 'l', 'b', 'u', 'm']
  albumtype: album -> a
Deficiency - Warenta - Ludma
  albumtypes: album -> ['a', 'l', 'b', 'u', 'm']
  albumtype: album -> a
Deficiency - Warenta - A Fire Asleep
  albumtypes: album -> ['a', 'l', 'b', 'u', 'm']
  albumtype: album -> a
Deficiency - Warenta - Alliviate the Suffering
  albumtypes: album -> ['a', 'l', 'b', 'u', 'm']
  albumtype: album -> a
Deficiency - Warenta - Real is Revealed
  albumtypes: album -> ['a', 'l', 'b', 'u', 'm']
  albumtype: album -> a
$ 
sampsyo commented 1 year ago

Wow; that certainly does look bad! Is there a chance you could try running the latest source version of beets to see if the bug exists there?

MorgothSauron commented 1 year ago

/home/mcarpentier/Temp/Deficiency - Warenta (10 items) Sending event: import_task_before_choice Sending event: before_choose_candidate Tagging: Deficiency - Warenta URL: https://musicbrainz.org/release/fc2084ae-8986-4a4f-8303-dc7a2115a104 (Similarity: 100.0%) (CD, 2022, FR, Metal East Productions, MEP2202CD) Sending event: import_task_choice Sending event: import_task_apply 0 of 10 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: 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 fetchart: trying source filesystem for album Deficiency - Warenta fetchart: trying source coverart for album Deficiency - Warenta fetchart: getting URL: https://coverartarchive.org/release/fc2084ae-8986-4a4f-8303-dc7a2115a104 fetchart: Cover Art Archive: error loading response: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

404 Not Found

Not Found

No cover art found for release fc2084ae-8986-4a4f-8303-dc7a2115a104

fetchart: trying source coverart for album Deficiency - Warenta fetchart: getting URL: https://coverartarchive.org/release-group/743c85f5-6cd7-4c54-95fd-476de69c6b9b fetchart: Cover Art Archive: error loading response: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

404 Not Found

Not Found

No cover art found for release group 743c85f5-6cd7-4c54-95fd-476de69c6b9b

fetchart: trying source itunes for album Deficiency - Warenta fetchart: getting URL: https://itunes.apple.com/search?term=Deficiency+Warenta&entity=album&media=music&limit=200 fetchart: downloading image: https://is2-ssl.mzstatic.com/image/thumb/Music116/v4/a5/a2/9e/a5a29e9d-3703-f397-9abb-cc55beb7c2e8/cover.jpg/1200x1200bb.jpg fetchart: downloaded art to: /run/user/1000/tmpt7vz_u47.jpg fetchart: using remote image /run/user/1000/tmpt7vz_u47.jpg lyrics: failed to fetch: https://www.musixmatch.com/lyrics/Deficiency/Warenta (404) lyrics: lyrics not found: Deficiency - Warenta - Warenta lyrics: failed to fetch: https://www.musixmatch.com/lyrics/Deficiency/Dichtonomy (404) lyrics: lyrics not found: Deficiency - Warenta - Dichtonomy lyrics: failed to fetch: https://www.musixmatch.com/lyrics/Deficiency/I-Am-The-Misfortune-Herald (404) lyrics: lyrics not found: Deficiency - Warenta - I Am the Misfortune Herald lyrics: failed to fetch: https://www.musixmatch.com/lyrics/Deficiency/The-Black-Book (404) lyrics: lyrics not found: Deficiency - Warenta - The Black Book lyrics: failed to fetch: https://www.musixmatch.com/lyrics/Deficiency/The-Feathers (404) lyrics: lyrics not found: Deficiency - Warenta - The Feathers lyrics: failed to fetch: https://www.musixmatch.com/lyrics/Deficiency/Lumpendoktor (404) lyrics: lyrics not found: Deficiency - Warenta - Lumpendoktor lyrics: failed to fetch: https://www.musixmatch.com/lyrics/Deficiency/Ludma (404) lyrics: lyrics not found: Deficiency - Warenta - Ludma lyrics: failed to fetch: https://www.musixmatch.com/lyrics/Deficiency/A-Fire-Asleep (404) lyrics: lyrics not found: Deficiency - Warenta - A Fire Asleep lyrics: failed to fetch: https://www.musixmatch.com/lyrics/Deficiency/Alliviate-The-Suffering (404) lyrics: lyrics not found: Deficiency - Warenta - Alliviate the Suffering lyrics: failed to fetch: https://www.musixmatch.com/lyrics/Deficiency/Real-Is-Revealed (404) lyrics: lyrics not found: Deficiency - Warenta - Real is Revealed Sending event: before_item_moved Sending event: item_moved Sending event: database_change Sending event: database_change Sending event: write Sending event: after_write Sending event: before_item_moved Sending event: item_moved Sending event: database_change Sending event: database_change Sending event: write Sending event: after_write Sending event: before_item_moved Sending event: item_moved Sending event: database_change Sending event: database_change Sending event: write Sending event: after_write Sending event: before_item_moved Sending event: item_moved Sending event: database_change Sending event: database_change Sending event: write Sending event: after_write Sending event: before_item_moved Sending event: item_moved Sending event: database_change Sending event: database_change Sending event: write Sending event: after_write Sending event: before_item_moved Sending event: item_moved Sending event: database_change Sending event: database_change Sending event: write Sending event: after_write Sending event: before_item_moved Sending event: item_moved Sending event: database_change Sending event: database_change Sending event: write Sending event: after_write Sending event: before_item_moved Sending event: item_moved Sending event: database_change Sending event: database_change Sending event: write Sending event: after_write Sending event: before_item_moved Sending event: item_moved Sending event: database_change Sending event: database_change Sending event: write Sending event: after_write Sending event: before_item_moved Sending event: item_moved 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: database_change Sending event: database_change Sending event: database_change Sending event: database_change Sending event: import_task_files Sending event: art_set embedart: Embedding album art into Deficiency - Warenta embedart: embedding /home/mcarpentier/Music/Deficiency/Warenta/cover.jpg Sending event: write Sending event: after_write embedart: embedding /home/mcarpentier/Music/Deficiency/Warenta/cover.jpg Sending event: write Sending event: after_write embedart: embedding /home/mcarpentier/Music/Deficiency/Warenta/cover.jpg Sending event: write Sending event: after_write embedart: embedding /home/mcarpentier/Music/Deficiency/Warenta/cover.jpg Sending event: write Sending event: after_write embedart: embedding /home/mcarpentier/Music/Deficiency/Warenta/cover.jpg Sending event: write Sending event: after_write embedart: embedding /home/mcarpentier/Music/Deficiency/Warenta/cover.jpg Sending event: write Sending event: after_write embedart: embedding /home/mcarpentier/Music/Deficiency/Warenta/cover.jpg Sending event: write Sending event: after_write embedart: embedding /home/mcarpentier/Music/Deficiency/Warenta/cover.jpg Sending event: write Sending event: after_write embedart: embedding /home/mcarpentier/Music/Deficiency/Warenta/cover.jpg Sending event: write Sending event: after_write embedart: embedding /home/mcarpentier/Music/Deficiency/Warenta/cover.jpg Sending event: write Sending event: after_write Sending event: database_change Sending event: album_imported Sending event: import Sending event: cli_exit $

- Tags on the imported file shows the same problem. I include all the tags in case it might be useful

$ metaflac --export-tags-to=/dev/stdout 01\ Warenta.flac ACOUSTID_FINGERPRINT= ACOUSTID_ID= ALBUM=Warenta ALBUM ARTIST=Deficiency ALBUM_ARTIST=Deficiency ALBUMARTIST=Deficiency ALBUMARTIST_CREDIT=Deficiency ALBUMARTISTSORT=Deficiency MUSICBRAINZ_ALBUMCOMMENT= RELEASESTATUS=Official MUSICBRAINZ_ALBUMSTATUS=Official RELEASETYPE=a RELEASETYPE=l RELEASETYPE=b RELEASETYPE=u RELEASETYPE=m MUSICBRAINZ_ALBUMTYPE=a MUSICBRAINZ_ALBUMTYPE=l MUSICBRAINZ_ALBUMTYPE=b MUSICBRAINZ_ALBUMTYPE=u MUSICBRAINZ_ALBUMTYPE=m ARRANGER= ARTIST=Deficiency ARTIST_CREDIT=Deficiency ARTISTSORT=Deficiency ASIN= BPM=0 CATALOGNUMBER=MEP2202CD DESCRIPTION= COMMENT= COMPILATION=0 COMPOSER= COMPOSERSORT= RELEASECOUNTRY=FR DATE=2022-03-11 YEAR=2022 DISC=1 DISCNUMBER=1 DISCSUBTITLE= DISCTOTAL=1 DISCC=1 TOTALDISCS=1 ENCODEDBY= ENCODER= GENRE= GROUPING= ISRC= LABEL=Metal East Productions PUBLISHER=Metal East Productions LANGUAGE=mul LYRICIST= LYRICS= MUSICBRAINZ_ALBUMARTISTID=0f64fef8-d3b0-4eb4-8bc7-43fd77971c20 MUSICBRAINZ_ALBUMID=fc2084ae-8986-4a4f-8303-dc7a2115a104 MUSICBRAINZ_ARTISTID=0f64fef8-d3b0-4eb4-8bc7-43fd77971c20 MUSICBRAINZ_RELEASEGROUPID=743c85f5-6cd7-4c54-95fd-476de69c6b9b MUSICBRAINZ_RELEASETRACKID=8f98e18a-24b5-4074-be72-74c4dd9e3c27 MUSICBRAINZ_TRACKID=d6a714f0-cfb4-4571-a09c-0a3d2628fb26 MUSICBRAINZ_WORKID= MEDIA=CD ORIGINALDATE=2022-03-11 SCRIPT=Latn TITLE=Warenta TRACK=1 TRACKNUMBER=1 TRACKTOTAL=10 TRACKC=10 TOTALTRACKS=10 $

- beet track information where we can see the `albumtypes` as a list of characters

$ beet info "01 Warenta.flac" /home/mcarpentier/Music/Deficiency/Warenta/01 Warenta.flac acoustid_fingerprint: acoustid_id: album: Warenta albumartist: Deficiency albumartist_credit: Deficiency albumartist_sort: Deficiency albumartists: albumdisambig: albumstatus: Official albumtype: a albumtypes: a; l; b; u; m arranger: art: True artist: Deficiency artist_credit: Deficiency artist_sort: Deficiency artists: asin: bitdepth: 16 bitrate: 973062 bitrate_mode: bpm: 0 catalognum: MEP2202CD catalognums: MEP2202CD channels: 2 comments: comp: False composer: composer_sort: country: FR date: 2022-03-11 day: 11 disc: 1 disctitle: disctotal: 1 encoder: encoder_info: encoder_settings: format: FLAC genre: genres: grouping: isrc: label: Metal East Productions language: mul languages: mul length: 335.0133333333333 lyricist: lyrics: mb_albumartistid: 0f64fef8-d3b0-4eb4-8bc7-43fd77971c20 mb_albumartistids: 0f64fef8-d3b0-4eb4-8bc7-43fd77971c20 mb_albumid: fc2084ae-8986-4a4f-8303-dc7a2115a104 mb_artistid: 0f64fef8-d3b0-4eb4-8bc7-43fd77971c20 mb_artistids: 0f64fef8-d3b0-4eb4-8bc7-43fd77971c20 mb_releasegroupid: 743c85f5-6cd7-4c54-95fd-476de69c6b9b mb_releasetrackid: 8f98e18a-24b5-4074-be72-74c4dd9e3c27 mb_trackid: d6a714f0-cfb4-4571-a09c-0a3d2628fb26 mb_workid: media: CD month: 3 original_date: 2022-03-11 original_day: 11 original_month: 3 original_year: 2022 samplerate: 44100 script: Latn title: Warenta track: 1 tracktotal: 10 year: 2022 $

sampsyo commented 1 year ago

Argh! Thank you for checking. This is certainly bad—and I'm not sure on first glance whether the issue is in beets itself or in MediaFile (possibly recent changes therein). But we should track it down…

Gilfar commented 1 year ago

I hit the same problem and was debugging a bit. This happens due to beets sending strings for both albumtype and albumtypes when MediaFile expects both fields to be a list of string. Due to this MediaFile happily uses a string as a list of characters which leads to this tag mess. I would assume this is a bug on beets side and it should send a list instead of ";" delimited strings.

sampsyo commented 1 year ago

Interesting! Can you clarify what you mean by "sending strings"? Is there a particular line of code you're looking at that assigned to album.albumtypes?

Gilfar commented 1 year ago

I made a quick fix in library.py at 761 in write method adding

        if "albumtype" in item_tags:
            if item_tags["albumtype"] == "[":
                item_tags["albumtype"] = None
            else:
                item_tags["albumtype"] = item_tags["albumtype"].split(";")
        if "albumtypes" in item_tags:
            if item_tags["albumtypes"] == "['[', ']']" or item_tags["albumtypes"] == "[]":
                item_tags["albumtypes"] = None
            else:
                item_tags["albumtypes"] = item_tags["albumtypes"].split(";")

as this issue also affects empty albumtypes. In my case I had entries in beets db with albumtype [ and albumtypes with ['[', ']'] or []. This is not a proper fix as beet update works correctly however beet write always wants to apply the changes for albumtypes i.e.

albumtypes: ['single', ' remix'] -> single; remix
or
albumtypes: ['single'] -> single
jpluscplusm commented 1 year ago

I'm also hitting this on v1.6.0. It seems to get /reverted/ by a simple beet write, but then it appears that the albumtype and albumtypes fields flip flop between good (as expected) and bad (arrays of strings) values.

jpluscplusm commented 1 year ago

I've done some digging, and I believe the root cause here is that 1.6.0's introduction of albumtypes (plural) represents the first time that beets is setting or getting a type that's serialised via MediaFiles ListMediaField type (https://github.com/beetbox/mediafile/blob/master/mediafile.py#L1931).

Before now, I /think/ beets was storing (in its DB) only the singular version of any pluralised element. e.g. genre, not genres; language, not languages. Thus it never had to deal with List/Array types.

With the introduction of albumtypes, a subtle problem has arisen which doesn't appear to have a simple fix. The simple fix would seem to be to change MediaFile's albumtypes underlying type into a string, and make it the consumer's responsibility to feed it appropriately delineated strings. But I'm going to assume that that ship has sailed, as MediaFile is a project consumed by multiple downstream projects, and changing the underlying type (on the line referenced above) simply isn't an option.

If changing MediaFile is an option (paging @sampsyo!) then I think that's the hugely easier fix.

I think the harder fix is to teach beets how to round-trip list types into and out of the DB, whilst (I suspect) serialising them as /strings/ in the tagging but de-serialising into lists in the internal model. I'm currently working on this, but I'd very much like to validate my assumptions about the problem, and most important double-check that changing MediaFile isn't an option, before I propose a hairy change!

jpluscplusm commented 1 year ago

Ok, it wasn't as hairy a change as I feared. I've pushed a 90% WorksForMe fix up to https://github.com/jpluscplusm/beets/tree/jcm_fix_albumtypes.

I've tested it on 2 albums: 1 with just the one single albumtype, and 1 with 2 albumtypes. I'm getting some annoying flip/flopping on the multi-albumtype album when I issue a beet write command, but the output is less obviously-screwy than the single character stuff, before.

I'd be really grateful for some feedback on if this worth finishing, polishing up and PR'ing; or if the change is felt to be officially The Wrong Direction for beets to fix the underlying issue!

xpurplexamyx commented 1 year ago

This bug is definitely worth fixing - currently struggling with the same issue across my entire library!

wesley7502 commented 1 year ago

I'll also try taking a look at it too!

jpluscplusm commented 1 year ago

@sampsyo Apologies for the ping, but I strongly believe that anyone writing tags with a 1.6.0 or later version of beets is going to run into this bug, potentially (and probably) re-tagging every file in their library with bad data!

I've put together a rough fix (see https://github.com/beetbox/beets/issues/4528#issuecomment-1312252371) but I lack the beets-awareness to know either how to test this reliably (i.e. what tests could've caught this before (or as) the multi-type tag support was merged) or how to make sure any fix I propose doesn't itself prompt a re-tag of any consumer's entire library!

Again - apologies for the ping, but I /think/ it's warranted by this bug affecting a sufficiently widespread audience.

mkhl commented 1 year ago

@jpluscplusm i'm not them nor part of beets, but i've been suffering from this bug too so first thank you and secondly i left some generic feedback on your commit.

with beet 1.6.0, every beet write re-tags my entire library because the types of the albumtypes values don't match up. with your changes, slightly modified, the albumtypes are stable.

there's a remaining problem with the albumtype (singular), beet write re-tags every album with several album types wanting to change albumtype from the first to the second. i assume different code paths extract different values from the albumtypes array as the albumtype. (it's still better than before, there albumtype was always changed from a single letter to the correct type)

jpluscplusm commented 1 year ago

Thank you @mkhl - I've realigned my fork's jcm_fix_albumtypes branch with the code included in your feedback: https://github.com/jpluscplusm/beets/commit/f5ad78a26065fc7cbb8541264336efe580ed62a6

As per the overly-verbose commit message, I'm not yet running Beets in anger, and discovered this problem whilst getting started for the first time. Given you're running against an existing library, I'm happy to take your code as being more likely to not affect other consumers, if merged!

Also, as I mentioned above, I don't have any tests to prove the correctness of this fix, one way or the other. All the existing tests (obviously!) passed before 1.6.0 was released. Having dug a little into the more e2e tests, I quickly stepped out of my depth. Thus whilst I believe you about there being no need to overload from_sql, the definition of that method in the super-super-type ("Type") isn't something I can hold a meaningful opinion about! It's doing things with SQLite that I don't feel qualified to ACK or NACK, so I'll leave it to @sampsyo to work out the best route forward as & when they want to merge this.

I'll kick off a WIP PR and tag you in it. I hope it gets merged :-)

bbaserdem commented 1 year ago

Just chiming in to say I have the exact same issue; glad to see the pull request that can stop this behavior.

jpluscplusm commented 1 year ago

Just chiming in to say I have the exact same issue; glad to see the pull request that can stop this behavior.

@bbaserdem Please do feel free to check out my branch and confirm it works across any and all operations you try out.

Having additional test cases of people with pre-existing Beets media libraries confirm there aren't any side effects (and also that the bug's behaviour is fixed) would be really really useful!

CharlesSchimmel commented 1 year ago

Anyone know if there's a good way to remediate files affected by this bug? Reimporting only seems to work for files with a musicbrainz match, but some albums that I imported as-is were affected as well. Additionally, reimporting is pretty tedious especially with albums that don't have a high match (missing tracks or similar).

mkhl commented 1 year ago

Anyone know if there's a good way to remediate files affected by this bug?

this issue itself only affects the files, so the fix would be to beet write affected files with a fixed version

what you're asking is how to fix the database once one has affected some files and then beet updated their info so now the database is affected too (just wanna be super clear on that because i haven't before and this can be really confusing :)

if you can't easily autotag the files, which would fix them you can instead use beet modify:

beet mod -a 'For Those That Wish to Exist at Abbey Road' albumtypes='album; l
ive'

this will show you the changes and let you confirm them, and will then by default update both the database and the files (look at the --help output for other options)

bbaserdem commented 1 year ago

@jpluscplusm I use the archlinux package from community repo, so less straightforward for me to test it out. But I will try to give it a shot to see if it resolves my issues. I will report back when I get around here.

marty-oehme commented 1 year ago

Just wanted to chime in that I've been rebuilding my library and came across this annoying issue as well.

I have used your branch @jpluscplusm and it works like a charm to fix the overall confusion of beets. The first invocation of the write function correctly writes albumtype. It's still flipping between continually rewriting multi-type tracks (e.g. trying to do album -> compilation or album -> live) as you mentioned above, but otherwise it is already much easier to handle than before, thank you!

I've attached an overview of my library size and the results, iin case that helps further confirm the changes working.

albumtypes field with PR branch ``` ┌────────────────┬────────────────────────────────────┐ │ Name │ Value │ ╞════════════════╪════════════════════════════════════╡ │ Field name │ albumtypes │ ├────────────────┼────────────────────────────────────┤ │ Field type │ beets.dbcore.types.DelimitedString │ ├────────────────┼────────────────────────────────────┤ │ Auto type │ None │ ├────────────────┼────────────────────────────────────┤ │ Count │ 2524 │ ├────────────────┼────────────────────────────────────┤ │ Unique │ 7 │ ├────────────────┼────────────────────────────────────┤ │ Most frequent │ ['album'](1247) │ ├────────────────┼────────────────────────────────────┤ │ Least frequent │ ['single'](8) │ ├────────────────┼────────────────────────────────────┤ │ Empty │ 0 │ └────────────────┴────────────────────────────────────┘ describe: Unique element histogram ['album'] [1247] ████████████████████████████████████████ [] [ 867] ███████████████████████████▊ ['album', 'compilation'] [ 255] ████████▏ ['ep'] [ 61] ██ ['album', 'soundtrack'] [ 50] █▋ ['album', 'live'] [ 36] █▏ ['single'] [ 8] ▎ ```
RollingStar commented 1 year ago

Would it have been feasible to catch this bug with a general purpose test? ex.


import smallalbum
# output looks good

beet fields
# looks good

# checking every tag of the known test album
# looks good

Would have some issues whenever new default fields are added/changed, but would have caught this perhaps.

mfiano commented 1 year ago

This bug has bitten me for the last time. It's actually more convenient to go back to manually organizing my music with the time it takes to modify all the failures this produces.

MorgothSauron commented 1 year ago

This bug has bitten me for the last time. It's actually more convenient to go back to manually organizing my music with the time it takes to modify all the failures this produces.

Since I found about this issue I simply delete the album types tag right after I import new music:

metaflac --remove-tag MUSICBRAINZ_ALBUMTYPE --remove-tag RELEASETYPE <file_name>

After that I run:

beet update
beet write

Of course, this is in no way what could be called a solution and not even close to be a workaround. On the other hand I know that newly imported music don't have those buggy album type tags. I can do that because I already applied this process to my whole library (6110 files, 200Gb). Is it stupid ? Probably, but this is how I'm dealing with the situation until a proper fix gets 'pushed' to the master.

codeinabox commented 1 year ago

I too have come across this bug, only noticed it when running my collection through Picard it was correcting it.

kingtigermusic commented 1 year ago

Hello, I have an interesting observation to add, that I'm not sure anyone else has caught/mentioned yet. I'm also having the same issue, in that beets writes both the albumtype and albumtypes fields for every album, every time I do a write command:

ABBA - Number Ones - Waterloo
  albumtype: a -> compilation
  albumtypes: ['a', 'l', 'b', 'u', 'm', ';', ' ', 'c', 'o', 'm', 'p', 'i', 'l', 'a', 't', 'i', 'o', 'n'] -> album; compilation
ABBA - Number Ones - The Name of the Game
  albumtype: a -> compilation
  albumtypes: ['a', 'l', 'b', 'u', 'm', ';', ' ', 'c', 'o', 'm', 'p', 'i', 'l', 'a', 't', 'i', 'o', 'n'] -> album; compilation
ABBA - Number Ones - I Do, I Do, I Do, I Do, I Do
  albumtype: a -> compilation
  albumtypes: ['a', 'l', 'b', 'u', 'm', ';', ' ', 'c', 'o', 'm', 'p', 'i', 'l', 'a', 't', 'i', 'o', 'n'] -> album; compilation
ABBA - Number Ones - Take a Chance on Me
  albumtype: a -> compilation
  albumtypes: ['a', 'l', 'b', 'u', 'm', ';', ' ', 'c', 'o', 'm', 'p', 'i', 'l', 'a', 't', 'i', 'o', 'n'] -> album; compilation
ABBA - Number Ones - I Have a Dream
  albumtype: a -> compilation
  albumtypes: ['a', 'l', 'b', 'u', 'm', ';', ' ', 'c', 'o', 'm', 'p', 'i', 'l', 'a', 't', 'i', 'o', 'n'] -> album; compilation
ABSRDST - Even If We Were Birds - Even If We Were Birds
  albumtype: s -> single
  albumtypes: ['s', 'i', 'n', 'g', 'l', 'e'] -> single
MUTEMATH - Armistice - Armistice (2nd Line version)
  albumtype:  -> album
MUTEMATH - Armistice - Valium
  albumtype:  -> album
MUTEMATH - Armistice - The Nerve
  albumtype: a -> album
  albumtypes: ['a', 'l', 'b', 'u', 'm'] -> album
MUTEMATH - Armistice - Backfire
  albumtype: a -> album
  albumtypes: ['a', 'l', 'b', 'u', 'm'] -> album
MUTEMATH - Armistice - Clipping
  albumtype: a -> album
  albumtypes: ['a', 'l', 'b', 'u', 'm'] -> album
MUTEMATH - Armistice - Spotlight
  albumtype: a -> album
  albumtypes: ['a', 'l', 'b', 'u', 'm'] -> album
MUTEMATH - Armistice - No Response
  albumtype: a -> album
  albumtypes: ['a', 'l', 'b', 'u', 'm'] -> album
MUTEMATH - Armistice - Pins and Needles
  albumtype: a -> album
  albumtypes: ['a', 'l', 'b', 'u', 'm'] -> album
MUTEMATH - Armistice - Goodbye
  albumtype: a -> album
  albumtypes: ['a', 'l', 'b', 'u', 'm'] -> album
MUTEMATH - Armistice - Odds
  albumtype: a -> album
  albumtypes: ['a', 'l', 'b', 'u', 'm'] -> album
MUTEMATH - Armistice - Electrify
  albumtype: a -> album
  albumtypes: ['a', 'l', 'b', 'u', 'm'] -> album
MUTEMATH - Armistice - Armistice
  albumtype: a -> album
  albumtypes: ['a', 'l', 'b', 'u', 'm'] -> album
MUTEMATH - Armistice - Lost Year
  albumtype: a -> album
  albumtypes: ['a', 'l', 'b', 'u', 'm'] -> album
MUTEMATH - Armistice - Burden
  albumtype: a -> album
  albumtypes: ['a', 'l', 'b', 'u', 'm'] -> album
MUTEMATH - Armistice - Architecture
  albumtype: a -> album
  albumtypes: ['a', 'l', 'b', 'u', 'm'] -> album

(Please note that I have my config set to not move or copy files or write tags on import, and to show detail. I just started using beets this week, and I'm very particular about how my music is organized, so I typically will import one artist at a time, and then use beet write -p to check things before finally issuing the write command to actually modify the files' tags.)

However, when I run beet list -f '$title - $albumtype $albumtypes', the tags appear to be correct:

Waterloo - compilation album; compilation
The Name of the Game - compilation album; compilation
I Do, I Do, I Do, I Do, I Do - compilation album; compilation
Take a Chance on Me - compilation album; compilation
I Have a Dream - compilation album; compilation
Even If We Were Birds - single single
Armistice (2nd Line version) - album
Valium - album
The Nerve - album album
Backfire - album album
Clipping - album album
Spotlight - album album
No Response - album album
Pins and Needles - album album
Goodbye - album album
Odds - album album
Electrify - album album
Armistice - album album
Lost Year - album album
Burden - album album
Architecture - album album

This seems rather peculiar, because a subsequent beet write -p will yield the same albumtype: a -> album / albumtypes: ['a', 'l', 'b', 'u', 'm'] -> album result as shown in my first codeblock.

Don't know if this helps any, but thought I'd share.

EDIT: I just realized that this is probably ocurring because beets' database has the correct tags in it, whereas the files themselves do not. Another oddity I just noticed, is that on the ABBA tracks, the files' albumtype tag is a despite beets having written compilation. I would have expected it to be c, similar to how the file for the track by ABSRDST has an albumtype of s for single. Is albumtype being altered to match albumtypes, after the fact? That would explain the ABBA anomaly, since albumtypes is album; compilation.

EDIT 2: I installed eyeD3 and checked the tags of the actual files:

...e/Corey/ABSRDST/Even If We Were Birds/Even If We Were Birds.mp3                              [ 9.33 MB ]
------------------------------------------------------------------------------------------------------------
Time: 04:03     MPEG1, Layer III        [ 320 kb/s @ 44100 Hz - Stereo ]
------------------------------------------------------------------------------------------------------------
ID3 v2.4:
title: Even If We Were Birds
artist: ABSRDST
album: Even If We Were Birds
album artist: ABSRDST
original release date: 2014-08-21
recording date: 2014-08-21
track: 1/1              genre: Electronic, Electronica, Pop (id None)
disc: 1/1
BPM: 0
Unique File ID: [b'http://musicbrainz.org'] : 29228c69-080d-4acb-9acd-783274bee229
Lyrics: [Description: ] [Lang: XXX]

UserTextFrame: [Description: Script]
Latn
UserTextFrame: [Description: ASIN]
B00TV08CP0
UserTextFrame: [Description: Artist Credit]
ABSRDST
UserTextFrame: [Description: ALBUMARTISTSORT]
ABSRDST
UserTextFrame: [Description: Album Artist Credit]
ABSRDST
UserTextFrame: [Description: MusicBrainz Album Status]
Official
UserTextFrame: [Description: MusicBrainz Album Type]
single
UserTextFrame: [Description: MusicBrainz Album Release Country]
XW
UserTextFrame: [Description: MusicBrainz Album Id]
23ca9144-2989-447d-81ee-8515b61838a2
UserTextFrame: [Description: MusicBrainz Artist Id]
70cf8d5e-2d03-40cb-86eb-96adf714afc6
UserTextFrame: [Description: MusicBrainz Album Artist Id]
70cf8d5e-2d03-40cb-86eb-96adf714afc6
UserTextFrame: [Description: MusicBrainz Release Group Id]
eb7f8abe-cd44-4473-bda7-584fec268f46
UserTextFrame: [Description: MusicBrainz Release Track Id]
a5488f18-a399-44f8-a029-e99e80607ea2
FRONT_COVER Image: [Size: 49850 bytes] [Type: image/jpeg]
Description:

PRIV: [Data: 40 bytes]
Owner Id: Google/StoreLabelCode
PRIV: [Data: 42 bytes]
Owner Id: Google/StoreId

It appears that the albumtype is correct in the file's tags, despite beets thinking it needs to re-write it. albumtypes is missing altogether, however.

EDIT 3: Other tagging software (namely, mediainfo) displays the albumtype as the erroneous entry:

ABSRDST/Even If We Were Birds/Even If We Were Birds.mp3
...
MusicBrainz Album Type                   : s
ABBA/Dancing Queen.m4a
...
MusicBrainz Album Type                   : a / l / b / u / m / ; /   / c / o / m / p / i / l / a / t / i / o / n
Sciencentistguy commented 1 year ago

The workaround i've been using for this, if the database gets corrupted via a beet update, is to use beet mbsync to pull the latest data from musicbrainz for those releases. This will overwrite (e.g.) [a,l,b,u,m] with album in the database. The files themselves still have the incorrect metadata, but I'm keeping the database correct so that in the future a beet write will fix everything.

Codeiffor commented 7 months ago

@JOJ0 I faced the same issue, I was able to reproduce this if I ran beet update after I did a import with embedart or scrub plugin in config

JOJ0 commented 7 months ago

@Codeiffor beets 1.6.0? -> upgrade

fix mess: https://github.com/beetbox/beets/pull/4582#issuecomment-1445023493

HTH :-)