Switch back to 'modified' fs event only

Originally i switched this to 'created' because of a Windows issue someone was
having, but I believe it was something else i'd done that fixed it.
Using 'created' also meant multiple password resets for a user wouldn't
be registered, as jellyfin would just overwrite the existing file.
Hopefully this doesn't break anything.
This commit is contained in:
Harvey Tindall 2020-05-09 20:49:42 +01:00
parent 81a80afdf2
commit 17aca69583

View File

@ -1,5 +1,6 @@
import time import time
import json import json
import platform
from watchdog.observers import Observer from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler from watchdog.events import FileSystemEventHandler
from jellyfin_accounts.email import Mailgun, Smtp from jellyfin_accounts.email import Mailgun, Smtp
@ -33,8 +34,7 @@ class Handler(FileSystemEventHandler):
def on_any_event(event): def on_any_event(event):
if event.is_directory: if event.is_directory:
return None return None
elif ((event.event_type == 'modified' or elif (event.event_type == 'modified' and
event.event_type == 'created') and
'passwordreset' in event.src_path): 'passwordreset' in event.src_path):
log.debug(f'Password reset file: {event.src_path}') log.debug(f'Password reset file: {event.src_path}')
time.sleep(1) time.sleep(1)