View Single Post
Old 02-27-2012, 02:18 PM   #126
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
Posts: 1,632
Karma: 456847
Join Date: Dec 2011
Location: Midwest USA
Device: Nook STR w/Glowlight, Kindle 3g, Droid
Beta Test for Image & Cover Support v1.5

Testing for 1.5 is finished. It's been released for general use.

These changes are all for EPUB format ebooks.

The big changes are:
  • Support for downloading images in the story text.
  • Support for cover image from three different sources.
  • Support to resize, make grayscale, and convert images to jpg.
  • Option for plugin to update calibre cover image on metadata update.
  • Major re-write of EPUB update to support images.
  • Improved handling of ini section priority.
  • New 'Stay on Top' option for 'Add New from URL(s)' dialog for easier drag-n-drop.
  • Add replace_hr option to replace <hr> tags with '* * *'
  • Support for fimfiction.net's locked story passwords.

Images
There's several new config parameters you can add to your personal.ini to turn on these features.

All of them should go under the [epub] section or the epub section for individual sites, such as [www.ficwad.com:epub].

The first turns images on in general. Without this, no images will be collected and it defaults to false.
Code:
include_images:true
The next allows the summary section in the title page to preserve its HTML from the source site. That way, images in the summary will be included. More on that in a moment. Summary metadata given to calibre still has HTML stripped for consistency.
Code:
keep_summary_html:true
As a convenience, and the draw the attention of more casual users, I added an 'Include images in EPUBs' checkbox to the Basic config tab. This is equivalent to adding:
Code:
[defaults]
include_images:true
keep_summary_html:true
make_firstimage_cover:true
...to the top of personal.ini. Your settings in personal.ini will override this.

Covers
There are three places cover images can come from.

First is an explicit cover image from the source site. Today, fimfiction.net is the only one--please let me know (with example URLs) if any of the other sites do, too.

Second, the downloader can use the first image it finds in the story with this paramter. If keep_summary_html is also true, it can come from the summary.
Code:
make_firstimage_cover:true
Third, you can set a specific image that will be used if one of the other two isn't found.
Code:
[www.adastrafanfic.com:epub]
default_cover_image:file:///C:/Users/username/Desktop/nook/images/icon.png
[www.fictionalley.org:epub]
default_cover_image:http://www.somesite.com/someimage.gif
Finally, if you want images inside the EPUB, but never want an image cover, you can use:
Code:
never_make_cover:true
Image options
All images saved to EPUB are converted to jpeg to save size. Further, you can set what size to scale the images down to fit in. Aspect ratio is preserved and images are never scaled up, only down. You can also have them converted to grayscale for additional(minor) space savings.
Code:
image_max_size: 580, 725
grayscale_images: true
The default size (580,725--width,height) is for my nook STR. If people tell me what appropriate sizes are for other book readers, I'll include them in the comments.

calibre cover
The plugin has a new option on the Basic tab, "Update Cover when Updating Metadata". When checked, the calibre cover image will be updated everytime the other calibre metadata is updated (assuming EPUB). If there is a cover image in the EPUB, it will be used. If not, calibre will generate the usual 'from EPUB format' type cover, usually showing the title page.

Internal changes
The code for updating existing EPUBs to add new chapters has been completely rewritten. You shouldn't see any change from the outside. Other than supporting images, that is.

Priority of personal.ini sections has been more formalized. When downloading an EPUB from ficwad, the sections will take priority in this order, from least to most specific:
  1. [defaults]
  2. [www.ficwad.com]
  3. [epub]
  4. [www.ficwad.com:epub]
  5. [overrides]
Which is why, if you set options in [epub], to override them for ficwad, you have to set them in [www.ficwad.com:epub]

For convenience of cutting and pasting, here's all the new image parameters together:
Spoiler:
Code:
[epub]
## include images from img tags in the body and summary of
## stories.  Images will be converted to jpg for size if possible.
include_images:true

## If not set, the summary will have all html stripped for safety.
## Both this and include_images must be true to get images in the
## summary.
keep_summary_html:true

## If set, the first image found will be made the cover image.  If
## keep_summary_html is true, any images in summary will be before any
## in chapters.
make_firstimage_cover: true

## If set, the epub will never have a cover, even include_images is on
## and the site has specific cover images.
#never_make_cover: false

## If set, and there isn't already a cover image from the adapter or
## from make_firstimage_cover, this image will be made the cover.
## It can be either a 'file:' or 'http:' url.
## Note that if you enable make_firstimage_cover in [epub], but want
## to use default_cover_image for a specific site, use the site:format
## section, for example: [www.ficwad.com:epub]
#default_cover_image:file:///C:/Users/username/Desktop/nook/images/icon.png
#default_cover_image:http://www.somesite.com/someimage.gif

## Resize images down to width, height, preserving aspect ratio.
## Nook size, with margin.
image_max_size: 580, 725

## Change image to grayscale, if graphics library allows, to save
## space.
#grayscale_images: true

fimfiction.net locked story passwords
The downloader will now prompt for password on fimfiction.net's locked stories. Because each locked story has a different password, it's not useful to store a password in personal.ini. You can, however, use the fail_on_password option to prevent the plugin from prompting for story passwords.
Code:
[www.fimfiction.net]
fail_on_password: true
I appreciate hearing from both people with problems and people without, thanks.

v1.5.1 adds error handing for image loading, stay-on-top
v1.5.2 fixes a problem d/l'ing chapter text in GA.
v1.5.3 fixes a fimficnet problem, addes replace_hr & never_make_cover options.
v1.5.4 more fimfic fixs
v1.5.5 fimfic story password support & fail_on_password option
v1.5.6 add 'Include images in EPUBs' checkbox
v1.5.7 add 'nook_img_fix' - wrap img tags with div if not already wrapped with div or p for a nook problem. Defaults to true.

Jim

Last edited by JimmXinu; 03-01-2012 at 08:28 PM. Reason: Remove obsolete beta versions
JimmXinu is offline   Reply With Quote