beets icon indicating copy to clipboard operation
beets copied to clipboard

Discogs: fixes for: 6177, 6068

Open henry-oberholtzer opened this issue 1 month ago • 2 comments

Description

Fixes #6177, #6068.

I fixed the issue in #6177 by removing the derived class interface, and moving those fields back into function variables. They're a bit unwieldy still, but that's the algorithm it came with. There's a lot of room to continue to improve the clarity of the code in that section, but I think that'll require a deeper overhaul.

For #6068, I created the ArtistInfo and AlbumArtistInfo typed dictionaries, and was able to centralize the logic of building the artist info into build_artistinfo and build_albumartistinfo. Tests for these scenarios were created largely by expanding existing tests to incorporate the new fields.

I think I'll have to re-think the entire algorithm for 6030 to make it more flexible at parsing the issue for #6030, so I'll move that to a later PR in the interest of getting the flex attr fix in.

To Do

  • [x] Changelog. (Add an entry to docs/changelog.rst to the bottom of one of the lists near the top of the document.)
  • [x] Tests.

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

Codecov Report

:x: Patch coverage is 94.87179% with 8 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 68.05%. Comparing base (ac0b6ec) to head (a96da41). :white_check_mark: All tests successful. No failed tests found.

Files with missing lines Patch % Lines
beetsplug/discogs.py 94.87% 6 Missing and 2 partials :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6179      +/-   ##
==========================================
+ Coverage   68.03%   68.05%   +0.02%     
==========================================
  Files         137      137              
  Lines       18708    18777      +69     
  Branches     3163     3172       +9     
==========================================
+ Hits        12728    12779      +51     
- Misses       5309     5329      +20     
+ Partials      671      669       -2     
Files with missing lines Coverage Δ
beetsplug/discogs.py 74.46% <94.87%> (+3.68%) :arrow_up:

... and 1 file with indirect coverage changes

:rocket: New features to boost your workflow:
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Dec 09 '25 07:12 codecov[bot]

Something I changed it causing a db write crash in real usage, I think it might be one of the ID fields not being converted to string, but I'll investigate & solve that. Back to draft!

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Python312\Scripts\beet.exe\__main__.py", line 7, in <module>
  File "C:\Python312\Lib\site-packages\beets\ui\__init__.py", line 1631, in main
    _raw_main(args)
  File "C:\Python312\Lib\site-packages\beets\ui\__init__.py", line 1610, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "C:\Python312\Lib\site-packages\beets\ui\commands\import_\__init__.py", line 131, in import_func
    import_files(lib, byte_paths, query)
  File "C:\Python312\Lib\site-packages\beets\ui\commands\import_\__init__.py", line 75, in import_files
    session.run()
  File "C:\Python312\Lib\site-packages\beets\importer\session.py", line 236, in run
    pl.run_parallel(QUEUE_SIZE)
  File "C:\Python312\Lib\site-packages\beets\util\pipeline.py", line 471, in run_parallel
    raise exc_info[1].with_traceback(exc_info[2])
  File "C:\Python312\Lib\site-packages\beets\util\pipeline.py", line 336, in run
    out = self.coro.send(msg)
          ^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\site-packages\beets\util\pipeline.py", line 195, in coro
    task = func(*(args + (task,)))
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\site-packages\beets\importer\stages.py", line 217, in user_query
    _apply_choice(session, task)
  File "C:\Python312\Lib\site-packages\beets\importer\stages.py", line 325, in _apply_choice
    task.add(session.lib)
  File "C:\Python312\Lib\site-packages\beets\importer\tasks.py", line 499, in add
    self.album = lib.add_album(self.imported_items())
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\site-packages\beets\library\library.py", line 70, in add_album
    album.add(self)
  File "C:\Python312\Lib\site-packages\beets\library\models.py", line 81, in add
    super().add(lib)
  File "C:\Python312\Lib\site-packages\beets\dbcore\db.py", line 689, in add
    self.store()
  File "C:\Python312\Lib\site-packages\beets\library\models.py", line 593, in store
    super().store(fields)
  File "C:\Python312\Lib\site-packages\beets\library\models.py", line 71, in store
    super().store(fields)
  File "C:\Python312\Lib\site-packages\beets\dbcore\db.py", line 611, in store
    value = self._type(key).to_sql(self[key])
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\site-packages\beets\dbcore\types.py", line 309, in to_sql
    return self.delimiter.join(model_value)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: sequence item 1: expected str instance, int found

henry-oberholtzer avatar Dec 09 '25 17:12 henry-oberholtzer

Thanks Sebastian! I'm out of town at the moment but will get these applied once I'm back.

henry-oberholtzer avatar Dec 23 '25 15:12 henry-oberholtzer

No hurry! Take your time and enjoy the holidays.

semohr avatar Dec 23 '25 15:12 semohr