mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
886401990c
commit
0c91ffab00
6
inbox.py
6
inbox.py
|
@ -34,7 +34,7 @@ from utils import remove_domain_port
|
|||
from utils import get_port_from_domain
|
||||
from utils import has_object_dict
|
||||
from utils import dm_allowed_from_domain
|
||||
from utils import isRecentPost
|
||||
from utils import is_recent_post
|
||||
from utils import get_config_param
|
||||
from utils import has_users_path
|
||||
from utils import valid_post_date
|
||||
|
@ -1990,7 +1990,7 @@ def _receiveAnnounce(recent_posts_cache: {},
|
|||
if '/statuses/' in lookupActor:
|
||||
lookupActor = lookupActor.split('/statuses/')[0]
|
||||
|
||||
if isRecentPost(post_json_object, 3):
|
||||
if is_recent_post(post_json_object, 3):
|
||||
if not os.path.isfile(postFilename + '.tts'):
|
||||
domain_full = get_full_domain(domain, port)
|
||||
updateSpeaker(base_dir, http_prefix,
|
||||
|
@ -3551,7 +3551,7 @@ def _inboxAfterInitial(recent_posts_cache: {}, max_recent_posts: int,
|
|||
print('ERROR: unable to update ' + boxname + ' index')
|
||||
else:
|
||||
if boxname == 'inbox':
|
||||
if isRecentPost(post_json_object, 3):
|
||||
if is_recent_post(post_json_object, 3):
|
||||
domain_full = get_full_domain(domain, port)
|
||||
updateSpeaker(base_dir, http_prefix,
|
||||
nickname, domain, domain_full,
|
||||
|
|
18
utils.py
18
utils.py
|
@ -2511,7 +2511,7 @@ def mediaFileMimeType(filename: str) -> str:
|
|||
return extensions[fileExt]
|
||||
|
||||
|
||||
def isRecentPost(post_json_object: {}, maxDays: int) -> bool:
|
||||
def is_recent_post(post_json_object: {}, maxDays: int) -> bool:
|
||||
""" Is the given post recent?
|
||||
"""
|
||||
if not has_object_dict(post_json_object):
|
||||
|
@ -2530,7 +2530,7 @@ def isRecentPost(post_json_object: {}, maxDays: int) -> bool:
|
|||
datetime.datetime.strptime(publishedDateStr,
|
||||
"%Y-%m-%dT%H:%M:%SZ")
|
||||
except BaseException:
|
||||
print('EX: isRecentPost unrecognized published date ' +
|
||||
print('EX: is_recent_post unrecognized published date ' +
|
||||
str(publishedDateStr))
|
||||
return False
|
||||
|
||||
|
@ -2559,21 +2559,21 @@ def reject_post_id(base_dir: str, nickname: str, domain: str,
|
|||
""" Marks the given post as rejected,
|
||||
for example an announce which is too old
|
||||
"""
|
||||
postFilename = locate_post(base_dir, nickname, domain, post_id)
|
||||
if not postFilename:
|
||||
post_filename = locate_post(base_dir, nickname, domain, post_id)
|
||||
if not post_filename:
|
||||
return
|
||||
|
||||
if recent_posts_cache.get('index'):
|
||||
# if this is a full path then remove the directories
|
||||
indexFilename = postFilename
|
||||
if '/' in postFilename:
|
||||
indexFilename = postFilename.split('/')[-1]
|
||||
index_filename = post_filename
|
||||
if '/' in post_filename:
|
||||
index_filename = post_filename.split('/')[-1]
|
||||
|
||||
# filename of the post without any extension or path
|
||||
# This should also correspond to any index entry in
|
||||
# the posts cache
|
||||
postUrl = \
|
||||
indexFilename.replace('\n', '').replace('\r', '')
|
||||
index_filename.replace('\n', '').replace('\r', '')
|
||||
postUrl = postUrl.replace('.json', '').strip()
|
||||
|
||||
if postUrl in recent_posts_cache['index']:
|
||||
|
@ -2582,7 +2582,7 @@ def reject_post_id(base_dir: str, nickname: str, domain: str,
|
|||
if recent_posts_cache['html'].get(postUrl):
|
||||
del recent_posts_cache['html'][postUrl]
|
||||
|
||||
with open(postFilename + '.reject', 'w+') as rejectFile:
|
||||
with open(post_filename + '.reject', 'w+') as rejectFile:
|
||||
rejectFile.write('\n')
|
||||
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ from utils import updateAnnounceCollection
|
|||
from utils import is_pgp_encrypted
|
||||
from utils import is_dm
|
||||
from utils import reject_post_id
|
||||
from utils import isRecentPost
|
||||
from utils import is_recent_post
|
||||
from utils import get_config_param
|
||||
from utils import get_full_domain
|
||||
from utils import is_editor
|
||||
|
@ -1544,7 +1544,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
|
|||
postActor, nickname, domain_full, False)
|
||||
|
||||
# create a file for use by text-to-speech
|
||||
if isRecentPost(post_json_object, 3):
|
||||
if is_recent_post(post_json_object, 3):
|
||||
if post_json_object.get('actor'):
|
||||
if not os.path.isfile(announceFilename + '.tts'):
|
||||
updateSpeaker(base_dir, http_prefix,
|
||||
|
|
Loading…
Reference in New Issue