Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 12-02-2015, 09:14 AM   #136
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,803
Karma: 6000000
Join Date: Nov 2009
Device: many
Quote:
Originally Posted by AlPe View Post
(Where do you prefer discussing about it? Here or on GitHub?)
Here is fine.
Quote:
1. the user already has an EPUB 2 file (Open...)
2. the user creates the EPUB (2) file from scratch (New...)
3. the user has an EPUB 3 file already (Open...)
only cases 1 and 2 are doable now. Only simple edits with no tools used are possible with epub 3 now. We can modify the plugin when Sigil can handle more epub3 editing.

Quote:
A. inserting suitable id's (actually <span id="...">) into the XHTML markup to denote the MO fragments (I plan to code a separate edit plugin for doing this automatically);
B. adding audio files into the container (Sigil can do this already);
C. adding the SMIL files into the cointainer (for now, assume they are "dummy" SMIL files, but they can be computed using my aeneas tool: http://www.readbeyond.it/aeneas/ );
D. outputting to EPUB3: this can be done with your plugin plus some modifications I can easily code.
Is your aeneas opensource? Is it cross-platform? If not, I am not sure this project is doable as my code is gnu gpl and is meant to support all users of Sigil.

Quote:
My questions are:

a) since step D is almost already covered by your current plugin, does it make sense/are you fine with me adding functionalities to handle Media Overlays (SMIL) files to it, at least for cases 1. and 2.?
Happy to as long as your tool is opensource and crossplatform (builds,runs on Linux, MacOSX, and Windows).

Quote:
b) What would you suggest for case 3.? Is it better to wait for Sigil to become fully EPUB3-capable? Shall a specific version of the plugin be made for outputting EPUB3 if the user opens an EPUB3?
Hold off on case 3 since Sigil is not there yet.

Thanks,

KevinH
KevinH is offline   Reply With Quote
Old 12-02-2015, 09:39 AM   #137
AlPe
Digital Amanuensis
AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.
 
AlPe's Avatar
 
Posts: 727
Karma: 1446357
Join Date: Dec 2011
Location: Turin, Italy
Device: Several eReaders and tablets
Thank you for the quick reply.

Good, I will fork the repo, code the part for handling MO under cases 1. and 2., and open a pull request.

(BTW, aeneas is released under the AGPLv3, and it works on Linux, Windows and OS X, albeit it currently requires Python 2.7.x. In any case, it will be used outside Sigil. My idea is to create a Sigil plugin that will create an "aeneas Job" from the current EPUB --- basically, a ZIP file with the appropriate resources to compute the SMIL files --- so that the user could run aeneas on it outside Sigil, and import back the computed SMIL files.)
AlPe is offline   Reply With Quote
Advert
Old 12-02-2015, 09:51 AM   #138
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,803
Karma: 6000000
Join Date: Nov 2009
Device: many
Hi AlPe,

Have you thought of making aeneas code work on both Python2.7 and Python 3.4 from the same code base. It is simply not that hard to do, and some Linux distributions are moving away from installing python 2.7 at all. There are a number of packages that can help make the transition easier, including six, and own own compatibility_utils libraries. I would also be happy to help convert it to run on both if you run into any issues. We have done that with almost all of our plugins since Sigil's support for Python 2.7 may go away at some point as it is redundant given the embedded Python 3.4 interpreter.

If you do make that conversion in your code, you could then invoke it via a python subprocess or even directly import the code from the zip.

Please note, although epub3-itizer does not use much of them, there is a settings module and tk gui elements module that can be used to make the plugin more interactive if that is something you need.

KevinH

Quote:
Originally Posted by AlPe View Post
Thank you for the quick reply.

Good, I will fork the repo, code the part for handling MO under cases 1. and 2., and open a pull request.

(BTW, aeneas is released under the AGPLv3, and it works on Linux, Windows and OS X, albeit it currently requires Python 2.7.x. In any case, it will be used outside Sigil. My idea is to create a Sigil plugin that will create an "aeneas Job" from the current EPUB --- basically, a ZIP file with the appropriate resources to compute the SMIL files --- so that the user could run aeneas on it outside Sigil, and import back the computed SMIL files.)
KevinH is offline   Reply With Quote
Old 12-02-2015, 12:23 PM   #139
AlPe
Digital Amanuensis
AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.
 
AlPe's Avatar
 
Posts: 727
Karma: 1446357
Join Date: Dec 2011
Location: Turin, Italy
Device: Several eReaders and tablets
Work on aeneas started when lxml for Python 3 was broken, that's why it is 2.7.x. I am already planning to port it to Python 3.x, as the aeneas users seem happier with the "radical port" solution rather than having "bilingual" Py2+Py3 transitional code.

Moreover, there is another reason for executing aeneas externally: it might take some time to align text and audio, from few seconds to several minutes, depending on the length of the input audio files. Hence, I think the "async" execution flow I suggested is the best option for now: the "SMILify" plugin can create "dummy" SMIL files (i.e., syntactically correct SMIL files, but with dummy timing values), later to be replaced by the final SMIL files, with correct timing values.
AlPe is offline   Reply With Quote
Old 12-02-2015, 12:47 PM   #140
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,803
Karma: 6000000
Join Date: Nov 2009
Device: many
Hi Alpe,

If the changes become too invasive or if it is simply easier for you, why don't you just copy in everything I have from epub3-itizer as call it your own (permanently fork it) and create your own epub3-itizerSMIL plugin but ... perhaps choose a better name for it!

I am also okay with that approach, if that would be easier. As long as the resulting project can be used with all platforms and is open source, I am happy one way or the other.

KevinH
KevinH is offline   Reply With Quote
Advert
Old 12-02-2015, 02:11 PM   #141
AlPe
Digital Amanuensis
AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.
 
AlPe's Avatar
 
Posts: 727
Karma: 1446357
Join Date: Dec 2011
Location: Turin, Italy
Device: Several eReaders and tablets
I am actually glad to contribute the code for handling MO into epub3-itizer.

I need to produce an edit plugin (the "MOfier") to insert the id's or the <span>s for MO fragments into the XHTML files anyway, so I do not feel constrained at all.
AlPe is offline   Reply With Quote
Old 12-02-2015, 02:46 PM   #142
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,803
Karma: 6000000
Join Date: Nov 2009
Device: many
Okay,
Let me know if you have any plugin related questions.

Sigil's embedded python has access to a variety of parsers built right in including lxml, our own bs4 variation, html5lib, google's gumbo parser, and an easy to use python only serial parser called QuickParser, so there are lots of tools to use. Also we have cssselect that works with lxml, and cssutils if you need to parse css stylesheets. Plus access to opf_parser.py to extract info from the opf as needed.

BTW: as Sigil's epub3 handling improves, we will have need of an SMIL dtd for parsing SMIL files. If you have access to one with a usable license, I would love to know where to find it. Alternatively, we could develop specialized python for doing just that not using lxml at all.

Thanks,

KevinH
KevinH is offline   Reply With Quote
Old 12-04-2015, 09:03 AM   #143
AlPe
Digital Amanuensis
AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.
 
AlPe's Avatar
 
Posts: 727
Karma: 1446357
Join Date: Dec 2011
Location: Turin, Italy
Device: Several eReaders and tablets
Thank you.

Before starting modifying the .py code, I created a new branch on my clone and pushed a couple of EPUB2 trees demoing some possible inputs. You can find them here:

https://github.com/pettarin/ePub3-it...ee/mo/tests/mo

When you have 5 minutes, would you please confirm that handling those epub2_* publications is in scope for this plugin?

(The epub3_* is just the "base" from which I "backported" the EPUB2 trees, and it is not meant to be handled, as we discussed above, just ignore it.)

=== === ===

If the above is fine with you, I will proceed coding the SMIL parser/patcher and include it into the current plugin code. Basically, there will be a check for .smil files into Misc/ . If so, they will be parsed, to determine which XHTML files are associated to, and then the suitable metas and properties will be added into the OPF. The SMIL files might be patched too, to adjust the src attributes of text and audio elements.

=== === ===

SMIL DTD: the specs link to a RelaxNG: http://www.idpf.org/epub/301/spec/ep...verlays-schema which I think can be converted to DTD using jing and trang. I will check with the DAISY dev responsible for MO in EPUB3 if there is a "free" DTD available.
AlPe is offline   Reply With Quote
Old 12-04-2015, 09:45 AM   #144
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,803
Karma: 6000000
Join Date: Nov 2009
Device: many
Hi Alpe,

Thanks, I will take a look at it. Misc is used for things that Sigil would rather not deal with. So perhaps we should make a change in Sigil to create a Smil folder and put any smil files there? This is an easy enough change for Sigil and it better prepares things for epub3 going forward.

Is this something you would like?

KevinH
KevinH is offline   Reply With Quote
Old 12-04-2015, 09:55 AM   #145
AlPe
Digital Amanuensis
AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.
 
AlPe's Avatar
 
Posts: 727
Karma: 1446357
Join Date: Dec 2011
Location: Turin, Italy
Device: Several eReaders and tablets
Take your time, I do not think I will have time to work on this before next week.

=== === ===

SMIL files position: I have no preference, and it makes sense for Sigil to move the .smil files into OEBPS/Smil/ for consistency with the other type of assets.

(Currently, I put the .smil files of my EPUB3 in the OEBPS/Text/ directory, along with the .xhtml files. But the specs does not mandate a specific position for them. With respect to reading systems, there is no drawback choosing one internal location over another. Those supporting Media Overlays do it in a "spec compliant" way, NOT relying on naming conventions like expecting the smil files in say OEBPS/Text/ or similar.)
AlPe is offline   Reply With Quote
Old 12-06-2015, 03:18 AM   #146
AlPe
Digital Amanuensis
AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.
 
AlPe's Avatar
 
Posts: 727
Karma: 1446357
Join Date: Dec 2011
Location: Turin, Italy
Device: Several eReaders and tablets
Update on SMIL DTD: I asked around and it seems no DTD is available. I tried converting the RelaxNG linked in the specs into a DTD using trang, but it fails with errors. Moreover, I believe the conversion cannot be lossless anyway, since RelaxNG allows for external namespaces, which EPUB 3 Media Overlays use indeed (e.g. epub:textref or epub:type).

Is having a DTD an hard requirement?
AlPe is offline   Reply With Quote
Old 12-06-2015, 10:27 AM   #147
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,803
Karma: 6000000
Join Date: Nov 2009
Device: many
Hi Alpe,
No, it is not required.
I spent some time looking at the full smil spec and the subset? used in epub3. If we had a dtd we could load it into lxml and then serializing the lxml tree back to xml would be easier (void tags would remain void, etc), we could validate the input, and any changes made, etc.

Alternatively, we can write a smil specific parser and serializer if needed. I am thinking more long-term here for the best way to support smil in epub3 under Sigil.

Thanks,

KevinH
KevinH is offline   Reply With Quote
Old 12-08-2015, 04:24 PM   #148
AlPe
Digital Amanuensis
AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.
 
AlPe's Avatar
 
Posts: 727
Karma: 1446357
Join Date: Dec 2011
Location: Turin, Italy
Device: Several eReaders and tablets
I put into https://github.com/pettarin/ePub3-itizer/tree/mo the changes to output the required meta elements and media-overlays attributes into the OPF to support Media Overlays.

I tested it against the epub2 trees I prepared last week, and it works well. If the ebook has no SMIL files, the output is the same as before.

If it looks fine with you, I can open a pull request.
AlPe is offline   Reply With Quote
Old 12-08-2015, 10:04 PM   #149
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,803
Karma: 6000000
Join Date: Nov 2009
Device: many
Hi,
I looked at your commit. Do you really need to change single quotes to double quotes, and add unnecessary parentheses in if statements, and rename things that do not need to be renamed. You have made so many unnecessary changes it actually was hard to find exactly what you really do need to change.

I realize everyone programs by their own rules and many like to use the equivalent of python lint to meet some pep8 "standard", but those types of changes really shouldn't be mixed into the same commits with new features.

So please either back out those unneeded changes. Or, alternatively separate your commit into two pieces. One that simply cleans up what you didn't like, and then a second that actually adds the code you want to add to support SMIL.

Thanks,

KevinH

Quote:
Originally Posted by AlPe View Post
I put into https://github.com/pettarin/ePub3-itizer/tree/mo the changes to output the required meta elements and media-overlays attributes into the OPF to support Media Overlays.

I tested it against the epub2 trees I prepared last week, and it works well. If the ebook has no SMIL files, the output is the same as before.

If it looks fine with you, I can open a pull request.
KevinH is offline   Reply With Quote
Old 12-09-2015, 04:03 AM   #150
AlPe
Digital Amanuensis
AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.
 
AlPe's Avatar
 
Posts: 727
Karma: 1446357
Join Date: Dec 2011
Location: Turin, Italy
Device: Several eReaders and tablets
You are right. I forgot to disable the auto-cleaner in Vim.

(Not going to argue about your code style, however there are some inconsistent usage, e.g. double space after "=" in assignments, or module constants in uppercase and lowercase, etc. Anyway, your house, your rules. I'm ok with it.)

I pushed a "minimal" set of changes on the "momin" branch: https://github.com/pettarin/ePub3-itizer/tree/momin

The changes are:

1. tests/mo/ : directory containing the epub trees to test MO support;

2. README.md : changed date

3. src/plugin.xml : bumped to v0.3.3

4. src/plugin.py : added code to detect and patch SMIL files

5. src/opf_converter.py : added code to generate the <meta...> elements and media-overlay="..." attributes required when MO are defined.

Other notable changes:

A. I believe this was a bug:

https://github.com/kevinhendricks/eP...e12a271c48L259

B. refactored several open(...).write(...) calls into:

https://github.com/kevinhendricks/eP...406fd63772R114

C. there was a potential bug in the creation of the guide landmark in nav.xhtml:

https://github.com/kevinhendricks/eP...406fd63772R209
AlPe is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Conversion Output] KePub Output Plugin jgoguen Plugins 588 03-28-2025 02:26 PM
Create a javascript quizz for Epub3 in Sigil BertrandThibaut Sigil 3 01-26-2014 09:04 AM
An epub3 version of Sigil ? apulia03 Sigil 9 11-28-2012 01:07 AM
Plugin not customizable: Plugin: HTML Output does not need customization flyingfoxlee Conversion 2 02-24-2012 02:24 AM
epub3 Sigil Poetry(fixed layout) Giggleton Sigil 7 04-04-2011 12:58 PM


All times are GMT -4. The time now is 05:13 AM.


MobileRead.com is a privately owned, operated and funded community.