diff --git a/fanficfare/adapters/adapter_fictionlive.py b/fanficfare/adapters/adapter_fictionlive.py index 2afb428b7..c782234e6 100644 --- a/fanficfare/adapters/adapter_fictionlive.py +++ b/fanficfare/adapters/adapter_fictionlive.py @@ -71,7 +71,7 @@ def getSiteExampleURLs(cls): "https://fiction.live/stories/Example-Story-With-UUID/00000000-0000-4000-0000-000000000000/"] def parse_timestamp(self, timestamp): - # fiction.live date format is unix-epoch milliseconds. not a good fit for fanficfare's dateformat. + # fiction.live date format is unix-epoch milliseconds. not a good fit for fanficfare's makeDate. # doesn't use a timezone object and returns tz-naive datetimes. I *think* I can leave the rest to fanficfare return datetime.fromtimestamp(timestamp / 1000.0, None) @@ -232,7 +232,9 @@ def getChapterText(self, url): text = "" - for chunk in data: + for count, chunk in enumerate(data): + #logger.debug("chunk #{i}".format(i=count)) # helps to locate problem chunks in long chapters + text += "
" # chapter chunks aren't always well-delimited in their contents # so appendix chunks just turn up wherever @@ -414,14 +416,18 @@ def format_readerposts(self, chunk): if dice != {}: for uid, roll in dice.items(): output += '
' - output += '
' + roll + '
\n' - if uid in posts: - output += posts[uid] + if roll: # optional. just because there's a list entry for it doesn't mean it has a value! + output += '
' + roll + '
\n' + if uid in posts: + post = posts[uid] + if post: + output += post del posts[uid] # it's handled here with the roll instead of later output += '
' for post in posts.values(): - output += '
' + post + '
\n' + if post: + output += '
' + post + '
\n' return output @@ -440,3 +446,11 @@ def format_unknown(self, chunk): # TODO: verify that show_timestamps is working, check times! +# TODO: find a story that uses achievement images and implement them + +# TODO: sort out updates, somehow. 'update epub if new chapters' is an awful match for fiction.live +# where chunks get just dropped at the end of chapters, and chapter-bookmarking happens later. +# updating in 'overwrite always' or 'overwrite if newer' does the right thing, but. + +# TODO: pagecache. In particular, if there's any way to update stories and *not* redownload images, that'd be great. +