Kareadita / Kavita

Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.
http://www.kavitareader.com
GNU General Public License v3.0
5.9k stars 304 forks source link

OPDS XML MIME Type does not match "Save Media As" setting in Admin Dashboard #2175

Closed howdy-im-david closed 1 year ago

howdy-im-david commented 1 year ago

If this is a feature request, request here instead. Feature requests will be deleted from Github.

Please put as much information as possible to help me understand your issue. OS, browser, version are very important!

Describe the bug CBZ archived comic books are in webp format, along with Kavita Admin Dashboard setting "Save Media As" to webp. Reviewing MIME types for the image and image thumbnails are incorrectly set at image/jpg instead of image/webp in OPDS XML

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Admin Dashboard'
  2. Click on 'Media'
  3. Verify Save Media As is set to 'WebP'
  4. Review OPDS XML image and thumbnail MIME type for a series and individual issue
    <entry>
    <updated>2023-08-03T14:50:56</updated>
    <id>88</id>
    <title>Transformers: King Grimlock (Archive)</title>
    <link rel="subsection" type="application/atom+xml;profile=opds-catalog;kind=navigation" href="/api/opds/00000000000000/series/88"/>
    <link rel="http://opds-spec.org/image" type="image/jpeg" href="/api/image/series-cover?seriesId=88&apiKey=00000000000000"/>
    <link rel="http://opds-spec.org/image/thumbnail" type="image/jpeg" href="/api/image/series-cover?seriesId=88&apiKey=00000000000000"/>

Expected behavior MIME type correctly match setting in Admin Dashboard > Media > Save Media As > WebP

<entry>
<updated>2023-08-03T14:50:56</updated>
<id>88</id>
<title>Transformers: King Grimlock (Archive)</title>
<link rel="subsection" type="application/atom+xml;profile=opds-catalog;kind=navigation" href="/api/opds/00000000000000/series/88"/>
<link rel="http://opds-spec.org/image" type="image/webp" href="/api/image/series-cover?seriesId=88&apiKey=00000000000000"/>
<link rel="http://opds-spec.org/image/thumbnail" type="image/webp" href="/api/image/series-cover?seriesId=88&apiKey=00000000000000"/>

Desktop (please complete the following information):

majora2007 commented 1 year ago

OPDS doesn't support webp, so I left as jpeg. I'm not sure if I can change it to webp without breaking different clients. I'm currently just waiting for OPDS 2.0 and Divina to officially fix this.

howdy-im-david commented 1 year ago

Understood! An underlying cause for me logging the item is I'm not sure if Kavita not displaying series by image was a design decision or an issue in OPDS feeds.

Here's a couple of screenshots from Panels to help illustrate the point.

Kavita OPDS Feed by Series IMG_0002

Codex (as an example) OPDS Feed by Series IMG_0003

Without digging through the source code here, at first glance the only difference that quickly stood out was the MIME type between the two feeds.

majora2007 commented 1 year ago

Which app is this?

howdy-im-david commented 1 year ago

Apologies, I edited after submitting. It's Panels

majora2007 commented 1 year ago

Would you be able to connect to our demo and tell me if it shows the images or not? Our demo uses png images.

howdy-im-david commented 1 year ago

Sure I'm happy to check! It does look like it's disabled on the demo instance? Getting 404 for https://demo.kavitareader.com/api/opds/e4baa7c7-fcd3-4d11-8e61-77ace3b43330

majora2007 commented 1 year ago

It looks like OPDS might be blocked on the demo instance. Let me loop @therobbiedavis in who has Panels and can help us dive deeper into the underlying cause.

majora2007 commented 1 year ago

Okay unblocked opds on our demo, but I reset the opds key, so you'll need to use: https://demo.kavitareader.com/api/opds/6e522efb-1347-4fb6-b72b-b04d7c8e515f

howdy-im-david commented 1 year ago

Great! Configured and have a similar result as my prior screenshot

Kavita Demo OPDS by Series

image
majora2007 commented 1 year ago

I tried breaking the spec and sending back non jpeg mime types, but ran into problems with other apps that do follow the spec as is. Not sure I'll be able to improve the experience. I will say, OPDS 2.0 and Divina are being worked currently by Komga, Kavita, Codex and Panels, so that should be the solution going forward, once we wrap some work with the Readium group.

howdy-im-david commented 1 year ago

Thanks so much for taking the taking the time to look into it. I'm in full agreement in not wanting to break spec to impact other applications.

I've been testing with an archive of JPGs, to remove any issue around WebP being the issue, and I'm beginning to wonder if this is a Panels specific issue? When I compare OPDS feeds for both Kavita and Codex I have the following for the same Series:

Kavita (series is displayed as a generic folder icon)

<entry>
     <updated>2023-08-07T16:04:11</updated>
     <id>348</id>
     <title>JPG Test (Archive)</title>
     <link rel="subsection" type="application/atom+xml;profile=opds-catalog;kind=navigation" href="/api/opds/877f4adc-11cf-47a1-b9f5-92e1f1d94696/series/348"/>
     <link rel="http://opds-spec.org/image" type="image/jpeg" href="/api/image/series-cover?seriesId=348&apiKey=877f4adc-11cf-47a1-b9f5-92e1f1d94696"/>
     <link rel="http://opds-spec.org/image/thumbnail" type="image/jpeg" href="/api/image/series-cover?seriesId=348&apiKey=877f4adc-11cf-47a1-b9f5-92e1f1d94696"/>
</entry>

Codex (series is displayed as the cover of the book)

<entry>
     <id>/opds/v1.2/s/127/1</id>
     <title>JPG Test</title>
     <link rel="http://opds-spec.org/image/thumbnail" href="/opds/bin/c/663/cover.webp" type="image/webp"/>
     <link rel="http://opds-spec.org/image" href="/opds/bin/c/663/0/page.jpg" type="image/jpeg"/>
     <link rel="subsection" href="/opds/v1.2/s/127/1" type="application/atom+xml;profile=opds-catalog;kind=acquisition" thr:count="1"/>
     <published>2023-08-07T16:01:50.479488+0000</published>
     <updated>2023-08-07T16:01:50.479508+0000</updated>
     <content type="text">1 issues</content>
</entry>

When looking at http://opds-spec.org/image a difference between the two is the href pointing towards, what I assume is a file reference vs. explicitly defining the extension type. But outside of that, they look relatively similar, though I'm not super well versed on the OPDS spec to say if both are correct/compliant.

I guess the better question is, is there an OPDS reader that has been validated with Kavita shows previews when viewing by series (i.e., my previous screenshot of the Codex feed)? If yes, then the assumption would need to be pointed back at Panels rather than an issue here.

howdy-im-david commented 1 year ago

I'll add that I spun up an instance of Komga and it also displays Series thumbnails in Panels. Even more interesting is that it a bit different schema when viewing the XML feed.

<entry>
     <title>JPG_Test</title>
     <updated>2023-08-07T18:05:22Z</updated>
     <id>0D75HF8CJV2CJ</id>
     <content/>
     <link type="application/atom+xml;profile=opds-catalog;kind=navigation" rel="subsection" href="/opds/v1.2/series/0D75HF8CJV2CJ"/>
</entry>

I do have an open issue flagged with the Panels team to review to hopefully track this down to see where the issue may lie. Kavita is the best performing OPDS server by far for CBZ comic books (outside of a nitpick of it saying "(Archive)" on every series name - ha), so I'm invested to get this sorted.

majora2007 commented 1 year ago

Hmm...let me try with a new endpoint serving up the image as a file, rather than an api endpoint.

howdy-im-david commented 1 year ago

Hey Joe, super quick note. The Panels devs are graciously looking into this. Come to find out, their OPDS ingestion is based on Kavita v0.6.2, so that certainly doesn’t take into account your Flattening/Rewrite with v0.7.2.

They have some additional/special logic, per supported feed, to grab series thumbnails, so we probably need to keep the schema unchanged unless they need something explicitly defined, like our discussion above.

I’ll report back with any updates in the meantime.

majora2007 commented 1 year ago

Oh wow, thanks for the update. That is surprising this wasn't reported to them earlier by anyone. We have no plans to alter the structure further.

Would you mind linking the forum post here?

howdy-im-david commented 1 year ago

Sure, it's on their official Discord here: https://discord.com/channels/1103436296153747522/1137054394932809948

majora2007 commented 1 year ago

I can't seem to open the link. I didn't see anything online for their discord. If you could invite me, that would be great. I would love to have a more open line of communication with Panels, rather than just their Forums.

majora2007 commented 1 year ago

I was able to find it on their twitter of all places. I've joined.

majora2007 commented 1 year ago

Looks like Panels has corrected this for their upcoming release, so I'll close this out. Thanks for reporting it on both sides to get it closed out.

majora2007 commented 1 year ago

@howdy-im-david Thanks for the OpenCollective donation. I really appreciate it. Ping me in discord if you want to try Kavita+ on the house.