diff --git a/calibre-plugin/ffdl_plugin.py b/calibre-plugin/ffdl_plugin.py index aa4539a..d14bbef 100644 --- a/calibre-plugin/ffdl_plugin.py +++ b/calibre-plugin/ffdl_plugin.py @@ -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) diff --git a/defaults.ini b/defaults.ini index 25a9279..91c55c5 100644 --- a/defaults.ini +++ b/defaults.ini @@ -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. diff --git a/fanficdownloader/adapters/base_adapter.py b/fanficdownloader/adapters/base_adapter.py index 6eef92f..cd503b9 100644 --- a/fanficdownloader/adapters/base_adapter.py +++ b/fanficdownloader/adapters/base_adapter.py @@ -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: diff --git a/plugin-defaults.ini b/plugin-defaults.ini index c7ec829..320a7bb 100644 --- a/plugin-defaults.ini +++ b/plugin-defaults.ini @@ -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.