mirror of
https://gitea.phreedom.club/localhost_frssoft/FMN_bot
synced 2024-11-21 18:29:20 +02:00
some fix, well fucked up gregorian calendar...
This commit is contained in:
parent
e696eaa375
commit
9b1fc812d4
|
@ -1,11 +1,10 @@
|
|||
from src import listener_context, listener_mention, imdb_datasets_worker
|
||||
from src import listener_context, listener_mention
|
||||
from config import logger_default_level
|
||||
from loguru import logger
|
||||
import time
|
||||
import sys
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
logger.remove()
|
||||
logger.add(sink=sys.stderr, level=logger_default_level)
|
||||
|
@ -16,5 +15,6 @@ def main():
|
|||
|
||||
listener_context.scan_context_thread() # Слушаем тред на новые предложения фильмов
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -8,8 +8,16 @@ def check_stop_thread_scan(suggested_date):
|
|||
suggested_year = suggested_date.year
|
||||
tuesdays = []
|
||||
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:
|
||||
tuesdays.append(datetime.datetime(
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue