Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 05-23-2024, 03:00 PM   #1
noteon
Connoisseur
noteon is on a distinguished road
 
Posts: 55
Karma: 54
Join Date: Apr 2011
Location: NYC
Device: Many
"Add blank .smil file?"

This is probably too niche for anyone to spend much time on, but:

I do lots of readaloud (media-overlay) epubs, and sometimes have to manually create a new .smil file so one of the XHTML files can have synchronized word highlighting.

Currently I unzip the epub, duplicate one of the .smils, rename it XYZ, rezip the epub, manually add the XYZ filename to the manifest, associate it with the appropriate XHTML file in the opf, use one of the existing <par>s from the original .smil as templates to create new ones, add ids to the appropriate word spans to the XHTML to match what the <par>s are calling for in the XYZ .smil, and probably a few things I'm forgetting.

This takes ten minutes or something, so it's not like it's fatal, but can some part of this process be automated? Maybe something like select "Add blank SMIL file," then the dialogue is something like: "Ask me what XHTML this should be associated with, then give me a generic <par> line that has that XHTML in it with a generic fragment identifier," it gets added to the opf in the right ways, and then I can take it manually from there?
noteon is offline   Reply With Quote
Old 05-23-2024, 03:06 PM   #2
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,154
Karma: 5450818
Join Date: Nov 2009
Device: many
Why not just create a template empty .smil file and use AddExisting to add that? If that is insufficient, then maybe select the xhtml file you want to use in BookBrowser and call a plugin to create the smil file with a par sample and have it add the things to the current epub.

I think a plugin would be the best approach since this is typically not something most epub devs do.

I and other plugin devs can help you take a stab at it.

Last edited by KevinH; 05-23-2024 at 03:10 PM.
KevinH is offline   Reply With Quote
Old 05-23-2024, 03:15 PM   #3
noteon
Connoisseur
noteon is on a distinguished road
 
Posts: 55
Karma: 54
Join Date: Apr 2011
Location: NYC
Device: Many
That makes sense.

A template empty .smil would get partway there, but there's still the file association stuff with multiple new ids in the opf, which makes my eyes cross. EDIT: Oh, that's already in your answer, NEVER MIND.

Where's the So You've Decided A Plugin Should Be Easy page?
noteon is offline   Reply With Quote
Old 05-23-2024, 03:25 PM   #4
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,154
Karma: 5450818
Join Date: Nov 2009
Device: many
The best way to learn to create Sigil plugins is to examine the code of existing plugins. There is also a plugin developer manual epub the can be downloaded from here:

https://github.com/Sigil-Ebook/Sigil...ork_rev14.epub

But I am happy to help get you started as I think this could be a useful plugin/addition for Sigil.

All we need is an example epub with a single chapter and its associated correct smil file. That way we can see exactly what you are trying to achieve.

It has just been too long since I played around with the smil spec to remember how they are integrated into the opf and what the contents should look like.

If you can attach one here, I would be happy to create a simple plugin example for you to modify and fix as you like. You can then add a gui to it to collect any extra information you need on the fly.

Last edited by KevinH; 05-23-2024 at 03:27 PM.
KevinH is offline   Reply With Quote
Old 05-23-2024, 03:33 PM   #5
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,154
Karma: 5450818
Join Date: Nov 2009
Device: many
Here is a silly sample plugin that tries to show examples of most of the basic features of Sigil's plugin interface. It may be a good starting point.

https://www.mobileread.com/forums/sh...d.php?t=251452

Grab testme3_v031.zip from the first post in that sticky thread.
KevinH is offline   Reply With Quote
Old 05-23-2024, 03:45 PM   #6
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,154
Karma: 5450818
Join Date: Nov 2009
Device: many
Actually my ePub3-itizer plugin has a bunch of old code to parse and update existing smil files that is now commented out but could be brought back to life and used.
KevinH is offline   Reply With Quote
Old 05-23-2024, 04:29 PM   #7
noteon
Connoisseur
noteon is on a distinguished road
 
Posts: 55
Karma: 54
Join Date: Apr 2011
Location: NYC
Device: Many
Quote:
Originally Posted by KevinH View Post
If you can attach one here, I would be happy to create a simple plugin example for you to modify and fix as you like. You can then add a gui to it to collect any extra information you need on the fly.
Wow, that is a very generous offer, thank you! I'll get you something after this job is shipped.

I used the ePub3-itizer all the time for a while, there. Many headaches avoided.
noteon is offline   Reply With Quote
Old 07-05-2024, 01:40 PM   #8
noteon
Connoisseur
noteon is on a distinguished road
 
Posts: 55
Karma: 54
Join Date: Apr 2011
Location: NYC
Device: Many
Quote:
Originally Posted by KevinH View Post
All we need is an example epub with a single chapter and its associated correct smil file. That way we can see exactly what you are trying to achieve.

It has just been too long since I played around with the smil spec to remember how they are integrated into the opf and what the contents should look like.

If you can attach one here, I would be happy to create a simple plugin example for you to modify and fix as you like. You can then add a gui to it to collect any extra information you need on the fly.
I don't think my client would want it posted publicly, but I thought a real-world example would be better than putting something together just for this purpose. Sending you a DM, and thank you again.
noteon is offline   Reply With Quote
Old 07-05-2024, 04:25 PM   #9
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,154
Karma: 5450818
Join Date: Nov 2009
Device: many
Thanks for sending me that example. I have a few questions:

1. Is the fixed layout xhtml file created in advance and fully existing when you want to add its smil file?

2. How do you know which id values (fragments in the target xhtml file) are associated with sound and which are not?

The reason I ask is we could easily walk the xhtml file file and generate in the order they are found in the file every id (fragment) that is attached to a specific set of tags (div, span, p, h1-h6) but not all of these may have audio associated with it.

3. So generating a set of par with unique ids with text src="TARGETFILENAME#id is possible but a placeholder dummy would need to be inserted for the desired mp3 file url.

But where on earth do you get the audio clipBegin="35.11" and clipEnd="35.37" values from?

4. Is the audio file generated in advance?

5. Is there a way to dump the timings on a word by word basis from the audio file? Otherwise how do you generate each word timing start time?

I need your answers to these questions to understand exactly what type of information needs to be extracted from the target xhtml file to generate the smil file and if any information at all can be extracted from the audio file.


I have seen smil files but ones rarely done on fixed layout epubs. They just need paragraph timings not word timings.
KevinH is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Keep the full file name and not add "unknown" ? bounce Calibre 7 08-27-2021 06:47 PM
Adding a new format to "add an empty file..." ownedbycats Calibre 4 07-19-2020 11:20 AM
using "Add Blank SVG Image" dhdurgee Sigil 3 11-07-2015 01:47 PM
Feature Request: configurable space setting for "Insert blank line" in "Look & Feel" therealjoeblow Calibre 15 07-25-2011 03:14 PM
"Add new format" to text file without extension myudkowsky Calibre 4 11-25-2010 02:00 PM


All times are GMT -4. The time now is 06:46 AM.


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