Feed parser: Changed behaviour to use RR id for tracking chapters instead of using the extraced chapter number (which was dumb anyway)
Build & Publish to GHCR / build (push) Successful in 23s
Build & Publish to GHCR / build (push) Successful in 23s
This commit is contained in:
1 parent
18904abcec
commit
eda004626a
3 files changed
+17
-22
No files matched your search
+6
-6
@@ -42,7 +42,7 @@ async def prometheus_middleware(request: Request, call_next):
|
||||
response = await call_next(request)
|
||||
status = response.status_code
|
||||
logger.debug(f"[Metrics] Request processed with status {status}")
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
logger.error(f"[Metrics] Exception occurred: {e}", exc_info=True)
|
||||
raise
|
||||
finally:
|
||||
@@ -73,14 +73,14 @@ def get_chapters(request: Request, db = Depends(get_db)):
|
||||
logger.debug(f"[Royalroad] Found {len(stories)} active stories to check.")
|
||||
|
||||
for id, royalroadId, last_chapter_db in stories:
|
||||
chapter_number, chapter_link, story_title = grab_latest_chapter_information(royalroadId)
|
||||
logger.debug(f"[Royalroad] Story {id}: last={last_chapter_db}, latest={chapter_number}")
|
||||
chapter_title, chapter_link, story_title, chapter_id = grab_latest_chapter_information(royalroadId)
|
||||
logger.debug(f"[Royalroad] Story {id}: last={last_chapter_db}, latest={chapter_id}")
|
||||
|
||||
if chapter_number > last_chapter_db:
|
||||
if chapter_id > last_chapter_db:
|
||||
logger.info(f"[Royalroad] New chapter detected for story ID {id}: {story_title}")
|
||||
cursor.execute("UPDATE stories SET lastChapter = %s WHERE id = %s", (chapter_number, id))
|
||||
cursor.execute("UPDATE stories SET lastChapter = %s WHERE id = %s", (chapter_id, id))
|
||||
db.commit()
|
||||
send_notification(story_title, chapter_number, chapter_link)
|
||||
send_notification(story_title, chapter_title, chapter_link)
|
||||
logger.debug(f"[Royalroad] Notification sent for story ID {id}")
|
||||
|
||||
logger.info("[Royalroad] Chapter check completed successfully.")
|
||||
|
||||
Reference in new issue
Block a user