From a8d82b700035600466e9c39f07dc6cb138b6ca8a Mon Sep 17 00:00:00 2001 From: Matthew Stratford Date: Wed, 7 Apr 2021 20:14:39 +0100 Subject: [PATCH] File exists/output name validation. --- player.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/player.py b/player.py index f2e7767..f32c1bd 100644 --- a/player.py +++ b/player.py @@ -300,7 +300,7 @@ class Player(): self.logger.log.error("Failed to find weight: {}".format(weight)) return False - if (loaded_item.filename == "" or loaded_item.filename == None): + if loaded_item.filename == "" or loaded_item.filename == None or not os.path.isfile(loaded_item.filename): loaded_item.filename = self.api.get_filename(item = loaded_item) if not loaded_item.filename: @@ -358,7 +358,8 @@ class Player(): def output(self, name: Optional[str] = None): wasPlaying = self.state.state["playing"] - name = None if name == "none" else name + + name = None if (not name or name.lower() == "none") else name self.quit() self.state.update("output", name)