mirror of https://gitlab.com/bashrc2/epicyon
Add exception for file read
parent
b93b8e43f0
commit
ace9f84d9a
19
schedule.py
19
schedule.py
|
@ -44,6 +44,9 @@ def _update_post_schedule(base_dir: str, handle: str, httpd,
|
||||||
index_lines = []
|
index_lines = []
|
||||||
delete_schedule_post = False
|
delete_schedule_post = False
|
||||||
nickname = handle.split('@')[0]
|
nickname = handle.split('@')[0]
|
||||||
|
shared_items_federated_domains = httpd.shared_items_federated_domains
|
||||||
|
shared_item_federation_tokens = httpd.shared_item_federation_tokens
|
||||||
|
try:
|
||||||
with open(schedule_index_filename, 'r', encoding='utf-8') as fp_sched:
|
with open(schedule_index_filename, 'r', encoding='utf-8') as fp_sched:
|
||||||
for line in fp_sched:
|
for line in fp_sched:
|
||||||
if ' ' not in line:
|
if ' ' not in line:
|
||||||
|
@ -60,7 +63,8 @@ def _update_post_schedule(base_dir: str, handle: str, httpd,
|
||||||
try:
|
try:
|
||||||
os.remove(post_filename)
|
os.remove(post_filename)
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: _update_post_schedule unable to delete ' +
|
print('EX: ' +
|
||||||
|
'_update_post_schedule unable to delete ' +
|
||||||
str(post_filename))
|
str(post_filename))
|
||||||
continue
|
continue
|
||||||
# create the new index file
|
# create the new index file
|
||||||
|
@ -79,7 +83,8 @@ def _update_post_schedule(base_dir: str, handle: str, httpd,
|
||||||
if curr_time.time().minute < post_time.time().minute:
|
if curr_time.time().minute < post_time.time().minute:
|
||||||
continue
|
continue
|
||||||
if not os.path.isfile(post_filename):
|
if not os.path.isfile(post_filename):
|
||||||
print('WARN: schedule missing post_filename=' + post_filename)
|
print('WARN: schedule missing post_filename=' +
|
||||||
|
post_filename)
|
||||||
index_lines.remove(line)
|
index_lines.remove(line)
|
||||||
continue
|
continue
|
||||||
# load post
|
# load post
|
||||||
|
@ -138,9 +143,10 @@ def _update_post_schedule(base_dir: str, handle: str, httpd,
|
||||||
httpd.twitter_replacement_domain,
|
httpd.twitter_replacement_domain,
|
||||||
httpd.show_published_date_only,
|
httpd.show_published_date_only,
|
||||||
httpd.allow_local_network_access,
|
httpd.allow_local_network_access,
|
||||||
httpd.city, httpd.system_language,
|
httpd.city,
|
||||||
httpd.shared_items_federated_domains,
|
httpd.system_language,
|
||||||
httpd.shared_item_federation_tokens,
|
shared_items_federated_domains,
|
||||||
|
shared_item_federation_tokens,
|
||||||
httpd.low_bandwidth,
|
httpd.low_bandwidth,
|
||||||
httpd.signing_priv_key_pem,
|
httpd.signing_priv_key_pem,
|
||||||
httpd.peertube_instances,
|
httpd.peertube_instances,
|
||||||
|
@ -177,6 +183,9 @@ def _update_post_schedule(base_dir: str, handle: str, httpd,
|
||||||
index_lines.remove(line)
|
index_lines.remove(line)
|
||||||
if len(index_lines) > max_scheduled_posts:
|
if len(index_lines) > max_scheduled_posts:
|
||||||
delete_schedule_post = True
|
delete_schedule_post = True
|
||||||
|
except OSError as exc:
|
||||||
|
print('EX: _update_post_schedule unable to read ' +
|
||||||
|
schedule_index_filename + ' ' + str(exc))
|
||||||
|
|
||||||
# write the new schedule index file
|
# write the new schedule index file
|
||||||
schedule_index_file = \
|
schedule_index_file = \
|
||||||
|
|
Loading…
Reference in New Issue