Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Older Kindles #35

Open
fakerybakery opened this issue Dec 10, 2023 · 5 comments
Open

Support Older Kindles #35

fakerybakery opened this issue Dec 10, 2023 · 5 comments

Comments

@fakerybakery
Copy link

fakerybakery commented Dec 10, 2023

Hi,
Thanks for making this great resource! I noticed that Gutendex's API only gave the KF8 file format for Kindles, which is only compatible with newer Kindles. However, on Gutenberg's official website, they have two files, "Kindle" and "older Kindles."
I'm not sure if Gutenberg's downloadable API supports this, but I was wondering if it might be possible to include these files as well.
Thank you!
EDIT: Right now, I'm just replacing ".kf8" with ".kindle" because of Gutenberg's file naming convention, but I'm not sure if there's a better way to do this.

@garethbjohnson
Copy link
Owner

Hi, good idea! In this case, there are two formats (".kindle" and ".kf8") with the same media type ("application/x-mobipocket-ebook"), so since Gutendex uses a JSON object with unique keys for the format, it only shows one.

I could add another property to the API object with the key "all_formats" and a value that is an array of two-item sub-arrays, where the first item of the sub-array is the media type and the second is the URL for that format. For example:

{
  ...
  "formats": {
    ...
    "application/x-mobipocket-ebook": "https://www.gutenberg.org/ebooks/84.kf8.images",
    ...
  },
  "all_formats": [
    ...
    ["application/x-mobipocket-ebook", "https://www.gutenberg.org/ebooks/84.kindle.images"],
    ["application/x-mobipocket-ebook", "https://www.gutenberg.org/ebooks/84.kf8.images"],
    ...
  ],
  ...
}

Would that solve the issue?

@fakerybakery
Copy link
Author

Hmm, yeah that's an option. Have you considered giving the older kindle option a custom name, ie "application/mobipocket-x-ebook-old"?

@fakerybakery
Copy link
Author

Hi, just saw the file size thread. Your previous solution would be great, but it might break applications depending on an older version of the API. Is it possible to support an extra flag ("?all_versions=true")?

@garethbjohnson
Copy link
Owner

Hi, thank you for the feedback. I would like to keep the existing "formats" and simply add "all_formats" after it, so I foresee no issue. I do not expect it to be common enough for any apps to rely on the size of responses, or to reject responses with unexpected properties. Even if a developer needs to update their app to support the new property, they could use the previous commit on their servers. Does that make sense?

@fakerybakery
Copy link
Author

Yeah, that makes sense. Thanks for the explanation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants