show youtube upload time as YYYY-MM-DD, not timespan

This commit is contained in:
jesopo 2019-10-30 10:25:18 +00:00
parent 3634b72622
commit 9f7ef8e6d2

View file

@ -47,9 +47,7 @@ class Module(ModuleManager.BaseModule):
video_uploaded_at = utils.iso8601_parse(snippet["publishedAt"], video_uploaded_at = utils.iso8601_parse(snippet["publishedAt"],
microseconds=True) microseconds=True)
video_uploaded_at = utils.to_pretty_time( video_uploaded_at = utils.date_human(video_uploaded_at)
(utils.datetime_utcnow()-video_uploaded_at).total_seconds(),
max_units=2)
video_uploader = snippet["channelTitle"] video_uploader = snippet["channelTitle"]
video_title = utils.irc.bold(snippet["title"]) video_title = utils.irc.bold(snippet["title"])
video_views = self._number(statistics["viewCount"]) video_views = self._number(statistics["viewCount"])
@ -73,7 +71,7 @@ class Module(ModuleManager.BaseModule):
video_duration += "%s" % match.group(3)[:-1].zfill(2 video_duration += "%s" % match.group(3)[:-1].zfill(2
) if match.group(3) else "00" ) if match.group(3) else "00"
url = URL_YOUTUBESHORT % video_id url = URL_YOUTUBESHORT % video_id
return "%s (%s) uploaded by %s (%s ago), %s views%s" % ( return "%s (%s) uploaded by %s on %s, %s views%s" % (
video_title, video_duration, video_uploader, video_uploaded_at, video_title, video_duration, video_uploader, video_uploaded_at,
video_views, video_opinions), url video_views, video_opinions), url
return None return None