Compare commits

..

2 commits

4 changed files with 29 additions and 2 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 13 B

1
src/FMN.webp Symbolic link
View file

@ -0,0 +1 @@
FMN_prev.webp

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 13 B

BIN
src/FMN_prev.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

View file

@ -80,7 +80,7 @@ def get_status(status_id):
logger.info(f'Retrying get status {status_id}')
def post_status(text, reply_to_status_id=None, poll_options=None, poll_expires=345600, attachments=None):
def post_status(text, reply_to_status_id=None, poll_options=None, poll_expires=345600, attachments=None, visibility='unlisted'):
poll = None
if poll_options is not None:
poll = {
@ -91,7 +91,7 @@ def post_status(text, reply_to_status_id=None, poll_options=None, poll_expires=3
params = {
"status": text,
"in_reply_to_id": reply_to_status_id,
"visibility": "unlisted",
"visibility": visibility,
"content_type": "text/plain",
"language": "ru",
"poll": poll

View file

@ -58,6 +58,33 @@ def get_control_mention():
time.sleep(0.2)
mark_as_read_notification(i['id'])
states_stor.states['max_mute_time'] = int(max_mute_time)
states_stor.states['stop_thread_scan'] = int(stop_thread_scan)
states_stor.states['last_thread_id'] = st_id
write_states(states_stor.states)
break
if now_hour == 0:
logger.warning(f'Автоматический триггер в полночи сработал')
st_date = time_now
thread_created_at = dateutilparse(st_date)
delta = relativedelta(hour=hour_poll_posting, minute=0, second=0, weekday=TU(1))
stop_thread_scan = thread_created_at + delta
movies_accept_time = stop_thread_scan.strftime('%H:%M %d.%m.%Y по Москве')
stop_thread_scan = time.mktime(time.struct_time(stop_thread_scan.timetuple()))
if now_week == 6: # Фикс стыков двух недель. Если вс, то расчитываем на следующую неделю
next_week = 2
else:
next_week = 1
next_movie_watching_delta = relativedelta(hour=fmn_next_watching_hour, minute=0, second=0, weekday=SU(next_week))
next_movie_watching = time_now + next_movie_watching_delta
max_mute_time = time.mktime(time.struct_time(next_movie_watching.timetuple())) # Глушение до следующего сеанса FMN.
next_movie_watching = next_movie_watching.strftime('%d.%m.%Y')
st_id = post_status(start_collect_movies_text(movies_accept_time, next_movie_watching) + '\n\n@rf@mastodon.ml', None, attachments=[upload_attachment('src/FMN.webp')], "public")['id']
time.sleep(0.2)
states_stor.states['max_mute_time'] = int(max_mute_time)
states_stor.states['stop_thread_scan'] = int(stop_thread_scan)
states_stor.states['last_thread_id'] = st_id