audiamus / BookLibConnect

A standalone Audible downloader and decrypter
GNU General Public License v3.0
672 stars 38 forks source link

Include audio book Genre in JSON metadata file #156

Closed patrickwolf closed 3 weeks ago

patrickwolf commented 1 month ago

Today I want to group my audiobooks by genre and realized that it's not downloaded from audible. So i wanted to make a quick request to download the books genre and add it to the JSON metadata file so the user or AaxAudioConverter could make use of it.

Thank you, Patrick

See here for a related ticket Keep ASIN available after conversation

patrickwolf commented 1 month ago

I might even go as far as saying would it make sense for all metadata that was obtained to be stored in the JSON file? That way the user can use that file in the future in different ways without needing to re-download the data

image

audiamus commented 1 month ago

Unfortunately, there is no such thing as a single genre for a book in the Audible category world. The way genres are presented in BookLibConnect is sort of a compromise. Audible calls their genre classification ("category" by Audible) "ladders" with "rungs". The rungs, however, can belong to more than one ladder. That means the data structure is not a tree. The only complete representation is the somewhat convoluted list coming with the json file, stored by BookLibConnect in the tmp folder as LibraryResponse-<timestamp>.json. And don't expect individual titles in a series to have exactly the same genre attributes. So, a folder tree structure based on genres would be quite challenging.

The json files you find in the BookLibConnect export folder are modelled after those of the former Audible Win10 app, As AAXAudioConverter is familiar with their structure. Their content is assembled from LibraryReponse, ProductResponse and LicenseResponse* files. These response files are the answers to API calls.

patrickwolf commented 1 month ago

Thank you for the details. I wonder if it still would make sense to add the additional information to the json file? As AAXAc would just ignore the additional fields but if the info like genre exists users might appreciate it

audiamus commented 4 weeks ago

Problem is that the genre/categories from the LibraryResponse*.json are not persisted. BookLibConnect only extracts the essence you see in the Library window and stores that in its database. I could add that essence to one of the two export json files, but it will be a proprietary type.

patrickwolf commented 3 weeks ago

You are meaning that the JSON files have a standard format and you would be making it possibly incompatible with other apps?

audiamus commented 3 weeks ago

Another idea: Have you considered writing your own database queries to retrieve genre information? The BookLibConnect database is ordinary SQLite. While BookLibConnect uses .Net Entity Framework Core as Object Relational Mapper (ORM), the database tables are still of the straightforward kind and it should be easy to extract data with a different language.

patrickwolf commented 3 weeks ago

Thank you @audiamus I had to pause my efforts for the perfect audiobooks collection :) and for now just copied the JSON files to the target folder so they are kept around. I thought I'll close the ticket as the idea of the genre wasn't the best one afterall considering its not a tree structure. Thank you again for your care and effort!