mirror of
https://github.com/JimmXinu/FanFicFare.git
synced 2025-12-06 00:43:00 +01:00
Add standard metadata entry marked_new_chapters for epub updated '(new)' chapters count
This commit is contained in:
parent
0e1ace18e4
commit
f207e31b3b
4 changed files with 20 additions and 0 deletions
|
|
@ -513,6 +513,13 @@ mark_new_chapters:false
|
||||||
## (new) marks in TOC when mark_new_chapters:true
|
## (new) marks in TOC when mark_new_chapters:true
|
||||||
#anthology_merge_keepsingletocs:false
|
#anthology_merge_keepsingletocs:false
|
||||||
|
|
||||||
|
## The count of how many chapters are marked '(new)' will be in
|
||||||
|
## metadata entry marked_new_chapters
|
||||||
|
marked_new_chapters_label:Chapters Marked New
|
||||||
|
|
||||||
|
# Add comma separators for numeric reads. Eg 10000 becomes 10,000
|
||||||
|
add_to_comma_entries:,marked_new_chapters
|
||||||
|
|
||||||
## chapter title patterns use python template substitution. The
|
## chapter title patterns use python template substitution. The
|
||||||
## ${number} is the 'chapter' number and ${title} is the chapter
|
## ${number} is the 'chapter' number and ${title} is the chapter
|
||||||
## title, after applying chapter_title_strip_pattern. ${index04} is
|
## title, after applying chapter_title_strip_pattern. ${index04} is
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,7 @@ titleLabels = {
|
||||||
'numChapters':'Chapters',
|
'numChapters':'Chapters',
|
||||||
'numWords':'Words',
|
'numWords':'Words',
|
||||||
'words_added':'Words Added', # logpage only
|
'words_added':'Words Added', # logpage only
|
||||||
|
'marked_new_chapters':'Chapters Marked New',
|
||||||
'site':'Site',
|
'site':'Site',
|
||||||
'publisher':'Publisher',
|
'publisher':'Publisher',
|
||||||
'storyId':'Story ID',
|
'storyId':'Story ID',
|
||||||
|
|
@ -347,6 +348,7 @@ def get_valid_scalar_entries():
|
||||||
'numChapters',
|
'numChapters',
|
||||||
'numWords',
|
'numWords',
|
||||||
'words_added', # logpage only.
|
'words_added', # logpage only.
|
||||||
|
'marked_new_chapters',
|
||||||
'site',
|
'site',
|
||||||
'publisher',
|
'publisher',
|
||||||
'storyId',
|
'storyId',
|
||||||
|
|
|
||||||
|
|
@ -483,6 +483,13 @@ chapter_title_strip_pattern:^[0-9]+[\.: -]+(?=[^0-9]|$)
|
||||||
## mark_new_chapters can be true, false or latestonly
|
## mark_new_chapters can be true, false or latestonly
|
||||||
mark_new_chapters:false
|
mark_new_chapters:false
|
||||||
|
|
||||||
|
## The count of how many chapters are marked '(new)' will be in
|
||||||
|
## metadata entry marked_new_chapters
|
||||||
|
marked_new_chapters_label:Chapters Marked New
|
||||||
|
|
||||||
|
# Add comma separators for numeric reads. Eg 10000 becomes 10,000
|
||||||
|
add_to_comma_entries:,marked_new_chapters
|
||||||
|
|
||||||
## chapter title patterns use python template substitution. The
|
## chapter title patterns use python template substitution. The
|
||||||
## ${number} is the 'chapter' number and ${title} is the chapter
|
## ${number} is the 'chapter' number and ${title} is the chapter
|
||||||
## title, after applying chapter_title_strip_pattern. ${index04} is
|
## title, after applying chapter_title_strip_pattern. ${index04} is
|
||||||
|
|
|
||||||
|
|
@ -1483,9 +1483,11 @@ class Story(Requestable):
|
||||||
newtempl = string.Template(newpattern)
|
newtempl = string.Template(newpattern)
|
||||||
toctempl = string.Template(tocpattern)
|
toctempl = string.Template(tocpattern)
|
||||||
|
|
||||||
|
marked_new_chapters = 0
|
||||||
for index, chap in enumerate(self.chapters):
|
for index, chap in enumerate(self.chapters):
|
||||||
if chap['new'] or self.getMetadata('newforanthology'):
|
if chap['new'] or self.getMetadata('newforanthology'):
|
||||||
usetempl = newtempl
|
usetempl = newtempl
|
||||||
|
marked_new_chapters += 1
|
||||||
else:
|
else:
|
||||||
usetempl = templ
|
usetempl = templ
|
||||||
# logger.debug("chap(%s)"%chap)
|
# logger.debug("chap(%s)"%chap)
|
||||||
|
|
@ -1505,6 +1507,8 @@ class Story(Requestable):
|
||||||
## chapter['html'] is a string.
|
## chapter['html'] is a string.
|
||||||
chapter['html'] = self.do_chapter_text_replacements(chapter['html'])
|
chapter['html'] = self.do_chapter_text_replacements(chapter['html'])
|
||||||
retval.append(chapter)
|
retval.append(chapter)
|
||||||
|
if marked_new_chapters:
|
||||||
|
self.setMetadata('marked_new_chapters',marked_new_chapters)
|
||||||
return retval
|
return retval
|
||||||
|
|
||||||
def do_chapter_text_replacements(self,data):
|
def do_chapter_text_replacements(self,data):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue