beets icon indicating copy to clipboard operation
beets copied to clipboard

Unexpected flex attr saved by Discogs plugin: `medium_str`

Open snejus opened this issue 1 month ago • 2 comments

Problem

I have noticed that most of my new imports autotagged using Discogs data source save an unwanted medium_str flexible attribute which seems to be an intermediate variable used for track_alt construction.

$ beet list call music album::'(65|45)' -f $'$data_source\t$added\t$album\t$media\t$disc\t$track\t$track_alt\t$medium_str'
Discogs 2025-01-14 20:28:05     Now That's What I Call Music! 45        CD      02      01      2-1     $medium_str
Discogs 2025-01-14 20:28:05     Now That's What I Call Music! 45        CD      02      02      2-2     $medium_str
Discogs 2025-01-14 20:28:05     Now That's What I Call Music! 45        CD      02      03      2-3     $medium_str
Discogs 2025-01-14 20:28:05     Now That's What I Call Music! 45        CD      02      04      2-4     $medium_str
Discogs 2025-01-14 20:28:05     Now That's What I Call Music! 45        CD      02      06      2-6     $medium_str
Discogs 2025-01-14 20:28:05     Now That's What I Call Music! 45        CD      02      07      2-7     $medium_str
Discogs 2025-01-14 20:28:05     Now That's What I Call Music! 45        CD      02      08      2-8     $medium_str
Discogs 2025-01-14 20:28:05     Now That's What I Call Music! 45        CD      02      09      2-9     $medium_str
Discogs 2025-01-14 20:28:05     Now That's What I Call Music! 45        CD      02      10      2-10    $medium_str
Discogs 2025-01-14 20:28:05     Now That's What I Call Music! 45        CD      02      11      2-11    $medium_str
Discogs 2025-01-14 20:28:05     Now That's What I Call Music! 45        CD      02      12      2-12    $medium_str
Discogs 2025-01-14 20:28:05     Now That's What I Call Music! 45        CD      02      13      2-13    $medium_str
Discogs 2025-01-14 20:28:05     Now That's What I Call Music! 45        CD      02      14      2-14    $medium_str
Discogs 2025-01-14 20:28:05     Now That's What I Call Music! 45        CD      02      16      2-16    $medium_str
Discogs 2025-01-14 20:28:05     Now That's What I Call Music! 45        CD      02      19      2-19    $medium_str
Discogs 2025-01-14 20:28:05     Now That's What I Call Music! 45        CD      02      21      2-21    $medium_str
Discogs 2025-01-14 20:28:05     Now That's What I Call Music! 45        CD      02      22      2-22    $medium_str
Discogs 2025-01-14 20:28:05     Now That's What I Call Music! 45        CD      02      23      2-23    $medium_str
Discogs 2025-11-22 18:06:35     Now That's What I Call Music! 65        CD      01      01      1-1     1-
Discogs 2025-11-22 18:06:35     Now That's What I Call Music! 65        CD      01      02      1-2     1-
Discogs 2025-11-22 18:06:35     Now That's What I Call Music! 65        CD      01      05      1-5     1-
Discogs 2025-11-22 18:06:35     Now That's What I Call Music! 65        CD      01      09      1-9     1-
Discogs 2025-11-22 18:06:35     Now That's What I Call Music! 65        CD      01      10      1-10    1-
Discogs 2025-11-22 18:06:35     Now That's What I Call Music! 65        CD      01      11      1-11    1-
Discogs 2025-11-22 18:06:35     Now That's What I Call Music! 65        CD      01      12      1-12    1-
Discogs 2025-11-22 18:06:35     Now That's What I Call Music! 65        CD      01      14      1-14    1-
Discogs 2025-11-22 18:06:35     Now That's What I Call Music! 65        CD      01      15      1-15    1-
Discogs 2025-11-22 18:06:35     Now That's What I Call Music! 65        CD      01      16      1-16    1-
Discogs 2025-11-22 18:06:35     Now That's What I Call Music! 65        CD      01      18      1-18    1-
Discogs 2025-11-22 18:06:35     Now That's What I Call Music! 65        CD      01      20      1-20    1-

See how medium_str is not present for an album imported by the same data source earlier this year.

Setup

  • beets version: 2.5.1

I think this has to do with adjustments made in #6050, @henry-oberholtzer.

snejus avatar Nov 22 '25 18:11 snejus

Uh oh! Thanks for pointing this out. Definitely an unintended side effect of my attempt to type correct the convoluted way the plugin current handles mediums. I think adding for track in tracks: delattr(track, "medium_str") here could the quickest fix.

I don't love how the plugin currently handles parsing mediums, which necessitated the intermediary class, so a more intensive refactor could be in order down the line.

I've got a few other fixes and improvements I want to put on the discogs plugin too when I have time, so I might be able to group those all into one PR.

henry-oberholtzer avatar Nov 22 '25 19:11 henry-oberholtzer

Got a fix for this working, which luckily removes all derived classes, going to see if I can refactor the plugin a bit more while I'm at it, fix some other issues.

henry-oberholtzer avatar Nov 23 '25 00:11 henry-oberholtzer