MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Plugins (https://www.mobileread.com/forums/forumdisplay.php?f=268)
-   -   media type in the manifest (https://www.mobileread.com/forums/showthread.php?t=260449)

rubeus 05-12-2015 04:00 AM

media type in the manifest
 
Hi,

how does Sigil determine the media type of fonts in the manifest? Checking the code often brings up wrong media types like octet-stream, but unfortunetly there is no way of correcting this in an efficient way. I need to type it in or do a search and replace.

//rubeus

KevinH 05-12-2015 09:58 AM

It uses the media-type provided by the incoming manifest or alternatively the file extension (.ttf, .otf, etc) via a short lookup dictionary when the font is first selected/imported.

rubeus 05-12-2015 01:08 PM

Thx, may it be possible to post the mapping table?

KevinH 05-12-2015 03:23 PM

Here is the link:

https://github.com/user-none/Sigil/b...PFResource.cpp

At the very bottom of this file you will find a mapping table.

The plugin uses its own version of this and they may not be fully in sync but they are close. In a plugin launcher code there is a easy way to get the media-type if you provide the basename of the file with extension. It also provides the media-type for every font file. So the plugin should already easily be able to supply you with the media-type for any file existing in the epub that has an entry in the manifest.

KevinH

rubeus 05-13-2015 02:49 AM

Thanks so far. What i'm looking for is something to change the media-type if flightcrew is complaining against "wrong" ones. Flightcrew complains, but there is no way of fixing that except manual work.
I think there is no reader/app available which will not work properly if the media type is weird, but i like to have an error reporting clean instead of deciding all the time if an error can be ignored or not.

JSWolf 05-13-2015 05:51 AM

Quote:

Originally Posted by rubeus (Post 3100997)
Thanks so far. What i'm looking for is something to change the media-type if flightcrew is complaining against "wrong" ones. Flightcrew complains, but there is no way of fixing that except manual work.
I think there is no reader/app available which will not work properly if the media type is weird, but i like to have an error reporting clean instead of deciding all the time if an error can be ignored or not.

Ignore FlightCrew. It misses way too many errors. Use epubcheck to check for errors.

rubeus 05-13-2015 05:55 AM

As far as i know epubcheck requires Java. I dont have this and will not install it. Too many security holes in Java, just like Flash.

JSWolf 05-13-2015 05:58 AM

Quote:

Originally Posted by rubeus (Post 3101063)
As far as i know epubcheck requires Java. I dont have this and will not install it. Too many security holes in Java, just like Flash.

As an alternative, you could use the error checker built into the Calibre eBook editor.

But don't rely on FlightCrew. It's just not good enough.

Toxaris 05-13-2015 07:01 AM

You can install Java and still disable usage from the browser.

rubeus 05-13-2015 07:25 AM

There is no need to deactivate something if you install the server version of Java. There are no plugins, no install activities, just a bunch of files to be stored somewhere.
But this is not the point. Flightcrew is throwing some errors which i want to handle more efficiently. Thats why i asked how Sigil is determining the needed media-type.

KevinH 05-13-2015 08:56 AM

Please post the current manifest entry and the error message from flightcrew

KevinH

rubeus 05-13-2015 09:13 AM

Well, Flightcrew is complaining that application/octet-stream is not a valid mesia type and should be application/vnd.ms-opentype

Thats correct cause in the manifest it is octet-stream. Now i have to go to the content.opf hand need to change it manually. There is no way to copy the correct media type out of the error window to paste it in nor any other way of double clicking right clicking. I'm looking for a way to simplify this as Sigil/Flightcrew does know what the caorrect value is but offers nothing to correct it.

Toxaris 05-13-2015 12:37 PM

What font are you adding? I can't remember seeing octet-stream as media type while adding fonts.

Doitsu 05-13-2015 01:11 PM

1 Attachment(s)
You could automate mimetype replacements with Saved Searches:
  1. Unzip the attached .ini file and import it. (Tools > Saved Searches... > Import)
  2. Select the desired mimetype, click Load Search and Close.
  3. Select the .opf file, press CTRL+F, select Current File and replace all font mimetypes.

DiapDealer 05-13-2015 01:31 PM

Quote:

Originally Posted by Toxaris (Post 3101303)
What font are you adding? I can't remember seeing octet-stream as media type while adding fonts.

Perhaps it's being encountered in malformed, pre-existing epubs?

@OP: I'd suggest a plugin that checks font-file extensions and then finds the corresponding opf manifest entry and adjusts the mimetype if necessary. You could probably incorporate it into your Clean OPF plugin.


All times are GMT -4. The time now is 08:30 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.