From 8c5b06e47980721b98564488027d561f86fcf92a Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Sun, 3 May 2020 12:37:40 +0200 Subject: [PATCH] fix wordcount on one-chapter stories --- src/be/nikiroo/fanfix/supported/BasicSupport.java | 6 ++++-- .../nikiroo/fanfix/supported/BasicSupport_Deprecated.java | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/be/nikiroo/fanfix/supported/BasicSupport.java b/src/be/nikiroo/fanfix/supported/BasicSupport.java index 17cbec5a..f1635589 100644 --- a/src/be/nikiroo/fanfix/supported/BasicSupport.java +++ b/src/be/nikiroo/fanfix/supported/BasicSupport.java @@ -384,6 +384,7 @@ public abstract class BasicSupport { resume.setName(""); resume.setNumber(1); story.getChapters().add(resume); + story.getMeta().setWords(resume.getWords()); String descChapterName = Instance.getInstance().getTrans() .getString(StringId.DESCRIPTION); @@ -431,7 +432,7 @@ public abstract class BasicSupport { story.setChapters(new ArrayList()); List> chapters = getChapters(pgGetChapters); pgGetChapters.done(); // 20% - + if (chapters != null) { Progress pgChaps = new Progress("Extracting chapters", 0, chapters.size() * 300); @@ -462,10 +463,11 @@ public abstract class BasicSupport { words += cc.getWords(); story.getChapters().add(cc); - story.getMeta().setWords(words); i++; } + + story.getMeta().setWords(words); pgChaps.setName("Extracting chapters"); pgChaps.done(); diff --git a/src/be/nikiroo/fanfix/supported/BasicSupport_Deprecated.java b/src/be/nikiroo/fanfix/supported/BasicSupport_Deprecated.java index ad030c0c..a50ee3cf 100644 --- a/src/be/nikiroo/fanfix/supported/BasicSupport_Deprecated.java +++ b/src/be/nikiroo/fanfix/supported/BasicSupport_Deprecated.java @@ -317,7 +317,6 @@ public abstract class BasicSupport_Deprecated extends BasicSupport { words += cc.getWords(); story.getChapters().add(cc); - story.getMeta().setWords(words); } finally { if (chapIn != null) { chapIn.close(); @@ -326,6 +325,8 @@ public abstract class BasicSupport_Deprecated extends BasicSupport { i++; } + + story.getMeta().setWords(words); pgChaps.setName("Extracting chapters"); } else { @@ -340,6 +341,7 @@ public abstract class BasicSupport_Deprecated extends BasicSupport { resume.setName(""); resume.setNumber(1); story.getChapters().add(resume); + story.getMeta().setWords(resume.getWords()); String descChapterName = Instance.getInstance().getTrans() .getString(StringId.DESCRIPTION); -- 2.27.0