Mobileread
UNIX CLI workflow tools
#1  AliceWonder 09-07-2019, 08:32 AM
I generally prefer a CLI workflow.

And yes, I do have IBM punch cards on my desk...

Anyway - as I'm learning ePub from a CLI workflow perspective I'm taking notes so that when I forget something I can look at my notes.

I'm actually taking those notes in .xhtml files and eventually will pop them out as an ePub.

But since ePub is not ideal for the distribution of scripts, scripts I'm creating for my CLI workflow I am putting on github.

https://github.com/VeryGoodErotica/geekPub

There may be bugs, always back up before running random stuff off the Internet, but I thought they may be of interest to some here - especially the resource obfuscation script.
Reply 

#2  AliceWonder 09-08-2019, 06:38 AM
Tested the obfuscation script and fixed a bad bug - when I read the ePub obfuscation specification, I read that the first 1024 bytes get obfuscated but its actually the first 1040 - my eyes, when they get tired, they fill in the blanks and sometimes not correctly.

But that is fixed and I tested it with several different readers.

Interestingly when I obfuscate an SVG file - it works but ePubCheck plugin in Calibre does not run. It exits w/o giving a report. The ePub files work just fine. I tested by obfuscating SVG first just to make sure broken fonts weren't being replaced by same fonts from my system.

When I obfuscate fonts (what obfuscation is intended for) ePubCheck plugin with Calibre works as expected.
Reply 

#3  JSWolf 09-08-2019, 07:10 AM
Could it be that SVG is not meant to be obfuscated?
Reply 

#4  AliceWonder 09-08-2019, 08:09 AM
Quote JSWolf
Could it be that SVG is not meant to be obfuscated?
While I would agree that obfuscating SVG is rather silly, I think it is a bug in the plugin. Not ePubCheck itself as far as I can tell, uploading the ePub to websites that provide it ePubCheck, it passes validation.

If it was a violation of the spec then the ePubCheck should have complained rather than exiting w/ no information good or bad.

I do not think it is a priority bug. I may see if I can identify where it happens myself before reporting it to the maintainer.
Reply 

#5  Doitsu 09-08-2019, 01:14 PM
Quote AliceWonder
While I would agree that obfuscating SVG is rather silly, I think it is a bug in the plugin.
If you provide a test case, I'll update the EPUBCheck plugin.
Reply 

#6  AliceWonder 09-08-2019, 03:41 PM
Quote Doitsu
If you provide a test case, I'll update the EPUBCheck plugin.
Test case (6.2 kB)

https://librelamp.com/testCase.epub
Reply 

#7  Doitsu 09-08-2019, 05:45 PM
Quote AliceWonder
Test case (6.2 kB)

https://librelamp.com/testCase.epub
According to EPUBCheck, your test case either is an invalid epub book or you've discovered an EPUBCheck bug.

I got the following error messages for your test case:

Code
Validating using EPUB version 3.2 rules.
java.lang.NullPointerException at com.adobe.epubcheck.xml.XMLParser.process(XMLParser.java:200) at com.adobe.epubcheck.ops.OPSChecker.validate(OPSChecker.java:150) at com.adobe.epubcheck.ops.OPSChecker.validate(OPSChecker.java:119) at com.adobe.epubcheck.ops.OPSChecker.runChecks(OPSChecker.java:107) at com.adobe.epubcheck.opf.OPFChecker.checkItemContent(OPFChecker.java:455) at com.adobe.epubcheck.opf.OPFChecker.runChecks(OPFChecker.java:159) at com.adobe.epubcheck.opf.OPFChecker30.runChecks(OPFChecker30.java:88) at com.adobe.epubcheck.ocf.OCFChecker.runChecks(OCFChecker.java:315) at com.adobe.epubcheck.api.EpubCheck.doValidate(EpubCheck.java:224) at com.adobe.epubcheck.tool.EpubChecker.validateFile(EpubChecker.java:221) at com.adobe.epubcheck.tool.EpubChecker.processFile(EpubChecker.java:296) at com.adobe.epubcheck.tool.EpubChecker.run(EpubChecker.java:158) at com.adobe.epubcheck.tool.Checker.main(Checker.java:31)
Messages: 0 fatals / 0 errors / 0 warnings / 0 infos
Reply 

#8  AliceWonder 09-08-2019, 05:50 PM
It's almost certainly an EPUBCheck bug then. I'll post it there.
Reply 

#9  pdurrant 09-08-2019, 06:00 PM
Quote AliceWonder
Tested the obfuscation script and fixed a bad bug - when I read the ePub obfuscation specification, I read that the first 1024 bytes get obfuscated but its actually the first 1040 - my eyes, when they get tired, they fill in the blanks and sometimes not correctly.

But that is fixed and I tested it with several different readers.

Interestingly when I obfuscate an SVG file - it works but ePubCheck plugin in Calibre does not run. It exits w/o giving a report. The ePub files work just fine. I tested by obfuscating SVG first just to make sure broken fonts weren't being replaced by same fonts from my system.

When I obfuscate fonts (what obfuscation is intended for) ePubCheck plugin with Calibre works as expected.
Note that there are two versions of font obfuscation in ePubs. The one Adobe used, and the one the IDPF adopted. I can't remember which way round they are, but that's the reaosn for the 1024/1040 difference.
Reply 

#10  AliceWonder 09-08-2019, 06:44 PM
IDPF is 1040.

I am aware Adobe has one but I know nothing about it and don't really care to, the 1024 bug I initially had was from reading the spec at W3C page wrong, technical docs are bland and my eyes get tired, that's the only obfuscation algorithm for ePub I've read so I can't blame it on the Adobe spec.

Fortunately I didn't spend too much time figuring it out, when it didn't work I read the spec again and the 1040 jumped out at me.
Reply 

  Next »  Last »  (1/2)
Today's Posts | Search this Thread | Login | Register