Skip to content

Commit

Permalink
wakeup api endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
bwees committed Dec 16, 2023
1 parent f394a4b commit 5868efa
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions server/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import dithering
import datetime
from io import BytesIO
import datetime

register_heif_opener()
app = Flask(__name__)
Expand Down Expand Up @@ -133,5 +134,21 @@ def get_image(img_id):

return "OK"

@app.route("/api/wakeup")
def wakeup():
now = datetime.datetime.now()

# get tomorrow at 3am
t_wakeup = now.replace(day=now.day+1, hour=3, minute=0, second=0, microsecond=0)

# get the difference in seconds
delta_t = t_wakeup - now

# convert to uS
delta_t = int(delta_t.total_seconds()) * 1000000

return str(delta_t)


if __name__ == '__main__':
app.run(debug=True, port=8000, host="0.0.0.0")

0 comments on commit 5868efa

Please sign in to comment.