diff --git a/calibre-plugin/plugin-defaults.ini b/calibre-plugin/plugin-defaults.ini index b66ae03f..93c04822 100644 --- a/calibre-plugin/plugin-defaults.ini +++ b/calibre-plugin/plugin-defaults.ini @@ -1182,6 +1182,10 @@ output_css: ## include images from img tags in the body and summary of ## stories. Images will be converted to jpg for size if possible. ## include_images is *only* available in epub and html output format. +## You can also set include_images:coveronly to exclude images in the +## story text but still include specific cover images or +## default_cover_image, force_cover_image, or use_old_cover cover +## images. include_images:true ## Quality level to use when converting images to jpg. Range is 0-100, @@ -1333,6 +1337,10 @@ nook_img_fix:true ## stories. Images will be converted to jpg for size if possible. ## include_images is *only* available in epub and html output formats. ## include_images is *not* available in the web service in any format. +## You can also set include_images:coveronly to exclude images in the +## story text but still include specific cover images or +## default_cover_image, force_cover_image, or use_old_cover cover +## images. #include_images:false ## Quality level to use when converting images to jpg. Range is 0-100, diff --git a/fanficfare/adapters/adapter_storiesonlinenet.py b/fanficfare/adapters/adapter_storiesonlinenet.py index ffa703bf..1098cb8b 100644 --- a/fanficfare/adapters/adapter_storiesonlinenet.py +++ b/fanficfare/adapters/adapter_storiesonlinenet.py @@ -259,7 +259,7 @@ class StoriesOnlineNetAdapter(BaseSiteAdapter): soup = soup.find('header') # Remove some tags based on their class or id elements_to_remove = ['#det-link', '#s-details', '#index-list', '#s-title', '#s-auth', '.copy'] - if not self.getConfig('include_images'): + if self.getConfig('include_images') != 'true': # false or coveronly elements_to_remove.append('img') for element_name in elements_to_remove: elements = soup.select(element_name) diff --git a/fanficfare/adapters/base_adapter.py b/fanficfare/adapters/base_adapter.py index 793f7607..57b328d3 100644 --- a/fanficfare/adapters/base_adapter.py +++ b/fanficfare/adapters/base_adapter.py @@ -648,7 +648,7 @@ class BaseSiteAdapter(Requestable): acceptable_attributes.append('title') #print("include_images:"+self.getConfig('include_images')) - if self.getConfig('include_images'): + if self.getConfig('include_images') == 'true': # not false or coveronly ## actually effects all tags' attrs, not just , but I'm okay with that. acceptable_attributes.extend(('src','alt','longdesc')) for img in soup.find_all('img'): diff --git a/fanficfare/configurable.py b/fanficfare/configurable.py index d572ca9e..6a005fa0 100644 --- a/fanficfare/configurable.py +++ b/fanficfare/configurable.py @@ -274,7 +274,7 @@ def get_valid_set_options(): 'windows_eol':(None,['txt'],boollist), - 'include_images':(None,['epub','html'],boollist), + 'include_images':(None,['epub','html'],boollist+['coveronly']), 'jpg_quality':(None,['epub','html'],None), 'additional_images':(None,['epub','html'],None), 'grayscale_images':(None,['epub','html'],boollist), diff --git a/fanficfare/defaults.ini b/fanficfare/defaults.ini index 021d88cd..854c2509 100644 --- a/fanficfare/defaults.ini +++ b/fanficfare/defaults.ini @@ -1172,6 +1172,10 @@ output_css: ## include images from img tags in the body and summary of ## stories. Images will be converted to jpg for size if possible. ## include_images is *only* available in epub and html output format. +## You can also set include_images:coveronly to exclude images in the +## story text but still include specific cover images or +## default_cover_image, force_cover_image, or use_old_cover cover +## images. #include_images:false ## Quality level to use when converting images to jpg. Range is 0-100, @@ -1323,6 +1327,10 @@ nook_img_fix:true ## stories. Images will be converted to jpg for size if possible. ## include_images is *only* available in epub and html output formats. ## include_images is *not* available in the web service in any format. +## You can also set include_images:coveronly to exclude images in the +## story text but still include specific cover images or +## default_cover_image, force_cover_image, or use_old_cover cover +## images. #include_images:false ## Quality level to use when converting images to jpg. Range is 0-100, diff --git a/fanficfare/story.py b/fanficfare/story.py index 7daabf85..4149d7e4 100644 --- a/fanficfare/story.py +++ b/fanficfare/story.py @@ -1740,14 +1740,15 @@ class Story(Requestable): retlist = [] for i, info in enumerate(self.img_store.get_imgs()): retlist.append(info) - for imgfn in self.getConfigList('additional_images'): - data = self.get_request_raw(imgfn) - (discarddata,ext,mime) = no_convert_image(imgfn,data) - retlist.append({ - 'newsrc':"images/"+os.path.basename(imgfn), - 'mime':mime, - 'data':data, - }) + if self.getConfig('include_images') == 'true': + for imgfn in self.getConfigList('additional_images'): + data = self.get_request_raw(imgfn) + (discarddata,ext,mime) = no_convert_image(imgfn,data) + retlist.append({ + 'newsrc':"images/"+os.path.basename(imgfn), + 'mime':mime, + 'data':data, + }) return retlist def __str__(self):