jgoguen / calibre-kobo-driver

An extension of the existing KoboTouch driver provided with Calibre. This plugin allows modifying ePub files to enable extra Kobo features. I am providing code in the repository to you under an open source license. Because this is my personal repository, the license you receive to my code is from me and not my employer.
GNU General Public License v3.0
336 stars 23 forks source link

Possible rebuild of kepub structure and additional files needed #7

Closed jgoguen closed 11 years ago

jgoguen commented 11 years ago

As reported by @mauriziofantino in bug #6, it may help with kepub compatibility if additional files are added to the kepub package. There is a CSS file, and a JavaScript file which seems to have a lot of processing for night/day mode, and bookmark locations.

giorgio130 commented 11 years ago

I am not a lawyer but I don't know if those files are to be considered property of Kobo, and if they can be freely redistributed. Watch out.

mauriziofantino commented 11 years ago

Giorgio, you pointed out an important aspect which it must be considered so to not break any copyright issue. The simple solution to solve the bookmarks problem is probably to modify the epub style setting the margin equal to zero without touching any kobo potential Intellectual Properties Rights. At the end this can really be the best and clean way to proceed.

jgoguen commented 11 years ago

One thing that it doesn't change is the validity of the bug report. However, it looks like these files cannot be redistributed. There's no copyright or license included, which in at least my jurisdiction is equivalent to "All Rights Reserved" and distribution is forbidden without written permission.

Regarding the styles, this may come down to a personal choice. I see no issues with the way the book displays (although I have seen the problem of cutting off some of the text with some other books of mine). However, I've played with setting margins to 0 and other tweaks and this still happens occasionally so I'm not convinced that a CSS change is the real solution to this problem.

Changing the styling on the fly is also dangerous, it's all done via CSS, which means setting the margins to 0 may cascade down and have unintended side effects later. Particularly with books from publishing companies, the book styles are frequently done in a specific way that represents the publisher's desired layout and how they want the book to appear to readers. CSS is a really nice way to do that since there's no need to do different styles for the larger Kobo Arc, the average Kobo Glo or Sony PRS line, or the smaller Kobo Mini. I'm reluctant to automatically modify that, even with a separate option; it's not like auto-removing smart quotes from files with invalid file encodings, that is fixing something broken while tweaking styles is (so far as I can determine) purely a visual preferences fix.

I'll keep checking to see if I can figure out some other reason for the text to get cut off, but it may unfortunately be one thing that we all have to deal with for now. For me, when this happens, it also drops me on the wrong page. The database does store what file you're reading and where you left off separately from bookmarks so it's possible that the two are unrelated.

giorgio130 commented 11 years ago

Probably the javascript file is more important... there could be an option to point at the folder where this file is stored, and let the user retrieve it. It would be quite simple since it is sufficient to unzip a preview kepub, which are usually not covered by drm.

mauriziofantino commented 11 years ago

It seems that the margin equal to zero can fix the problem if you fix it on the reader. What I can tell is that all the kepub I have opened taken from the store and without drm has the variable margin set to 0. I have not idea if this is a coincidence or not... As far as the javascript file is concerned for sure it is there for a reason. Is referred in each xhtml file and inside has script some function to process positions inside the book, so I believe both that can fix the problem in handling the bookmark and it should be contained in each ebook. Unziping a previewed kepub grab the file, placing in a fixed position in the kobo directory and put a "centralized" reference to all the epubs to a single copy of this file I do not know if it will work and then if it is convinient. We should also considere that I do believe that the problem with bookmarks is going to be (I hope) just temporary and related to this version of the Kobo firmware.

giorgio130 commented 11 years ago

@maurizio that's not what I meant, I wanted to say that in order to place those files inside our epubs they have to be sourced by the user since they can't be redistributed, and in the driver preferences one could tell where the file is stored on the computer in order to be included in the epub.

mauriziofantino commented 11 years ago

@giorgio got your point now.

jgoguen commented 11 years ago

With regard to including the kobo.css and/or kobo.js files, one thing that is very clear in my jurisdiction is that even facilitating the distribution of files is against copyright law. I believe that I'm within the law to ask for books to inspect since I'm sure that could be argued under the clause for creating interoperable systems, but I doubt greatly that I would be able to justify facilitating the distribution of these files. Ignoring that, for most users this would be an option that they wouldn't know what to do with and so far as I understand it no one in North America could tell them what to do with it.

Regarding the margin fix, I took a look at how calibre does it and it's looking like a non-trivial change that requires re-implementing calibre's conversion process for styles or forcing the entire conversion process to run as part of uploading books. I'd rather not do this and say that it's handled through the regular conversion so that's where it stays. Yes, the stripping of smart punctuation is in the conversion process, and yes if I can take it out of this driver I will. If there's something I've missed that makes it relatively simple than feel free to point it out or make suggestions and re-open this, and if I think of anything better I'll investigate it, but for now I'm going to close this as "won't fix".