mirror of
https://github.com/JimmXinu/FanFicFare.git
synced 2025-12-31 21:24:54 +01:00
Document limitations of include_images better.
This commit is contained in:
parent
0877c82744
commit
60b7eae72e
5 changed files with 24 additions and 15 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
#
|
||||
# <meta name="cover" content="cover.jpg"/>
|
||||
metadata.appendChild(newTag(contentdom,"meta",{"content":"image0000",
|
||||
metadata.appendChild(newTag(contentdom,"meta",{"content":coverimgid,
|
||||
"name":"cover"}))
|
||||
# cover stuff for later:
|
||||
# at end of <package>:
|
||||
|
|
@ -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('<meta content="%s" name="cover"/>'%imgid,
|
||||
'<meta name="cover" content="%s"/>'%imgid)
|
||||
contentxml = contentxml.replace('<meta content="%s" name="cover"/>'%coverimgid,
|
||||
'<meta name="cover" content="%s"/>'%coverimgid)
|
||||
outputepub.writestr("content.opf",contentxml)
|
||||
|
||||
contentdom.unlink()
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue