forked from indymedia/epicyon
Check if hashtag index was modified today
parent
420d299ec3
commit
05540280d8
|
@ -5739,12 +5739,17 @@ def htmlHashTagSwarm(baseDir: str, actor: str) -> 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
|
||||||
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 of the file is too old
|
||||||
if fileDaysSinceEpoch < maxDaysSinceEpoch:
|
if fileDaysSinceEpoch < maxDaysSinceEpoch:
|
||||||
removeHashtags.append(tagsFilename)
|
removeHashtags.append(tagsFilename)
|
||||||
continue
|
continue
|
||||||
|
# check if the file was last modified today
|
||||||
|
if fileDaysSinceEpoch != daysSinceEpoch:
|
||||||
|
continue
|
||||||
|
|
||||||
hashTagName = f.split('.')[0]
|
hashTagName = f.split('.')[0]
|
||||||
if isBlockedHashtag(baseDir, hashTagName):
|
if isBlockedHashtag(baseDir, hashTagName):
|
||||||
|
|
Loading…
Reference in New Issue