mProjectsCode / obsidian-media-db-plugin

A plugin that can query multiple APIs for movies, series, anime, games, music and wiki articles, and import them into your vault.
GNU General Public License v3.0
255 stars 31 forks source link

Book Plugin needs a few features #115

Closed blu3knight closed 11 months ago

blu3knight commented 11 months ago

Is your feature request related to a problem? Please describe. Currently the book plugin needs a few features added. As it is missing a few things.

Describe the solution you'd like

  1. ISBN needs to be added back. I saw the commit in terms of releases but ISBN is used for a lot of other areas, Amazon, google books, and Goodreads, etc. in my template I can automatically use it for creating search for these, it is especially useful for books I want to get, or just for links to Amazon.

‘this can be disabled via config as well

  1. in search output, author needs to be included so that you can easily find book you want.
ltctceplrm commented 11 months ago

The thing with isbn is that it's for a specific edition of a book, so there could be dozens of ISBNs or sometimes even none. Whereas I tried to use the OpenLibrary api to use the actual work ID instead. While the ISBN is not necessarily useful I don't really mind adding it back since indeed it can be disabled in the settings but should the plugin add all the ISBNs? Just the first one?

As for the search: the api allows a general search but then you get the problem that some books would show up very low in the results unless you add the author name, example with Children of Memory by Adrian Tchaikovsky

I understand that for some books it'll be the opposite problem if there are 50 books with the same identical title and your author is at the end but I think the current option is the best solution for now. Unless it's possible to change the OpenLibraryAPI.ts file that searching for children of memory&author=Adrian Tchaikovsky would change the URLto https://openlibrary.org/search.json?title=children%20of%20memory&author=adrian%20tchaikovsky. I don't know if that would be a good solution though because it's kind of half baked and people would have to read the manual to know you can even do this. I'd also have to find a way to work around the URI encoding because currently this search won't parse.

Ideally an extra search field would be added below the title search and if you add info in both it'll construct the correct URL but I'm not sure how hard that is to do.

blu3knight commented 11 months ago

It does not matter any ISBN will give you ability to link directly to books, while searches as above give you a list. Once you are in the book if you are interested you can then zero in 0n other editions, etc.

Example goodreads with title searc https://www.goodreads.com/search?q=Tom+Clancy+the+hunt+for+red+October

goodreads you can actually go directly to book by issuing https://www.goodreads.com/book/isbn/9780425240335

‘so using this as an example I could just do something like this in template and I do not have to do anything manual. [{[title}} - Goodreads](https://www.goodreads.com/book/isbn/{{isbn}})

And if I want to get a link to all places I can do this [{{title}} - ISBN Link Summary](https://isbnsearch.org/isbn/{{isbn}})

do you see how much easier it is? Yes I know you can have different isbns but the linking portion as part of automation of obsidian and templates makes it so much easier. Doing the same with title would require JavaScript

ltctceplrm commented 11 months ago

Sure, I'll add it back in and have it select the first isbn from the list then.

Edit: If you have any ideas for the author search I can add it too but otherwise I'll just do a PR for adding the isbn

blu3knight commented 11 months ago

I would recommend if option to have isbn (9) and isbn13 as the book plugin does, and any from the list works for that. I am not sure what's available via api.

As for the author search the or title searches the biggest problem is to translate the spaces to be able to be used in url search %20 so that is the issue that is hard to get around without introducing complexity into pages.

ltctceplrm commented 11 months ago

I added a length check and it returns the first isbn of 10 characters or below as isbnand the first isbn of 13 characters as isbn13.

ltctceplrm commented 11 months ago

Oooh I misunderstood what you meant about including the author, I thought you wanted to search for both title and author so I was working on that but if you just want to include the author in the title search results then that's much easier, I've added it in and made a PR for your 2 feature requests

mProjectsCode commented 11 months ago

completed by #116