mirror of
https://gitea.phreedom.club/localhost_frssoft/FMN_bot.git
synced 2024-11-21 16:41:26 +00:00
some fix, well fucked up gregorian calendar...
This commit is contained in:
parent
e696eaa375
commit
9b1fc812d4
|
@ -1,20 +1,20 @@
|
||||||
from src import listener_context, listener_mention, imdb_datasets_worker
|
from src import listener_context, listener_mention
|
||||||
from config import logger_default_level
|
from config import logger_default_level
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
import time
|
import time
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
logger.remove()
|
logger.remove()
|
||||||
logger.add(sink=sys.stderr, level=logger_default_level)
|
logger.add(sink=sys.stderr, level=logger_default_level)
|
||||||
logger.add(sink='suggestions.log', level='INFO', filter='src.listener_context')
|
logger.add(sink='suggestions.log', level='INFO', filter='src.listener_context')
|
||||||
|
|
||||||
listener_mention.run_scan_notif() # Слушаем упоминания в фоне
|
listener_mention.run_scan_notif() # Слушаем упоминания в фоне
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
listener_context.scan_context_thread() # Слушаем тред на новые предложения фильмов
|
listener_context.scan_context_thread() # Слушаем тред на новые предложения фильмов
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -8,8 +8,16 @@ def check_stop_thread_scan(suggested_date):
|
||||||
suggested_year = suggested_date.year
|
suggested_year = suggested_date.year
|
||||||
tuesdays = []
|
tuesdays = []
|
||||||
for i in calendar.Calendar().itermonthdays4(suggested_year, suggested_month):
|
for i in calendar.Calendar().itermonthdays4(suggested_year, suggested_month):
|
||||||
print(i)
|
|
||||||
if i[3] == 1 and datetime.datetime(year=i[0], month=i[1], day=i[2]) > suggested_date:
|
if i[3] == 1 and datetime.datetime(year=i[0], month=i[1], day=i[2]) > suggested_date:
|
||||||
tuesdays.append(datetime.datetime(
|
tuesdays.append(datetime.datetime(
|
||||||
year=i[0], month=i[1], day=i[2], hour=hour_poll_posting))
|
year=i[0], month=i[1], day=i[2], hour=hour_poll_posting))
|
||||||
|
if tuesdays == []:
|
||||||
|
shift_for_next_week = suggested_date + datetime.timedelta(days=1)
|
||||||
|
suggested_month = shift_for_next_week.month
|
||||||
|
suggested_year = shift_for_next_week.year
|
||||||
|
for i in calendar.Calendar().itermonthdays4(suggested_year, suggested_month):
|
||||||
|
if i[3] == 1 and datetime.datetime(year=i[0], month=i[1], day=i[2]) > suggested_date:
|
||||||
|
tuesdays.append(datetime.datetime(
|
||||||
|
year=i[0], month=i[1], day=i[2], hour=hour_poll_posting))
|
||||||
|
|
||||||
return tuesdays[0] # near tuesday
|
return tuesdays[0] # near tuesday
|
||||||
|
|
Loading…
Reference in a new issue