File exists/output name validation.

This commit is contained in:
Matthew Stratford 2021-04-07 20:14:39 +01:00
parent 77180fa38e
commit a8d82b7000

View file

@ -300,7 +300,7 @@ class Player():
self.logger.log.error("Failed to find weight: {}".format(weight)) self.logger.log.error("Failed to find weight: {}".format(weight))
return False 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) loaded_item.filename = self.api.get_filename(item = loaded_item)
if not loaded_item.filename: if not loaded_item.filename:
@ -358,7 +358,8 @@ class Player():
def output(self, name: Optional[str] = None): def output(self, name: Optional[str] = None):
wasPlaying = self.state.state["playing"] 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.quit()
self.state.update("output", name) self.state.update("output", name)