From a42a349e3c729d3dd512f1ec419f6d7d795d3442 Mon Sep 17 00:00:00 2001 From: Hazel Shanks Date: Mon, 7 Sep 2020 12:25:10 +1200 Subject: [PATCH] changed time formats for livetime metadata, chunk timestamps to avoid localized names -- fixes #538 --- calibre-plugin/plugin-defaults.ini | 3 ++- fanficfare/adapters/adapter_fictionlive.py | 8 +++----- fanficfare/defaults.ini | 3 ++- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/calibre-plugin/plugin-defaults.ini b/calibre-plugin/plugin-defaults.ini index ccb792a3..353aaed5 100644 --- a/calibre-plugin/plugin-defaults.ini +++ b/calibre-plugin/plugin-defaults.ini @@ -1682,7 +1682,7 @@ legend_spoilers:true show_spoiler_tags:false ## don't fetch covers marked as nsfw. covers for fiction.live can't be pornographic, but can get very close. show_nsfw_cover_images:false -## displays the timestamps on the story chunks, showing when each part went live. +## displays the timestamps on the story chunks, showing when each part went live. show_timestamps:false ## site has more original than fan fiction @@ -1693,6 +1693,7 @@ extra_titlepage_entries:key_tags, tags, likes, live, reader_input key_tags_label:Key Tags tags_label:Tags live_label:Next Live Session +live_format:%%Y-%%m-%%d at %%H:%%M %%p likes_label:Likes reader_input_label:Reader Input keep_in_order_tags:true diff --git a/fanficfare/adapters/adapter_fictionlive.py b/fanficfare/adapters/adapter_fictionlive.py index dbfb27b5..5202801c 100644 --- a/fanficfare/adapters/adapter_fictionlive.py +++ b/fanficfare/adapters/adapter_fictionlive.py @@ -38,7 +38,7 @@ from .base_adapter import BaseSiteAdapter from ..htmlcleanup import stripHTML from .. import exceptions as exceptions -from ..six import text_type as unicode +from ..six import text_type as unicode, ensure_text def getClass(): return FictionLiveAdapter @@ -148,7 +148,7 @@ class FictionLiveAdapter(BaseSiteAdapter): self.story.setMetadata('live', "Now! (at time of download)") elif 'nextLive' in data and data['nextLive']: # formatted to match site, not other fanficfare timestamps - next_live_time = self.parse_timestamp(data['nextLive']).strftime("%b %d, %Y at %H:%M %p") + next_live_time = self.parse_timestamp(data['nextLive']) self.story.setMetadata('live', next_live_time) show_nsfw_cover_images = self.getConfig('show_nsfw_cover_images') @@ -247,7 +247,7 @@ class FictionLiveAdapter(BaseSiteAdapter): show_timestamps = self.getConfig('show_timestamps') if show_timestamps and 'ct' in chunk: #logger.debug("Adding timestamp for chunk...") - timestamp = self.parse_timestamp(chunk['ct']).strftime("%b %d, %Y %H:%M %p") + timestamp = six.ensure_text(self.parse_timestamp(chunk['ct']).strftime("%x -- %X")) text += '
' + timestamp + '
' text += "
\n" @@ -437,8 +437,6 @@ class FictionLiveAdapter(BaseSiteAdapter): # in future, I'd like to handle audio embeds somehow. but they're not availble to add to stories right now. # pretty sure they'll just format as a link (with a special tydai-audio class) and should be easier than achievements -# TODO: ETAs on livetimes? to match site formatting and help debugging timezone handling - # TODO: # set fanficfare plugin to use "overwrite if newer" ? or 'update epub always' ? # a lot of times, chunks will be added even when chapters/bookmarks don't change diff --git a/fanficfare/defaults.ini b/fanficfare/defaults.ini index 600bc19f..281b35ca 100644 --- a/fanficfare/defaults.ini +++ b/fanficfare/defaults.ini @@ -1713,7 +1713,7 @@ legend_spoilers:true show_spoiler_tags:false ## don't fetch covers marked as nsfw. covers for fiction.live can't be pornographic, but can get very close. show_nsfw_cover_images:false -## displays the timestamps on the story chunks, showing when each part went live. +## displays the timestamps on the story chunks, showing when each part went live. show_timestamps:false ## site has more original than fan fiction @@ -1724,6 +1724,7 @@ extra_titlepage_entries:key_tags, tags, likes, live, reader_input key_tags_label:Key Tags tags_label:Tags live_label:Next Live Session +live_format:%%Y-%%m-%%d at %%H:%%M %%p likes_label:Likes reader_input_label:Reader Input keep_in_order_tags:true