"match_chapters=false" ignored in album_for_id()
For my broken track order problem (https://github.com/Neurrone/beets-audible/discussions/72) I did some debugging:
looks like everything is fine if the candidates() function is used, but if no matches ware found and I enter the audible asin id the album_for_id() function is used.
The album_for_id() does not respect the match_chapters=false setting.
-> causing mixed up tracks in some cases (see discussion for a example)
I tried to fix the problem but there is another problem:
In the album_for_id() i do not have access to the items.
what I added so far to the get_album_info():
if not self.config["match_chapters"]:
common_track_attributes = dict(tracks[0])
del common_track_attributes["index"]
del common_track_attributes["length"]
del common_track_attributes["title"]
tracks = [
TrackInfo(**common_track_attributes, title=item.title, index=i + 1)
for i, item in enumerate(tracks)
]
I played around a bit in https://github.com/lukeIam/beets-audible/tree/ignore_chapters (edit: outdated)
But I still get corrupted track orders (also via the candidates code)
Its been a very long time since I've last looked at this code, so it'll take a while for me to get back to this. I have noticed the issues with weird matching when I enter the album ID manually.
My workaround so far has been to put the asin manually in the album tag by editing the attributes of the files that I want to import, usually appending it to the end of the book name is enough for it to cause the search results on Audible to match the specific thing you want.
I also found one audiobook where the "normal" way (without id/asin entry) is producing a wrong matching...
I'm currently trying a a completely other way of handling - I will update here if I have a result...
@Neurrone here's the update...
As I wasn't able to create TrackInfos in a way that the track order was maintained in the matching process, I decided to tackle it form the other way: extend beets to allow plugins to manipulate the matching.
Here is my PR to beets: https://github.com/beetbox/beets/pull/5768
This is the plugin I wrote (only partially tested yet): https://gist.github.com/lukeIam/d371d5f8ac53e645b6d46ece3649d1d0