From d55fc63a41f4f8c410d384781d54d3b6a8c38370 Mon Sep 17 00:00:00 2001 From: Cedric Leporcq Date: Sun, 5 Dec 2021 14:11:28 +0100 Subject: [PATCH] Fix system resume event in inquirer prompt --- ordigi/collection.py | 6 +++++- ordigi/media.py | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ordigi/collection.py b/ordigi/collection.py index 7318e3b..ef099c9 100644 --- a/ordigi/collection.py +++ b/ordigi/collection.py @@ -427,7 +427,11 @@ class Paths: default=self.paths_list, ), ] - return inquirer.prompt(questions, theme=self.theme)['selection'] + prompt = inquirer.prompt(questions, theme=self.theme) + if prompt: + return prompt['selection'] + + sys.exit() def get_paths_list(self, path): self.paths_list = list(self.get_files(path)) diff --git a/ordigi/media.py b/ordigi/media.py index 09d8ae1..cb8a77d 100644 --- a/ordigi/media.py +++ b/ordigi/media.py @@ -301,9 +301,11 @@ class Media(ReadExif): default=default, ), ] - # import ipdb; ipdb.set_trace() answers = inquirer.prompt(choices_list, theme=self.theme) + if not answers: + sys.exit() + if not answers['date_list']: prompt = [ inquirer.Text('date_custom', message="date"), @@ -414,6 +416,9 @@ class Media(ReadExif): ] answers = inquirer.prompt(choices_list, theme=self.theme) + if not answers: + sys.exit() + if not answers['album']: answers = inquirer.prompt(prompt, theme=self.theme) return answers['custom']