listenbrainz: add option to import listens from ListenBrainz data export zip#6606
listenbrainz: add option to import listens from ListenBrainz data export zip#6606Maxr1998 wants to merge 7 commits into
Conversation
|
Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry. |
There was a problem hiding this comment.
Pull request overview
grug see PR try make lbimport faster and nicer to ListenBrainz server. it add way to read listens from ListenBrainz export zip, then update play counts in beets.
Changes:
- add
lbimport --export-file PATHto read listens from ListenBrainz data export zip instead of API - add zip/jsonl import helper and wire it into
_lbupdate - tweak MBID pick logic to handle
mbid_mapping: nulland prefer explicit MBID when present
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6606 +/- ##
==========================================
+ Coverage 72.43% 72.44% +0.01%
==========================================
Files 160 160
Lines 20681 20714 +33
Branches 3272 3279 +7
==========================================
+ Hits 14980 15006 +26
- Misses 4976 4983 +7
Partials 725 725
🚀 New features to boost your workflow:
|
|
Thanks for the PR! I'm of the opinion that more documentation is always better. If there's an option that isn't currently documented, then please do add documentation for it, either in this PR or another one. As for the grug is correct that this interaction should be noted in the documentation though. |
|
@Serene-Arc thanks, I made some further adjustments, added some documentation, tests, and a changelog entry. Should be ready to review now. |
Description
Since importing listens from the API is rather slow and puts unnecessary load on the servers, importing a dump exported from https://listenbrainz.org/settings/export/ should also be possible. This change introduces the
export-fileparameter to thelbimportcommand, which takes all listens from the zipfile to update the play counts.I also fixed an issue where
mbid_mappingcould beNoneif explicitly set tonullin the JSON (which happens for these exports sometimes), and changed the recording mbid logic to prefer one explicitly supplied by the player in theadditional_data, instead of relying on the (sometimes inaccurate) mapper.Since the
--maxparameter isn't documented either, I'm unsure whether I should add the parameter to the plugin docs. In theory, the--helpparameter already tells you enough.I'm also not sure if the
--maxparameter should apply to exported files, especially since the order of zip file entries isn't deterministic.To Do
docs/to describe it.)docs/changelog.rstto the bottom of one of the lists near the top of the document.)