mirror of https://gitlab.com/bashrc2/epicyon
Bigger recency window for hashtag swarm
parent
30ebfda697
commit
31fee182f9
|
@ -76,6 +76,7 @@ def htmlHashTagSwarm(baseDir: str, actor: str, translate: {}) -> str:
|
||||||
currTime = datetime.utcnow()
|
currTime = datetime.utcnow()
|
||||||
daysSinceEpoch = (currTime - datetime(1970, 1, 1)).days
|
daysSinceEpoch = (currTime - datetime(1970, 1, 1)).days
|
||||||
daysSinceEpochStr = str(daysSinceEpoch) + ' '
|
daysSinceEpochStr = str(daysSinceEpoch) + ' '
|
||||||
|
recently = daysSinceEpoch - 1
|
||||||
tagSwarm = []
|
tagSwarm = []
|
||||||
domainHistogram = {}
|
domainHistogram = {}
|
||||||
|
|
||||||
|
@ -84,12 +85,15 @@ def htmlHashTagSwarm(baseDir: str, actor: str, translate: {}) -> str:
|
||||||
tagsFilename = os.path.join(baseDir + '/tags', f)
|
tagsFilename = os.path.join(baseDir + '/tags', f)
|
||||||
if not os.path.isfile(tagsFilename):
|
if not os.path.isfile(tagsFilename):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# get last modified datetime
|
# get last modified datetime
|
||||||
modTimesinceEpoc = os.path.getmtime(tagsFilename)
|
modTimesinceEpoc = os.path.getmtime(tagsFilename)
|
||||||
lastModifiedDate = datetime.fromtimestamp(modTimesinceEpoc)
|
lastModifiedDate = datetime.fromtimestamp(modTimesinceEpoc)
|
||||||
fileDaysSinceEpoch = (lastModifiedDate - datetime(1970, 1, 1)).days
|
fileDaysSinceEpoch = (lastModifiedDate - datetime(1970, 1, 1)).days
|
||||||
# check if the file was last modified today
|
|
||||||
if fileDaysSinceEpoch != daysSinceEpoch:
|
# check if the file was last modified within the previous
|
||||||
|
# two days
|
||||||
|
if fileDaysSinceEpoch >= recently:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
hashTagName = f.split('.')[0]
|
hashTagName = f.split('.')[0]
|
||||||
|
@ -111,7 +115,7 @@ def htmlHashTagSwarm(baseDir: str, actor: str, translate: {}) -> str:
|
||||||
if not postDaysSinceEpochStr.isdigit():
|
if not postDaysSinceEpochStr.isdigit():
|
||||||
break
|
break
|
||||||
postDaysSinceEpoch = int(postDaysSinceEpochStr)
|
postDaysSinceEpoch = int(postDaysSinceEpochStr)
|
||||||
if postDaysSinceEpoch < daysSinceEpoch - 1:
|
if postDaysSinceEpoch < recently:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
postUrl = sections[2]
|
postUrl = sections[2]
|
||||||
|
|
Loading…
Reference in New Issue