Updating converter to pick up files copied in by nextcloud
This commit is contained in:
@@ -153,6 +153,7 @@ class Handler(watchdog.events.PatternMatchingEventHandler):
|
|||||||
logging.info("file copy has now finished")
|
logging.info("file copy has now finished")
|
||||||
|
|
||||||
with open(event.src_path, 'r') as file:
|
with open(event.src_path, 'r') as file:
|
||||||
|
try:
|
||||||
qfx = OfxParser.parse(file, fail_fast=False)
|
qfx = OfxParser.parse(file, fail_fast=False)
|
||||||
statement, acct_name = Handler.get_statement_from_qfx(qfx)
|
statement, acct_name = Handler.get_statement_from_qfx(qfx)
|
||||||
|
|
||||||
@@ -176,11 +177,15 @@ class Handler(watchdog.events.PatternMatchingEventHandler):
|
|||||||
|
|
||||||
if not destination.exists():
|
if not destination.exists():
|
||||||
path.replace(destination)
|
path.replace(destination)
|
||||||
|
except:
|
||||||
|
logging.info("Failed to process {}".format(event.src_path))
|
||||||
|
|
||||||
logging.info("Processing successfully finished for {}".format(event.src_path))
|
logging.info("Processing successfully finished for {}".format(event.src_path))
|
||||||
|
|
||||||
def on_created(self, event):
|
def on_modified(self, event):
|
||||||
logging.info('{} on {}'.format(event.event_type, event.src_path))
|
logging.info('Found modified file: {}'.format(event.src_path))
|
||||||
|
self.on_created(event)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user