mirror of https://gitlab.com/bashrc2/epicyon
Record the time when rss posts arrived
parent
b79ce4321f
commit
105daa49e8
|
@ -8,6 +8,7 @@ __status__ = "Production"
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
import datetime
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from newswire import getDictFromNewswire
|
from newswire import getDictFromNewswire
|
||||||
from posts import createNewsPost
|
from posts import createNewsPost
|
||||||
|
@ -53,6 +54,7 @@ def convertRSStoActivityPub(baseDir: str, httpPrefix: str,
|
||||||
if not os.path.isdir(basePath):
|
if not os.path.isdir(basePath):
|
||||||
os.mkdir(basePath)
|
os.mkdir(basePath)
|
||||||
|
|
||||||
|
# oldest items first
|
||||||
newswireReverse = \
|
newswireReverse = \
|
||||||
OrderedDict(sorted(newswire.items(), reverse=False))
|
OrderedDict(sorted(newswire.items(), reverse=False))
|
||||||
|
|
||||||
|
@ -62,6 +64,8 @@ def convertRSStoActivityPub(baseDir: str, httpPrefix: str,
|
||||||
dateStr = dateStr.replace(' ', 'T')
|
dateStr = dateStr.replace(' ', 'T')
|
||||||
dateStr = dateStr.replace('+00:00', 'Z')
|
dateStr = dateStr.replace('+00:00', 'Z')
|
||||||
|
|
||||||
|
# pubDate = datetime.strptime(dateStr, "%Y-%m-%dT%H:%M:%SZ")
|
||||||
|
|
||||||
statusNumber, published = getStatusNumber(dateStr)
|
statusNumber, published = getStatusNumber(dateStr)
|
||||||
newPostId = \
|
newPostId = \
|
||||||
httpPrefix + '://' + domain + \
|
httpPrefix + '://' + domain + \
|
||||||
|
@ -107,6 +111,11 @@ def convertRSStoActivityPub(baseDir: str, httpPrefix: str,
|
||||||
httpPrefix + '://' + domain + '/users/news' + \
|
httpPrefix + '://' + domain + '/users/news' + \
|
||||||
'/statuses/' + statusNumber + '/replies'
|
'/statuses/' + statusNumber + '/replies'
|
||||||
blog['news'] = True
|
blog['news'] = True
|
||||||
|
|
||||||
|
# note the time of arrival
|
||||||
|
currTime = datetime.datetime.utcnow()
|
||||||
|
blog['object']['arrived'] = currTime.strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||||
|
|
||||||
blog['object']['replies']['id'] = idStr
|
blog['object']['replies']['id'] = idStr
|
||||||
blog['object']['replies']['first']['partOf'] = idStr
|
blog['object']['replies']['first']['partOf'] = idStr
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue