diff --git a/defaults.ini b/defaults.ini
index bd7df382..c00a6007 100644
--- a/defaults.ini
+++ b/defaults.ini
@@ -324,6 +324,8 @@ 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 output format.
+## include_images is *not* available in the web service in any format.
#include_images:false
## If set, the first image found will be made the cover image. If
diff --git a/fanficdownloader/adapters/adapter_fanfictionnet.py b/fanficdownloader/adapters/adapter_fanfictionnet.py
index a4bb1211..558453f8 100644
--- a/fanficdownloader/adapters/adapter_fanfictionnet.py
+++ b/fanficdownloader/adapters/adapter_fanfictionnet.py
@@ -80,7 +80,7 @@ class FanFictionNetSiteAdapter(BaseSiteAdapter):
# use BeautifulSoup HTML parser to make everything easier to find.
try:
data = self._fetchUrl(url)
- #print("\n===================\n%s\n===================\n"%data)
+ #logging.debug("\n===================\n%s\n===================\n"%data)
soup = bs.BeautifulSoup(data)
except urllib2.HTTPError, e:
if e.code == 404:
@@ -108,11 +108,11 @@ class FanFictionNetSiteAdapter(BaseSiteAdapter):
tryurl = "http://%s/s/%s/%d/"%(self.getSiteDomain(),
self.story.getMetadata('storyId'),
chapcount+1)
- print('=Trying newer chapter: %s' % tryurl)
+ logging.debug('=Trying newer chapter: %s' % tryurl)
newdata = self._fetchUrl(tryurl)
if "not found. Please check to see you are not using an outdated url." \
not in newdata:
- print('=======Found newer chapter: %s' % tryurl)
+ logging.debug('=======Found newer chapter: %s' % tryurl)
soup = bs.BeautifulSoup(newdata)
except:
pass
@@ -160,7 +160,7 @@ class FanFictionNetSiteAdapter(BaseSiteAdapter):
metatext = stripHTML(gui_table1i.find('div', {'style':'color:gray;'})).replace('Hurt/Comfort','Hurt-Comfort')
metalist = metatext.split(" - ")
- #print("metatext:(%s)"%metalist)
+ #logging.debug("metatext:(%s)"%metalist)
# Rated: Fiction K - English - Words: 158,078 - Published: 02-04-11
@@ -176,9 +176,9 @@ class FanFictionNetSiteAdapter(BaseSiteAdapter):
genrelist = metalist[0].split('/') # Hurt/Comfort already changed above.
goodgenres=True
for g in genrelist:
- print("g:(%s)"%g)
+ #logging.debug("g:(%s)"%g)
if g.strip() not in ffnetgenres:
- print("g not in ffnetgenres")
+ logging.info("g not in ffnetgenres")
goodgenres=False
if goodgenres:
self.story.extendList('genre',genrelist)
diff --git a/fanficdownloader/story.py b/fanficdownloader/story.py
index b36dbfaf..b6897d2f 100644
--- a/fanficdownloader/story.py
+++ b/fanficdownloader/story.py
@@ -414,9 +414,11 @@ class Story(Configurable):
def getChapters(self,fortoc=False):
"Chapters will be tuples of (title,html)"
retval = []
- if (self.getConfig('add_chapter_numbers') == "true" \
- or (self.getConfig('add_chapter_numbers') == "toconly" and fortoc)) \
- and self.getConfig('chapter_title_add_pattern'):
+ ## only add numbers if more than one chapter.
+ if len(self.chapters) > 1 and \
+ (self.getConfig('add_chapter_numbers') == "true" \
+ or (self.getConfig('add_chapter_numbers') == "toconly" and fortoc)) \
+ and self.getConfig('chapter_title_add_pattern'):
for index, (title,html) in enumerate(self.chapters):
retval.append( (string.Template(self.getConfig('chapter_title_add_pattern')).substitute({'index':index+1,'title':title}),html) )
else:
diff --git a/fanficdownloader/writers/writer_epub.py b/fanficdownloader/writers/writer_epub.py
index 8f97866f..312fb247 100644
--- a/fanficdownloader/writers/writer_epub.py
+++ b/fanficdownloader/writers/writer_epub.py
@@ -413,7 +413,7 @@ div { margin: 0pt; padding: 0pt; }
guide = None
coverIO = None
- imgid = "image0000"
+ coverimgid = "image0000"
if not self.story.cover and self.story.oldcover:
print("writer_epub: no new cover, has old cover, write image.")
(oldcoverhtmlhref,
@@ -425,8 +425,8 @@ div { margin: 0pt; padding: 0pt; }
outputepub.writestr(oldcoverhtmlhref,oldcoverhtmldata)
outputepub.writestr(oldcoverimghref,oldcoverimgdata)
- imgid = "image0"
- items.append((imgid,
+ coverimgid = "image0"
+ items.append((coverimgid,
oldcoverimghref,
oldcoverimgtype,
None))
@@ -451,6 +451,10 @@ div { margin: 0pt; padding: 0pt; }
imgmap['mime'],
None))
imgcount+=1
+ if 'cover' in imgfile:
+ # make sure coverimgid is set to the cover, not
+ # just the first image.
+ coverimgid = items[-1][0]
items.append(("style","OEBPS/stylesheet.css","text/css",None))
@@ -462,7 +466,7 @@ div { margin: 0pt; padding: 0pt; }
itemrefs.append("cover")
#
#
- metadata.appendChild(newTag(contentdom,"meta",{"content":"image0000",
+ metadata.appendChild(newTag(contentdom,"meta",{"content":coverimgid,
"name":"cover"}))
# cover stuff for later:
# at end of :
@@ -524,8 +528,8 @@ div { margin: 0pt; padding: 0pt; }
contentxml = contentdom.toxml(encoding='utf-8')
# tweak for brain damaged Nook STR. Nook insists on name before content.
- contentxml = contentxml.replace(''%imgid,
- ''%imgid)
+ contentxml = contentxml.replace(''%coverimgid,
+ ''%coverimgid)
outputepub.writestr("content.opf",contentxml)
contentdom.unlink()
diff --git a/plugin-defaults.ini b/plugin-defaults.ini
index 93cf09e8..d917b452 100644
--- a/plugin-defaults.ini
+++ b/plugin-defaults.ini
@@ -305,6 +305,7 @@ 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 output format.
#include_images:false
## If set, the first image found will be made the cover image. If