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