- if (chapters != null) {
- Progress pgChaps = new Progress("Extracting chapters", 0,
- chapters.size() * 300);
- pg.addProgress(pgChaps, 80);
-
- long words = 0;
- int i = 1;
- for (Entry<String, URL> chap : chapters) {
- pgChaps.setName("Extracting chapter " + i);
- URL chapUrl = chap.getValue();
- String chapName = chap.getKey();
- if (chapUrl != null) {
- setCurrentReferer(chapUrl);
- }
-
- pgChaps.setProgress(i * 100);
- Progress pgGetChapterContent = new Progress();
- Progress pgMakeChapter = new Progress();
- pgChaps.addProgress(pgGetChapterContent, 100);
- pgChaps.addProgress(pgMakeChapter, 100);
-
- String content = getChapterContent(chapUrl, i,
- pgGetChapterContent);
- if (!pgGetChapterContent.isDone()) {
- pgGetChapterContent.setProgress(pgGetChapterContent
- .getMax());
- }
-
- Chapter cc = BasicSupportPara.makeChapter(this, chapUrl, i,
- chapName, content, isHtml(), pgMakeChapter);
- if (!pgMakeChapter.isDone()) {
- pgMakeChapter.setProgress(pgMakeChapter.getMax());
- }
-
- words += cc.getWords();
- story.getChapters().add(cc);
- story.getMeta().setWords(words);
-
- i++;
+ Chapter cc = BasicSupportPara.makeChapter(this, chapUrl, i,
+ chapName, content, isHtml(), pgMakeChapter);
+ if (!pgMakeChapter.isDone()) {
+ pgMakeChapter.setProgress(pgMakeChapter.getMax());