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

Downloaded EPUB files are partially corrupted #61

Closed
jzkmath opened this issue Oct 17, 2024 · 3 comments
Closed

Downloaded EPUB files are partially corrupted #61

jzkmath opened this issue Oct 17, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@jzkmath
Copy link

jzkmath commented Oct 17, 2024

Describe the bug
A clear and concise description of what the bug is.
If applicable, copy the error message output by jncep at the end (in red usually).

After version 48, downloaded EPUB files have errors that prevent them from being processed by Google Play Books. Newly uploaded books will sit on the "processing" phase for an extended time period and then ultimately fail.
Workaround currently is to use calibre to convert to MOBI and then convert back to EPUB to fix corruption

Expected behavior
A clear and concise description of what you expected to happen.

Downloaded EPUB files using jncep should process fine when uploaded to google play books.

To Reproduce
Write the specific jncep command you used.
If you used environment variables to set the options, also indicate them here.

Take care to hide your J-Novel Club credentials! This issue will be visible to everyone.

use jncep to download an epub file such as Demon Lord, retry Volume 9 part 2. Attempt to upload this epub to google play books.

Debug trace
If applicable, copy the debug trace of the execution. It can be obtained by passing the -d switch to jncep i.e. jncep -d ....
If the trace is big, copy it to a text file and add that file as attachment to this issue (by drag-and-dropping the file on this text box).

The email (J-Novel Club login) will appear in the trace, so delete it if you don't want to make it visible.

N/A

Running an epub checker I get the following information:

epubcheck Demon_Lord_Retry_Volume_9_Part_2.epub 
Validating using EPUB version 3.2 rules.
ERROR(OPF-029): Demon_Lord_Retry_Volume_9_Part_2.epub(-1,-1): The file "EPUB/i_cdn_j_novel_club_pub_img_1200_webp_01J_A_B_3681VEX0ECHF4280GB14B.jpg" does not appear to match the media type image/jpeg, as specified in the OPF file.
ERROR(PKG-021): Demon_Lord_Retry_Volume_9_Part_2.epub/EPUB/i_cdn_j_novel_club_pub_img_1200_webp_01J_A_B_3681VEX0ECHF4280GB14B.jpg(-1,-1): Corrupted image file encountered.
ERROR(OPF-029): Demon_Lord_Retry_Volume_9_Part_2.epub(-1,-1): The file "EPUB/i_cdn_j_novel_club_pub_img_1200_webp_01J_A_B_3770C0N8B6RK4EPPCP9AC.jpg" does not appear to match the media type image/jpeg, as specified in the OPF file.
ERROR(PKG-021): Demon_Lord_Retry_Volume_9_Part_2.epub/EPUB/i_cdn_j_novel_club_pub_img_1200_webp_01J_A_B_3770C0N8B6RK4EPPCP9AC.jpg(-1,-1): Corrupted image file encountered.
ERROR(OPF-029): Demon_Lord_Retry_Volume_9_Part_2.epub(-1,-1): The file "EPUB/i_cdn_j_novel_club_pub_img_1200_webp_01J_A_B_380PX4S5ZZYXRCPB7ZKEM.jpg" does not appear to match the media type image/jpeg, as specified in the OPF file.
ERROR(PKG-021): Demon_Lord_Retry_Volume_9_Part_2.epub/EPUB/i_cdn_j_novel_club_pub_img_1200_webp_01J_A_B_380PX4S5ZZYXRCPB7ZKEM.jpg(-1,-1): Corrupted image file encountered.

Check finished with errors
Messages: 0 fatals / 6 errors / 0 warnings / 0 infos

EPUBCheck completed

Given this information, I am guessing that jncep is generating epub files that use WEBP instead of JPG or PNG which is breaking the epub file.

Environment (please complete the following information):

  • OS: Linux Mint 22
  • Python version: 3.12
  • JNCEP version: V48
@jzkmath jzkmath added the bug Something isn't working label Oct 17, 2024
@gvellut
Copy link
Owner

gvellut commented Oct 18, 2024

Thank you for the bug report.

I think you are right: The image has a .jpg extension but is now actually webp (like with https://cdn.j-novel.club/pub/img/1200/webp/01J/A/D/21WRCKSKBFEVTGR3GCF43.jpg). So I think there will be a need to perform a conversion (it seems my kobo cannot display them and it's possibly the same for other devices).

@gvellut gvellut self-assigned this Oct 18, 2024
@gvellut
Copy link
Owner

gvellut commented Oct 18, 2024

There is a link to some doc about the image URLs #54 (comment)
It seems one can use a crafted URL to get the image in JPEG format instead of Webp: for example, for the URL above:

Webp (inside the original content):
https://cdn.j-novel.club/pub/img/1200/webp/01J/A/D/21WRCKSKBFEVTGR3GCF43.jpg

JPEG (by slightly changing the URL):
https://cdn.j-novel.club/pub/img/1200/jpg/01J/A/D/21WRCKSKBFEVTGR3GCF43.jpg

@gvellut
Copy link
Owner

gvellut commented Oct 20, 2024

Version 49 (just released) should fix the issue. Let me know if not the case.
Commit: 043a045

@gvellut gvellut closed this as completed Oct 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants