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

ZIP file support #9986

Closed
clach04 opened this issue Jan 1, 2023 · 6 comments
Closed

ZIP file support #9986

clach04 opened this issue Jan 1, 2023 · 6 comments

Comments

@clach04
Copy link
Contributor

clach04 commented Jan 1, 2023

  • KOReader version: 2022.08
  • Device: Kindle PaperWhite 2

Issue

Documentation mentions ZIP file support but does not explain this in detail

It looks like any supported format can be supported in a ZIP file IF the filename of the zip file is *.FORMAT.zip, e.g.:

  • myfile.txt.zip
  • myfile.rtf.zip

However https://github.com/koreader/koreader/blob/master/frontend/document/credocument.lua#L155 indicates the file type can be inferred by the first filename in the archive (a feature supported by many softwre ebook readers like FBReader, AlReader, etc). This does not appear to work.

I think there are two issues at play here:

  1. ZIP support not working consistently
  2. Doc issue, assuming the above is correct I could post a PR to the readme for this repo (the inde, and also add a comment to User Guide Discussions - Up to 23.10 (PDF version) #8058) once this is confirmed.

As always thanks to everyone working to support KoReader!

Steps to reproduce

See attached test/demo documents (from https://github.com/clach04/sample_reading_media):

Both books contain a single file called test_book.txt, no other files inside the ZIP archive.

>"c:\Program Files\7-Zip"\7z l C:\tmp\test_book.txt.zip

7-Zip 19.00 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2019-02-21

Scanning the drive for archives:
1 file, 254 bytes (1 KiB)

Listing archive: C:\tmp\test_book.txt.zip

--
Path = C:\tmp\test_book.txt.zip
Type = zip
Physical Size = 254

   Date      Time    Attr         Size   Compressed  Name
------------------- ----- ------------ ------------  ------------------------
2020-09-29 15:47:45 ....A          209           94  test_book.txt
------------------- ----- ------------ ------------  ------------------------
2020-09-29 15:47:45                209           94  1 files

>"c:\Program Files\7-Zip"\7z l C:\tmp\test_book_txt.zip

7-Zip 19.00 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2019-02-21

Scanning the drive for archives:
1 file, 254 bytes (1 KiB)

Listing archive: C:\tmp\test_book_txt.zip

--
Path = C:\tmp\test_book_txt.zip
Type = zip
Physical Size = 254

   Date      Time    Attr         Size   Compressed  Name
------------------- ----- ------------ ------------  ------------------------
2020-09-29 15:47:45 ....A          209           94  test_book.txt
------------------- ----- ------------ ------------  ------------------------
2020-09-29 15:47:45                209           94  1 files
crash.log (if applicable)

No crash.log

Let me know if logging is needed

If your issue doesn't directly concern a Lua crash, we'll quite likely need you to reproduce the issue with verbose debug logging enabled before providing the logs to us.
To do so, from the file manager, go to [Tools] → More tools → Developer options, and tick both Enable debug logging and Enable verbose debug logging.
You'll need to restart KOReader after toggling these on.

If you instead opt to inline it, please do so behind a spoiler tag:

crash.log
<Paste crash.log content here>
@hius07
Copy link
Member

hius07 commented Jan 1, 2023

indicates the file type can be inferred by the first filename in the archive

This piece of code is not executed by default, zip files are handled by muPDF due to bigger weight.

registry:addProvider("zip", "application/zip", self, 10)

registry:addProvider("zip", "application/zip", self, 20)

You can enforce cre handling for a zip file via long-pressing it and choosing Open with...

@clach04
Copy link
Contributor Author

clach04 commented Jan 2, 2023

Thanks @hius07 , that is really neat! I had no idea about the open with. I'll think on this a little before I do anything, I'm thinking about making a wiki page (and maybe guide) update.

@clach04
Copy link
Contributor Author

clach04 commented Jan 7, 2023

@hius07 sorry for the delay (been sick :-()

I went ahead and:

I've not yet made a README change yet for https://github.com/koreader/koreader/blob/master/README.md - seeking feedback on the wiki page(s) first. However I'm about to open a small PR to update the supported format list in the readme to match what is now in the wiki

@clach04
Copy link
Contributor Author

clach04 commented Jan 7, 2023

#10004 posted for the non-ZIP note

@hius07
Copy link
Member

hius07 commented Jan 8, 2023

Thank you, your wiki updates look good.
One note: KOReader can open a zip archive without long-pressing if the archive contains graphic files (jpg, png etc). To try it you can just change the extension from cbz to zip.

@clach04
Copy link
Contributor Author

clach04 commented Jan 8, 2023

Thanks, made a quick note to that effect in the wiki.

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