From e6eda227fa733e73d7c57223581987bdb24d6b86 Mon Sep 17 00:00:00 2001 From: Harvey Tindall Date: Thu, 16 Apr 2020 13:56:27 +0100 Subject: [PATCH] add pw reset debug message; changed watchdog 'created' to 'modified' Added an extra debugging message to tell the file being read for a password reset, and changed watchdog form using 'created' events to 'modified', otherwise there may be issues where the file is read before it is fully written. --- jellyfin_accounts/pw_reset.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jellyfin_accounts/pw_reset.py b/jellyfin_accounts/pw_reset.py index e12fbbf..8cdbe3e 100755 --- a/jellyfin_accounts/pw_reset.py +++ b/jellyfin_accounts/pw_reset.py @@ -166,8 +166,9 @@ class Handler(FileSystemEventHandler): def on_any_event(event): if event.is_directory: return None - elif (event.event_type == 'created' and + elif (event.event_type == 'modified' and 'passwordreset' in event.src_path): + log.debug(f'Password reset file: {event.src_path}') with open(event.src_path, 'r') as f: reset = json.load(f) log.info(f'New password reset for {reset["UserName"]}')