Don't fail if one of the printers is unreachable/not responding
This commit is contained in:
parent
4f28ea21fe
commit
63e28a0c67
5
main.py
5
main.py
@ -9,8 +9,13 @@ from google_calendar import CalendarService
|
||||
|
||||
|
||||
def get_printer_job(calendar, printer):
|
||||
try:
|
||||
octoprint_client = OctoRest(url=printer["url"], apikey=printer["apikey"])
|
||||
current_job = octoprint_client.job_info()
|
||||
except Exception as e:
|
||||
print(f"Failed to get current job for {printer['name']}: {e}")
|
||||
return
|
||||
|
||||
if current_job["state"] == "Printing":
|
||||
now = datetime.utcnow()
|
||||
start = now - timedelta(seconds=current_job["progress"]["printTime"])
|
||||
|
Loading…
Reference in New Issue
Block a user