From ab521ac093fd9ecd4b4a79f6231cd3281401acb9 Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Mon, 10 Sep 2012 22:53:30 -0500 Subject: [PATCH] No images for non-epub forms, show that clearly in example.ini. --- calibre-plugin/jobs.py | 5 +++ downloader.py | 5 +++ example.ini | 78 +++++++++++++++++++++++++++++++++++------- plugin-example.ini | 8 +++-- 4 files changed, 81 insertions(+), 15 deletions(-) diff --git a/calibre-plugin/jobs.py b/calibre-plugin/jobs.py index 83d5187e..29ea29bf 100644 --- a/calibre-plugin/jobs.py +++ b/calibre-plugin/jobs.py @@ -120,6 +120,11 @@ def do_download_for_worker(book,options): if not options['updateepubcover'] and 'epub_for_update' in book and options['collision'] in (UPDATE, UPDATEALWAYS): ffdlconfig.set("overrides","never_make_cover","true") + + # images only for epub, even if the user mistakenly turned it + # on else where. + if options['fileform'] != "epub": + ffdlconfig.set("overrides","include_images","false") adapter = adapters.getAdapter(ffdlconfig,book['url'],options['fileform']) adapter.is_adult = book['is_adult'] diff --git a/downloader.py b/downloader.py index 7b3e822e..88e9c5eb 100644 --- a/downloader.py +++ b/downloader.py @@ -121,6 +121,11 @@ def main(): if options.update and not options.updatecover: config.set("overrides","never_make_cover","true") + + # images only for epub, even if the user mistakenly turned it + # on else where. + if options.format != "epub": + config.set("overrides","include_images","false") if options.options: for opt in options.options: diff --git a/example.ini b/example.ini index 67392708..1d92684e 100644 --- a/example.ini +++ b/example.ini @@ -1,5 +1,5 @@ ## This is an example of what your personal configuration might look -## like. +## like. Uncomment options by removing the '#' in front of them. [defaults] ## Some sites also require the user to confirm they are adult for @@ -7,34 +7,86 @@ ## personal.ini, not defaults.ini. #is_adult:true +[epub] +## include images from img tags in the body and summary of stories. +## Images will be converted to jpg for size if possible. Images work +## in epub format only. To get mobi or other format with images, +## download as epub and use Calibre to convert. +#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 + +## 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: false + + ## Most common, I expect will be using this to save username/passwords -## for different sites. +## for different sites. Here are a few examples. + [www.twilighted.net] #username:YourPenname #password:YourPassword +## default is false +#collect_series: true [www.ficwad.com] #username:YourUsername #password:YourPassword +[www.twiwrite.net] +#username:YourName +#password:yourpassword +## default is false +#collect_series: true + [www.adastrafanfic.com] ## Some sites do not require a login, but do require the user to ## confirm they are adult for adult content. #is_adult:true -## The [defaults] section here will override the system [defaults], -## but not format, site for site:format sections. -[defaults] -## Directories only useful in commandline or zip files. -#output_filename: books/${title}-${siteabbrev}_${storyId}${formatext} -#output_filename: books/${site}/${authorId}/${title}-${storyId}${formatext} +[www.thewriterscoffeeshop.com] +#username:YourName +#password:yourpassword +#is_adult:true +## default is false +#collect_series: true + +[www.fictionalley.org] +#is_adult:true + +[www.harrypotterfanfiction.com] +#is_adult:true + +[www.fimfiction.net] +#is_adult:true +#fail_on_password: false + +[www.tthfanfic.org] +#is_adult:true +## tth is a little unusual--it doesn't require user/pass, but the site +## keeps track of which chapters you've read and won't send another +## update until it thinks you're up to date. This way, on download, +## it thinks you're up to date. +#username:YourName +#password:yourpassword -## For example, zip_output here will turn on zip for html and txt, but -## not epub because the system [epub] section explicitly says -## zip_output: false (epubs *are* specially formated zip files.) -#zip_output: true -#zip_filename: ${title}-${siteabbrev}_${storyId}${formatext}.zip ## This section will override anything in the system defaults or other ## sections here. [overrides] +## default varies by site. Set true here to force all sites to +## collect series. +#collect_series: true diff --git a/plugin-example.ini b/plugin-example.ini index a08ea973..1c92afc3 100644 --- a/plugin-example.ini +++ b/plugin-example.ini @@ -6,8 +6,11 @@ ## adult content. Uncomment by removing '#' in front of is_adult. #is_adult:true -## include images from img tags in the body and summary of -## stories. Images will be converted to jpg for size if possible. +[epub] +## include images from img tags in the body and summary of stories. +## Images will be converted to jpg for size if possible. Images work +## in epub format only. To get mobi or other format with images, +## download as epub and use Calibre to convert. #include_images:true ## If not set, the summary will have all html stripped for safety. @@ -28,6 +31,7 @@ ## space. #grayscale_images: false + ## Most common, I expect will be using this to save username/passwords ## for different sites. Here are a few examples.