Don't try to update if there is no print time estimate

This commit is contained in:
Adam Goldsmith 2022-04-02 18:58:21 -04:00
parent 3c1afc7b73
commit d81a17ef61

View File

@ -18,7 +18,10 @@ def get_printer_job(calendar, printer):
print(f"Failed to get current job for {printer['name']}: {e}") print(f"Failed to get current job for {printer['name']}: {e}")
return return
if current_job["state"] == "Printing": if (
current_job["state"] == "Printing"
and current_job["progress"]["printTimeLeft"] is not None
):
now = datetime.utcnow() now = datetime.utcnow()
start = now - timedelta(seconds=current_job["progress"]["printTime"]) start = now - timedelta(seconds=current_job["progress"]["printTime"])
estimated_end = now + timedelta( estimated_end = now + timedelta(