From 74af9729913dfeef57ee40fe0dcb65b6ae2bab32 Mon Sep 17 00:00:00 2001 From: kellerkind87 Date: Thu, 16 Apr 2026 23:37:49 +0200 Subject: [PATCH] added index to file name, if there are more than 1 pdf --- pytr/dl.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pytr/dl.py b/pytr/dl.py index dafc1ba..10a759e 100644 --- a/pytr/dl.py +++ b/pytr/dl.py @@ -283,7 +283,7 @@ def dl_callback(self, event): if subfolder is None: self.log.warning(f"no subfolder mapping for {eventdesc}") - for doc in section["data"]: + for idx, doc in enumerate(section["data"]): if isinstance(doc["action"]["payload"], dict): self.log.warning( f'Download of document with new API-Path URL "{doc["action"]["payload"]["path"]}" is not possible. (yet?)' @@ -299,7 +299,9 @@ def dl_callback(self, event): self.log.warning(f"no timestamp parseable from {timestamp_str}") docdate = datetime.now() - title = f"{doc['title']} - {event['title']} - {event['subtitle']}" + suffix = f" - {idx}" if idx > 0 else "" + title = f"{doc['title']} - {event['title']} - {event['subtitle']}{suffix}" + self.dl_doc(doc, title, subfolder, docdate) if has_docs: