Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
MorgothSauron opened this issue Oct 23, 2022 · 31 comments · Fixed by #4582
Closed

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

MorgothSauron opened this issue Oct 23, 2022 · 31 comments · Fixed by #4582
Labels
bug bugs that are confirmed and actionable

Comments

@MorgothSauron
Copy link

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

  • OS: Gentoo Linux (6.0.3-gentoo-x86_64)
  • Python version: 3.10.8
  • beets version: 1.6.0
  • Turning off plugins made problem go away (yes/no): don't know: I don't have the albumtypes plugin in my config.

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
Copy link
Author

MorgothSauron commented Oct 24, 2022

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
Copy link
Author

MorgothSauron commented Oct 24, 2022

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
Copy link
Author

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
Copy link
Member

sampsyo commented Oct 25, 2022

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?

@sampsyo sampsyo added the needinfo We need more details or follow-up from the filer before this can be tagged "bug" or "feature." label Oct 25, 2022
@MorgothSauron
Copy link
Author

MorgothSauron commented Oct 25, 2022

  • Uninstalled beet 1.6.0
  • Installed beet 1.6.1 (pip install --user https://github.com/beetbox/beets/tarball/master)
$ beet version
beets version 1.6.1
Python version 3.10.8
plugins: edit, embedart, fetchart, info, lyrics
$   
  • For testing I used the same album as in my previous post (Deficiency - Warenta)
  • Tags on the flac file before the import
$ metaflac --export-tags-to=/dev/stdout 01\ -\ Warenta.flac                                                                                                       22:14:34
ARTIST=Deficiency
TITLE=Warenta
TRACKNUMBER=01
DATE=2022
ALBUM=Warenta
$     
  • Import
$ beet -vv import .                                                                                                22:10:42
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: /home/mcarpentier/Temp/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.

/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">
<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/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 sampsyo added bug bugs that are confirmed and actionable and removed needinfo We need more details or follow-up from the filer before this can be tagged "bug" or "feature." labels Oct 25, 2022
@sampsyo
Copy link
Member

sampsyo commented Oct 25, 2022

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
Copy link

Gilfar commented Oct 28, 2022

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
Copy link
Member

sampsyo commented Oct 28, 2022

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
Copy link

Gilfar commented Oct 29, 2022

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link

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

@wesley7502
Copy link

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

@jpluscplusm
Copy link
Contributor

@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 #4528 (comment)) 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
Copy link

mkhl commented Dec 11, 2022

@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
Copy link
Contributor

Thank you @mkhl - I've realigned my fork's jcm_fix_albumtypes branch with the code included in your feedback: jpluscplusm-forks@f5ad78a

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
Copy link

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

@jpluscplusm
Copy link
Contributor

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!

jpluscplusm added a commit to jpluscplusm-forks/beetbox.beets that referenced this issue Dec 14, 2022
@CharlesSchimmel
Copy link

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).

wisp3rwind added a commit to wisp3rwind/beets that referenced this issue Dec 15, 2022
@mkhl
Copy link

mkhl commented Dec 15, 2022

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)

wisp3rwind added a commit to wisp3rwind/beets that referenced this issue Dec 18, 2022
wisp3rwind added a commit that referenced this issue Dec 18, 2022
tests: add a (xfailing) test for issue #4528
jpluscplusm added a commit to jpluscplusm-forks/beetbox.beets that referenced this issue Dec 18, 2022
@bbaserdem
Copy link

@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
Copy link

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
Copy link
Contributor

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
Copy link

mfiano commented Jan 25, 2023

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
Copy link
Author

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
Copy link

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

@kingtigermusic
Copy link

kingtigermusic commented Feb 11, 2023

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
Copy link
Contributor

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.

JOJ0 added a commit to jpluscplusm-forks/beetbox.beets that referenced this issue Feb 27, 2023
JOJ0 added a commit to jpluscplusm-forks/beetbox.beets that referenced this issue Feb 27, 2023
JOJ0 added a commit to jpluscplusm-forks/beetbox.beets that referenced this issue Feb 28, 2023
Add a note to the docs of the albumtypes plugin warning about issue beetbox#4528 and
linking to the manual fixing description.
JOJ0 added a commit to jpluscplusm-forks/beetbox.beets that referenced this issue Feb 28, 2023
Add a note to the docs of the albumtypes plugin warning about issue beetbox#4528 and
linking to the manual fixing description.
@JOJ0 JOJ0 closed this as completed in #4582 Mar 8, 2023
@Codeiffor
Copy link

Codeiffor commented Dec 7, 2023

@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
Copy link
Member

JOJ0 commented Dec 7, 2023

@Codeiffor beets 1.6.0? -> upgrade

fix mess: #4582 (comment)

HTH :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug bugs that are confirmed and actionable
Projects
None yet