DVinyl icon indicating copy to clipboard operation
DVinyl copied to clipboard

[Feature]: Hardcover - use ID instead of book slug

Open reneald opened this issue 1 month ago • 3 comments

Before suggesting

  • [x] I searched the existing issues and did not find a similar request.

What problem would this solve?

Currently, when a book is found on Hardcover, DVinyl stores the book slug as the source ID. As mentioned in Hardcover's documentation, book slugs can change any time: they are derived from a book's title, the database contains many mistakes and if someone fixes an incorrect title, the book slug changes. Hardcover also has an ID for each book, which does not change (unless a book is removed from the database or merged with another book).

A downside to this is that the book ID is slightly more complicated to find as an end user: when viewing a book you can find the slug in the URL (https://hardcover.app/books/{book-slug}), but to find the ID you have to go to Manage > Edit which leads to a URL like https://hardcover.app/books/{id}/edit.

How could it work?

API docs regarding ID's is here: https://docs.hardcover.app/api/guides/linkingbyid/

Alternatives you considered

No response

Would you like to help build it?

I could help test it

reneald avatar Oct 06 '26 06:10 reneald

Hey! Yeah, totally! I don't even remember why I used that slug... I'll take a look thanks!

Kyonew avatar Oct 09 '26 22:10 Kyonew

Hi! I just released version 3.3.0, which fixes this :D

Books are now refreshed through Hardcover's numeric id, which survives a title fix. The slug is still kept for the link to the book's page, and it gets healed automatically when Hardcover renames it. Books saved before this are found by their slug one last time and get their id recorded on the way, so nothing has to be done by hand. Editing the id of a book also drops the old Hardcover match, so the next refresh follows the new one.

Thanks for pointing to the docs, it made it an easy one!

Feel free to reopen the issue if you run into any problems!

Kyonew avatar Oct 17 '26 11:10 Kyonew

I've refreshed a few books, and in the item details I still see the slug instead of the ID. Is this expected? Is the ID stored in the DB but not visible to the user? Just checking so I know that everything works :)

reneald avatar Oct 19 '26 09:10 reneald