diff --git a/cps/metadata_provider/lubimyczytac.py b/cps/metadata_provider/lubimyczytac.py index 4644cad9..1dde42e7 100644 --- a/cps/metadata_provider/lubimyczytac.py +++ b/cps/metadata_provider/lubimyczytac.py @@ -97,12 +97,14 @@ class LubimyCzytac(Metadata): LANGUAGES = f"{CONTAINER}//dt[contains(text(),'Język:')]{SIBLINGS}/text()" DESCRIPTION = f"{CONTAINER}//div[@class='collapse-content']" SERIES = f"{CONTAINER}//span/a[contains(@href,'/cykl/')]/text()" + TRANSLATOR = f"{CONTAINER}//dt[contains(text(),'Tłumacz:')]{SIBLINGS}/a/text()" DETAILS = "//div[@id='book-details']" PUBLISH_DATE = "//dt[contains(@title,'Data pierwszego wydania" FIRST_PUBLISH_DATE = f"{DETAILS}{PUBLISH_DATE} oryginalnego')]{SIBLINGS}[1]/text()" FIRST_PUBLISH_DATE_PL = f"{DETAILS}{PUBLISH_DATE} polskiego')]{SIBLINGS}[1]/text()" - TAGS = "//nav[@aria-label='breadcrumbs']//a[contains(@href,'/ksiazki/k/')]/span/text()" + TAGS = "//a[contains(@href,'/ksiazki/t/')]/text()" # "//nav[@aria-label='breadcrumbs']//a[contains(@href,'/ksiazki/k/')]/span/text()" + RATING = "//meta[@property='books:rating:value']/@content" COVER = "//meta[@property='og:image']/@content" @@ -158,6 +160,7 @@ class LubimyCzytac(Metadata): class LubimyCzytacParser: PAGES_TEMPLATE = "
Książka ma {0} stron(y).
" + TRANSLATOR_TEMPLATE = "Tłumacz: {0}
" PUBLISH_DATE_TEMPLATE = "Data pierwszego wydania: {0}
" PUBLISH_DATE_PL_TEMPLATE = ( "Data pierwszego wydania w Polsce: {0}
" @@ -346,5 +349,9 @@ class LubimyCzytacParser: description += LubimyCzytacParser.PUBLISH_DATE_PL_TEMPLATE.format( first_publish_date_pl.strftime("%d.%m.%Y") ) + translator = self._parse_xpath_node(xpath=LubimyCzytac.TRANSLATOR) + if translator: + description += LubimyCzytacParser.TRANSLATOR_TEMPLATE.format(translator) + return description diff --git a/cps/schedule.py b/cps/schedule.py index bf622b36..21c8d32a 100644 --- a/cps/schedule.py +++ b/cps/schedule.py @@ -69,9 +69,12 @@ def register_scheduled_tasks(reconnect=True): duration = config.schedule_duration # Register scheduled tasks - scheduler.schedule_tasks(tasks=get_scheduled_tasks(reconnect), trigger=CronTrigger(hour=start)) + timezone_info = datetime.datetime.now(datetime.timezone.utc).astimezone().tzinfo + scheduler.schedule_tasks(tasks=get_scheduled_tasks(reconnect), trigger=CronTrigger(hour=start, + timezone=timezone_info)) end_time = calclulate_end_time(start, duration) - scheduler.schedule(func=end_scheduled_tasks, trigger=CronTrigger(hour=end_time.hour, minute=end_time.minute), + scheduler.schedule(func=end_scheduled_tasks, trigger=CronTrigger(hour=end_time.hour, minute=end_time.minute, + timezone=timezone_info), name="end scheduled task") # Kick-off tasks, if they should currently be running