Merging change in because Hg is making me.

This commit is contained in:
Jim Miller 2015-01-04 17:37:31 -06:00
commit 0284fa7e78
4 changed files with 20 additions and 9 deletions

View file

@ -1282,19 +1282,26 @@ class FanFictionDownLoaderPlugin(InterfaceAction):
if 'Count Pages' in self.gui.iactions and len(prefs['countpagesstats']) and len(all_ids):
cp_plugin = self.gui.iactions['Count Pages']
countpagesstats = list(prefs['countpagesstats']) # copy because we're changing it.
# print("all_ids:%s"%all_ids)
# print("countpagesstats:%s"%countpagesstats)
## If only some of the books need word counting, they'll
## have to be launched separately.
if prefs['wordcountmissing']:
if prefs['wordcountmissing'] and 'WordCount' in countpagesstats:
# print("numWords:%s"%[ y['all_metadata']['numWords'] for y in add_list + update_list ])
wc_ids = [ y['calibre_id'] for y in filter(
lambda x : '' == x['all_metadata'].get('numWords',''), add_list + update_list ) ]
## not all need word count
if wc_ids and len(all_ids) != len(wc_ids):
cp_plugin.count_statistics(wc_ids,['WordCount'])
# print("wc_ids:%s"%wc_ids)
## if lists don't match
if len(wc_ids)!=len(all_ids):
if wc_ids: # because often the lists don't match because 0
cp_plugin.count_statistics(wc_ids,['WordCount'])
## don't do WordCount below.
while 'WordCount' in countpagesstats: countpagesstats.remove('WordCount')
## check that there's stuff to do in case wordcount was it.
# print("countpagesstats:%s"%countpagesstats)
if countpagesstats:
cp_plugin.count_statistics(all_ids,countpagesstats)

View file

@ -1275,7 +1275,9 @@ extracategories:Stargate: Atlantis
## program can prompt you, or you can save it in config. In
## commandline version, this should go in your personal.ini, not
## defaults.ini.
#username:YourName
## storiesonline.net has started requiring login by email rather than
## pen name.
#username:youremail@yourdomain.dom
#password:yourpassword
## Clear FanFiction from defaults, site is original fiction.

View file

@ -500,9 +500,6 @@ class BaseSiteAdapter(Configurable):
if not fetch:
fetch=self._fetchUrlRaw
# re-soup because BS4/html5lib is more forgiving that way.
soup = self.make_soup(unicode(soup))
acceptable_attributes = ['href','name','class','id']
if self.getConfig("keep_style_attr"):
acceptable_attributes.append('style')
@ -572,7 +569,10 @@ class BaseSiteAdapter(Configurable):
Convenience method for getting a bs4 soup. Older and
non-updated adapters call the included bs3 library themselves.
'''
return bs4.BeautifulSoup(data,'html5lib')
## soup and re-soup because BS4/html5lib is more forgiving of
## incorrectly nested tags that way.
soup = bs4.BeautifulSoup(data,'html5lib')
return bs4.BeautifulSoup(unicode(soup),'html5lib')
def cachedfetch(realfetch,cache,url):
if url in cache:

View file

@ -1269,7 +1269,9 @@ extracategories:Stargate: Atlantis
## program can prompt you, or you can save it in config. In
## commandline version, this should go in your personal.ini, not
## defaults.ini.
#username:YourName
## storiesonline.net has started requiring login by email rather than
## pen name.
#username:youremail@yourdomain.dom
#password:yourpassword
## Clear FanFiction from defaults, site is original fiction.