Don't set numChapters--it's done automatically.

This commit is contained in:
Jim Miller 2026-01-29 19:19:37 -06:00
parent c74dba472a
commit 719971c76c
13 changed files with 3 additions and 32 deletions

View file

@ -157,9 +157,6 @@ class BloodshedverseComAdapter(BaseSiteAdapter):
self.story.addToList('warnings', warning)
elif key == 'Chapters':
self.story.setMetadata('numChapters', int(value))
elif key == 'Words':
# Apparently only numChapters need to be an integer for
# some strange reason. Remove possible ',' characters as to

View file

@ -157,7 +157,6 @@ class FicBookNetAdapter(BaseSiteAdapter):
update = chapterdate
else:
self.add_chapter(self.story.getMetadata('title'),url)
self.story.setMetadata('numChapters',1)
date_str = soup.find('div', {'class' : 'part-date'}).find('span', {'title': True})['title'].replace(u"\u202fг. в", "")
for month_name, month_num in fullmon.items():
date_str = date_str.replace(month_name, month_num)

View file

@ -40,10 +40,6 @@ class FictionManiaTVAdapter(BaseSiteAdapter):
self._setURL(self.READ_TEXT_STORY_URL_TEMPLATE % story_id)
self.story.setMetadata('siteabbrev', self.SITE_ABBREVIATION)
# Always single chapters, probably should use the Anthology feature to
# merge chapters of a story
self.story.setMetadata('numChapters', 1)
@staticmethod
def getSiteDomain():
return FictionManiaTVAdapter.SITE_DOMAIN

View file

@ -105,7 +105,6 @@ class FireFlyFansNetSiteAdapter(BaseSiteAdapter):
# to download them one at a time yourself. I'm also setting the status to
# complete
self.add_chapter(self.story.getMetadata('title'), self.url)
self.story.setMetadata('numChapters', 1)
self.story.setMetadata('status', 'Completed')
## some stories do not have a summary listed, so I'm setting it here.

View file

@ -197,8 +197,6 @@ class KakuyomuJpAdapter(BaseSiteAdapter):
self.add_chapter(epTitle, epUrl)
newSection = False
self.story.setMetadata('numChapters', numEpisodes)
logger.debug("Story: <%s>", self.story)
return

View file

@ -204,7 +204,6 @@ class MassEffect2InAdapter(BaseSiteAdapter):
self.story.setMetadata('datePublished', datePublished)
self.story.setMetadata('dateUpdated', dateUpdated)
self.story.setMetadata('numWords', unicode(wordCount))
self.story.setMetadata('numChapters', len(chapters))
# Site-specific metadata.
self.story.setMetadata('language', self.SITE_LANGUAGE)

View file

@ -120,13 +120,9 @@ class SwiOrgRuAdapter(BaseSiteAdapter):
self.story.setMetadata('language','Russian')
chapters=chapters_table.find_all('a', href=re.compile(r'/mlp-fim/story/'+self.story.getMetadata('storyId')+r"/chapter\d+"))
self.story.setMetadata('numChapters', len(chapters))
logger.debug("numChapters: (%s)"%str(self.story.getMetadata('numChapters')))
for x in range(0,len(chapters)):
chapter=chapters[x]
churl='http://'+self.host+chapter['href']
self.add_chapter(chapter,churl)
for chapter in chapters:
churl='http://'+self.host+chapter['href']
self.add_chapter(chapter,churl)
# grab the text for an individual chapter.
def getChapterText(self, url):

View file

@ -255,7 +255,6 @@ class SyosetuComAdapter(BaseSiteAdapter):
numChapters = int(re.sub(r'[^\d]', '', infoSoup.find('span', {'class':'p-infotop-type__allep'}).text.strip()))
oneshot = False
completed = True if noveltype == '完結済' else False
self.story.setMetadata('numChapters', numChapters)
self.story.setMetadata('status', 'Completed' if completed else 'In-Progress')
# Keywords

View file

@ -101,7 +101,6 @@ class TouchFluffyTailAdapter(BaseSiteAdapter):
self.story.setMetadata('status', 'Completed')
self.add_chapter(self.story.getMetadata('title'),url)
self.story.setMetadata('numChapters',1)
avrrate = body.find_all('footer', class_='entry-meta')[1].find('em').span.find_all('strong')
averrating = avrrate[1].text

View file

@ -126,11 +126,6 @@ class TrekFanFictionNetSiteAdapter(BaseSiteAdapter):
## url since we can't get the chapter without this, I'm leaving it in.
self.add_chapter(self.story.getMetadata('title'), url)
## I'm going to comment this out, because thereis always only one chapter for each story,
## so this is really not needed
## And I am uncommenting it because the rest of FFF expects
## there to always be numChapters, even if it's one. --Jimm
# getting the rest of the metadata... there isn't much here, and the summary can only be
# gotten on the author's page... so we'll get it to get the information from
adata = self.get_request(self.story.getMetadata('authorUrl'))

View file

@ -199,9 +199,6 @@ class Voracity2EficComAdapter(BaseSiteAdapter):
self.story.setMetadata('series', a.string)
self.story.setMetadata('seriesUrl', urlparse.urljoin(self.BASE_URL, a['href']))
elif key == 'Chapter':
self.story.setMetadata('numChapters', int(value))
elif key == 'Completed':
self.story.setMetadata('status', 'Completed' if value == 'Yes' else 'In-Progress')

View file

@ -317,8 +317,6 @@ class BaseEfictionAdapter(BaseSiteAdapter):
for val in re.split(r"\s*,\s*", value):
# TODO this should be an official field I guess
self.story.addToList('challenge', val)
elif key == 'Chapters':
self.story.setMetadata('numChapters', int(value))
elif key == 'Rating' or key == 'Rated':
self.story.setMetadata('rating', value)
elif key == 'Word count':

View file

@ -320,7 +320,6 @@ class BaseOTWAdapter(BaseSiteAdapter):
# break epub update.
# Find the chapters:
chapters=soup.find_all('a', href=re.compile(r'/works/'+self.story.getMetadata('storyId')+r"/chapters/\d+$"))
self.story.setMetadata('numChapters',len(chapters))
logger.debug("numChapters: (%s)"%self.story.getMetadata('numChapters'))
if len(chapters)==1:
self.add_chapter(self.story.getMetadata('title'),'https://'+self.host+chapters[0]['href'])