Compare commits
8 Commits
c44c127ccf
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 435535f7be | |||
| f526c93ccb | |||
| ba8410c0bf | |||
| f94ddb704a | |||
| 660a20901d | |||
| c776c42a0b | |||
| b4e2bea9f9 | |||
| fa4f7fa7d9 |
@@ -1 +0,0 @@
|
|||||||
{"installed":{"client_id":"639649814827-rt3k1lvdki8ijtf82lqo7v2e9lp2ekl5.apps.googleusercontent.com","project_id":"gmp-demo-project-996098018","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"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","redirect_uris":["http://localhost"]}}
|
|
||||||
182
gcal.py
Normal file
182
gcal.py
Normal file
@@ -0,0 +1,182 @@
|
|||||||
|
import datetime
|
||||||
|
import pytz
|
||||||
|
import os.path
|
||||||
|
|
||||||
|
from google.auth.transport.requests import Request
|
||||||
|
from google.oauth2.credentials import Credentials
|
||||||
|
from google_auth_oauthlib.flow import InstalledAppFlow
|
||||||
|
from googleapiclient.discovery import build
|
||||||
|
from googleapiclient.errors import HttpError
|
||||||
|
|
||||||
|
# If modifying these scopes, delete the file token.json.
|
||||||
|
SCOPES = ["https://www.googleapis.com/auth/calendar.readonly"]
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""Shows basic usage of the Google Calendar API.
|
||||||
|
Prints the start and name of the next 10 events on the user's calendar.
|
||||||
|
"""
|
||||||
|
creds = None
|
||||||
|
# The file token.json stores the user's access and refresh tokens, and is
|
||||||
|
# created automatically when the authorization flow completes for the first
|
||||||
|
# time.
|
||||||
|
if os.path.exists("/home/tim/venv/ha_imagegen/token.json"):
|
||||||
|
creds = Credentials.from_authorized_user_file("/home/tim/venv/ha_imagegen/token.json", SCOPES)
|
||||||
|
# If there are no (valid) credentials available, let the user log in.
|
||||||
|
if not creds or not creds.valid:
|
||||||
|
if creds and creds.expired and creds.refresh_token:
|
||||||
|
creds.refresh(Request())
|
||||||
|
else:
|
||||||
|
flow = InstalledAppFlow.from_client_secrets_file(
|
||||||
|
"/home/tim/venv/ha_imagegen/credentials.json", SCOPES
|
||||||
|
)
|
||||||
|
creds = flow.run_local_server(port=0)
|
||||||
|
# Save the credentials for the next run
|
||||||
|
with open("/home/tim/venv/ha_imagegen/token.json", "w") as token:
|
||||||
|
token.write(creds.to_json())
|
||||||
|
|
||||||
|
try:
|
||||||
|
service = build("calendar", "v3", credentials=creds)
|
||||||
|
|
||||||
|
|
||||||
|
calendars_to_use = [\
|
||||||
|
# "meneelyl@gmail.com",\
|
||||||
|
"Family",\
|
||||||
|
"Tim Meneely2",\
|
||||||
|
"meneelyt@gmail.com",\
|
||||||
|
"1532 Ingomar Heights Road",\
|
||||||
|
"Vivienne",\
|
||||||
|
"Benjamin",\
|
||||||
|
"Madeline",\
|
||||||
|
"meneely.garcia@gmail.com"\
|
||||||
|
]
|
||||||
|
"""
|
||||||
|
Pittsburgh Panthers football ncaaf_-m-02vklm3_%50ittsburgh+%50anthers+football#sports@group.v.calendar.google.com
|
||||||
|
Penn State Nittany Lions football ncaaf_-m-0frm7n_%50enn+%53tate+%4eittany+%4cions+football#sports@group.v.calendar.google.com
|
||||||
|
Pittsburgh Steelers nfl_-m-05tfm_%50ittsburgh+%53teelers#sports@group.v.calendar.google.com
|
||||||
|
Dallas Cowboys nfl_-m-02896_%44allas+%43owboys#sports@group.v.calendar.google.com
|
||||||
|
Pittsburgh Penguins nhl_-m-0hn6d_%50ittsburgh+%50enguins#sports@group.v.calendar.google.com
|
||||||
|
Holidays in United States en.usa#holiday@group.v.calendar.google.com
|
||||||
|
meneelyl@gmail.com meneelyl@gmail.com
|
||||||
|
Family family14345103599446093558@group.calendar.google.com
|
||||||
|
Meneely Birthdays fjlvq3dnhfvn76ihljocbrhrdc@group.calendar.google.com
|
||||||
|
Tim Meneely2 k7iohvqfspej540e37bqr1hkso@group.calendar.google.com
|
||||||
|
1532 Ingomar Heights Road 3a0104e2f97668033b30227726b79f48b9f341a84cd9fa57aa4e23851aee1750@group.calendar.google.com
|
||||||
|
Vivienne fb53f1ba30abe33a395cb3483aaba416675e2ac829e9e74ca25c10d4fae593c5@group.calendar.google.com
|
||||||
|
Benjamin ed47cdac4f626432af8c0d1956499d258d0365cf3fe6ee70ce73d7d478b0f1dd@group.calendar.google.com
|
||||||
|
Madeline c6eed2e9ec829d835357032a344d2f6894677a6e652d04345c73249cd9bff8fb@group.calendar.google.com
|
||||||
|
meneelyt@gmail.com meneelyt@gmail.com
|
||||||
|
meneely.garcia@gmail.com meneely.garcia@gmail.com
|
||||||
|
"""
|
||||||
|
|
||||||
|
calendarids = []
|
||||||
|
calendarsummaries = []
|
||||||
|
calendar_list = (service.calendarList().list()).execute().get("items", [])
|
||||||
|
for result in calendar_list:
|
||||||
|
if result.get("summary",[]) in calendars_to_use:
|
||||||
|
calendarids.append(result.get("id",[]))
|
||||||
|
calendarsummaries.append(result.get("summary",[]))
|
||||||
|
#print("result",result.get("summary",[]),result.get("id",[]))
|
||||||
|
# print("summaries",calendarsummaries)
|
||||||
|
#print("first result",calendar_list[0])
|
||||||
|
#print("first result",calendar_list[len(calendar_list)-1])
|
||||||
|
#result meneelyl@gmail.com meneelyl@gmail.com
|
||||||
|
#result Family family14345103599446093558@group.calendar.google.com
|
||||||
|
#result Meneely Birthdays fjlvq3dnhfvn76ihljocbrhrdc@group.calendar.google.com
|
||||||
|
#result Tim Meneely2 k7iohvqfspej540e37bqr1hkso@group.calendar.google.com
|
||||||
|
#result meneelyt@gmail.com meneelyt@gmail.com
|
||||||
|
#result 1532 Ingomar Heights Road 3a0104e2f97668033b30227726b79f48b9f341a84cd9fa57aa4e23851aee1750@group.calendar.google.com
|
||||||
|
#result Vivienne fb53f1ba30abe33a395cb3483aaba416675e2ac829e9e74ca25c10d4fae593c5@group.calendar.google.com
|
||||||
|
#result Benjamin ed47cdac4f626432af8c0d1956499d258d0365cf3fe6ee70ce73d7d478b0f1dd@group.calendar.google.com
|
||||||
|
#result Madeline c6eed2e9ec829d835357032a344d2f6894677a6e652d04345c73249cd9bff8fb@group.calendar.google.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Call the Calendar API
|
||||||
|
now = datetime.datetime.now(tz=datetime.timezone.utc).isoformat()
|
||||||
|
tomorrow = (datetime.datetime.now(tz=datetime.timezone.utc)+datetime.timedelta(days=3)).isoformat()
|
||||||
|
#print("Getting the upcoming 10 events")
|
||||||
|
allevents = []
|
||||||
|
for i in range(0,len(calendarids)):
|
||||||
|
events_result = (
|
||||||
|
service.events()
|
||||||
|
.list(
|
||||||
|
calendarId=calendarids[i],
|
||||||
|
timeMin=now,
|
||||||
|
timeMax=tomorrow,
|
||||||
|
maxResults=10,
|
||||||
|
singleEvents=True,
|
||||||
|
orderBy="startTime",
|
||||||
|
)
|
||||||
|
.execute()
|
||||||
|
)
|
||||||
|
events = events_result.get("items", [])
|
||||||
|
|
||||||
|
#if not events:
|
||||||
|
# print("No upcoming events found.")
|
||||||
|
# return
|
||||||
|
|
||||||
|
# Prints the start and name of the next 10 events
|
||||||
|
#for event in events:
|
||||||
|
# start = event["start"].get("dateTime", event["start"].get("date"))
|
||||||
|
#print(start, event["summary"],"(from "+calendarsummaries[i]+")")
|
||||||
|
#print("type events",type(events),"type event",type(event))
|
||||||
|
#allevents.append(events)
|
||||||
|
useastern_timezone = pytz.timezone("US/Eastern")
|
||||||
|
today = datetime.datetime.now(tz=useastern_timezone).date() # #.strftime("%Y-%m-%d")
|
||||||
|
for event in events:
|
||||||
|
if event.get("summary","Private") not in ["Middle","Private"]:
|
||||||
|
event["calendarname"]=calendarsummaries[i]
|
||||||
|
if "dateTime" in event["start"]:
|
||||||
|
#startdate = event["start"].get("dateTime")
|
||||||
|
eventdate = datetime.datetime.strptime(event["start"]["dateTime"],"%Y-%m-%dT%H:%M:%S%z")
|
||||||
|
#print("uses dateTime",event["summary"],eventdate)
|
||||||
|
elif "date" in event["start"]:
|
||||||
|
#startdate = event["start"].get("date")
|
||||||
|
eventdate = datetime.datetime.strptime(event["start"]["date"],"%Y-%m-%d")
|
||||||
|
else:
|
||||||
|
eventdate = None
|
||||||
|
#print("eventdate",eventdate,type(eventdate))
|
||||||
|
#startdate = event["start"],event["start"].get("dateTime",event["start"].get("date"))
|
||||||
|
#print("startdate",startdate,type(startdate))
|
||||||
|
|
||||||
|
#eventdate = datetime.datetime.strptime(event["start"]["dateTime"],"%Y-%m-%dT%H:%M:%S%z")
|
||||||
|
if "dateTime" in event["start"]:
|
||||||
|
prettytime = (" "+eventdate.strftime("%I:%M %p")).replace(" 0"," ")
|
||||||
|
else:
|
||||||
|
prettytime = "" #All day"
|
||||||
|
#if datetime.datetime.now().date() == eventdate.date():
|
||||||
|
if today == eventdate.date():
|
||||||
|
pass # This is today, print as is
|
||||||
|
else:
|
||||||
|
prettytime = eventdate.strftime("%a")+prettytime
|
||||||
|
event["prettytime"] = prettytime.strip() #(" "+eventdate.strftime("%I:%M %p")).replace(" 0"," ")
|
||||||
|
#if event["summary"] == "Girls":
|
||||||
|
# print("event",event)
|
||||||
|
allevents.append(event)
|
||||||
|
#print("allevents",allevents)
|
||||||
|
allevents2 = sorted(allevents, key=lambda event: event["start"].get("dateTime", event["start"].get("date")))
|
||||||
|
#for event in allevents2:
|
||||||
|
# start = event["start"].get("dateTime", event["start"].get("date"))
|
||||||
|
# print(start, event["summary"],"(from "+calendarsummaries[event["mycalendarkey"]]+")")
|
||||||
|
except HttpError as error:
|
||||||
|
print(f"An error occurred: {error}")
|
||||||
|
allevents2 = []
|
||||||
|
return allevents2
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
allevents = (main())
|
||||||
|
for event in allevents:
|
||||||
|
#start = event["start"].get("dateTime", event["start"].get("date"))
|
||||||
|
#print(start, event["summary"],"(from "+event["calendarname"]+")")
|
||||||
|
print(event["prettytime"], event.get("summary","No summary"),"(from "+event["calendarname"]+")")
|
||||||
|
if event.get("summary","No summary") == "No summary":
|
||||||
|
print("Rogue event",event)
|
||||||
|
#print(event["start"],type(event["start"]))
|
||||||
|
#eventdate = datetime.datetime.strptime(event["start"]["dateTime"],"%Y-%m-%dT%H:%M:%S%z")
|
||||||
|
#print((" "+eventdate.strftime("%I:%M %p")).replace(" 0"," "))
|
||||||
|
#print(eventdate,type(eventdate))
|
||||||
|
#s=datetime.datetime.strptime(,"%Y-%m-%dT%H:%M:%S%z")
|
||||||
|
#print((event["start"]["dateTime"])) #.datetime.datetime.strftime("%I:%M %p"))
|
||||||
|
#print("event",allevents[0])
|
||||||
49
gcal_list.py
Normal file
49
gcal_list.py
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
import datetime
|
||||||
|
import os.path
|
||||||
|
|
||||||
|
from google.auth.transport.requests import Request
|
||||||
|
from google.oauth2.credentials import Credentials
|
||||||
|
from google_auth_oauthlib.flow import InstalledAppFlow
|
||||||
|
from googleapiclient.discovery import build
|
||||||
|
from googleapiclient.errors import HttpError
|
||||||
|
|
||||||
|
# If modifying these scopes, delete the file token.json.
|
||||||
|
SCOPES = ["https://www.googleapis.com/auth/calendar.readonly"]
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""Shows basic usage of the Google Calendar API.
|
||||||
|
Prints the start and name of the next 10 events on the user's calendar.
|
||||||
|
"""
|
||||||
|
creds = None
|
||||||
|
# The file token.json stores the user's access and refresh tokens, and is
|
||||||
|
# created automatically when the authorization flow completes for the first
|
||||||
|
# time.
|
||||||
|
if os.path.exists("token.json"):
|
||||||
|
creds = Credentials.from_authorized_user_file("token.json", SCOPES)
|
||||||
|
# If there are no (valid) credentials available, let the user log in.
|
||||||
|
if not creds or not creds.valid:
|
||||||
|
if creds and creds.expired and creds.refresh_token:
|
||||||
|
creds.refresh(Request())
|
||||||
|
else:
|
||||||
|
flow = InstalledAppFlow.from_client_secrets_file(
|
||||||
|
"credentials.json", SCOPES
|
||||||
|
)
|
||||||
|
creds = flow.run_local_server(port=0)
|
||||||
|
# Save the credentials for the next run
|
||||||
|
with open("token.json", "w") as token:
|
||||||
|
token.write(creds.to_json())
|
||||||
|
|
||||||
|
try:
|
||||||
|
service = build("calendar", "v3", credentials=creds)
|
||||||
|
|
||||||
|
calendar_list = (service.calendarList().list()).execute().get("items", [])
|
||||||
|
for result in calendar_list:
|
||||||
|
print(result.get("summary",[]),result.get("id",[]))
|
||||||
|
except HttpError as error:
|
||||||
|
print(f"An error occurred: {error}")
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
allevents = (main())
|
||||||
@@ -1,108 +0,0 @@
|
|||||||
import datetime
|
|
||||||
import os.path
|
|
||||||
|
|
||||||
from google.auth.transport.requests import Request
|
|
||||||
from google.oauth2.credentials import Credentials
|
|
||||||
from google_auth_oauthlib.flow import InstalledAppFlow
|
|
||||||
from googleapiclient.discovery import build
|
|
||||||
from googleapiclient.errors import HttpError
|
|
||||||
|
|
||||||
# If modifying these scopes, delete the file token.json.
|
|
||||||
SCOPES = ["https://www.googleapis.com/auth/calendar.readonly"]
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
"""Shows basic usage of the Google Calendar API.
|
|
||||||
Prints the start and name of the next 10 events on the user's calendar.
|
|
||||||
"""
|
|
||||||
creds = None
|
|
||||||
# The file token.json stores the user's access and refresh tokens, and is
|
|
||||||
# created automatically when the authorization flow completes for the first
|
|
||||||
# time.
|
|
||||||
if os.path.exists("token.json"):
|
|
||||||
creds = Credentials.from_authorized_user_file("token.json", SCOPES)
|
|
||||||
# If there are no (valid) credentials available, let the user log in.
|
|
||||||
if not creds or not creds.valid:
|
|
||||||
if creds and creds.expired and creds.refresh_token:
|
|
||||||
creds.refresh(Request())
|
|
||||||
else:
|
|
||||||
flow = InstalledAppFlow.from_client_secrets_file(
|
|
||||||
"credentials.json", SCOPES
|
|
||||||
)
|
|
||||||
creds = flow.run_local_server(port=0)
|
|
||||||
# Save the credentials for the next run
|
|
||||||
with open("token.json", "w") as token:
|
|
||||||
token.write(creds.to_json())
|
|
||||||
|
|
||||||
try:
|
|
||||||
service = build("calendar", "v3", credentials=creds)
|
|
||||||
|
|
||||||
|
|
||||||
calendars_to_use = [\
|
|
||||||
# "meneelyl@gmail.com",\
|
|
||||||
"Family",\
|
|
||||||
# "Tim Meneely2",\
|
|
||||||
# "meneelyt@gmail.com",\
|
|
||||||
"1532 Ingomar Heights Road",\
|
|
||||||
"Vivienne",\
|
|
||||||
"Benjamin",\
|
|
||||||
"Madeline"\
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
calendarids = []
|
|
||||||
calendarsummaries = []
|
|
||||||
calendar_list = (service.calendarList().list()).execute().get("items", [])
|
|
||||||
for result in calendar_list:
|
|
||||||
if result.get("summary",[]) in calendars_to_use:
|
|
||||||
calendarids.append(result.get("id",[]))
|
|
||||||
calendarsummaries.append(result.get("summary",[]))
|
|
||||||
#print("result",result.get("summary",[]),result.get("id",[]))
|
|
||||||
print("summaries",calendarsummaries)
|
|
||||||
#print("first result",calendar_list[0])
|
|
||||||
#print("first result",calendar_list[len(calendar_list)-1])
|
|
||||||
#result meneelyl@gmail.com meneelyl@gmail.com
|
|
||||||
#result Family family14345103599446093558@group.calendar.google.com
|
|
||||||
#result Meneely Birthdays fjlvq3dnhfvn76ihljocbrhrdc@group.calendar.google.com
|
|
||||||
#result Tim Meneely2 k7iohvqfspej540e37bqr1hkso@group.calendar.google.com
|
|
||||||
#result meneelyt@gmail.com meneelyt@gmail.com
|
|
||||||
#result 1532 Ingomar Heights Road 3a0104e2f97668033b30227726b79f48b9f341a84cd9fa57aa4e23851aee1750@group.calendar.google.com
|
|
||||||
#result Vivienne fb53f1ba30abe33a395cb3483aaba416675e2ac829e9e74ca25c10d4fae593c5@group.calendar.google.com
|
|
||||||
#result Benjamin ed47cdac4f626432af8c0d1956499d258d0365cf3fe6ee70ce73d7d478b0f1dd@group.calendar.google.com
|
|
||||||
#result Madeline c6eed2e9ec829d835357032a344d2f6894677a6e652d04345c73249cd9bff8fb@group.calendar.google.com
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Call the Calendar API
|
|
||||||
now = datetime.datetime.now(tz=datetime.timezone.utc).isoformat()
|
|
||||||
print("Getting the upcoming 10 events")
|
|
||||||
for i in range(0,len(calendarids)):
|
|
||||||
#print("Calendar: ",i,calendarsummaries[i])
|
|
||||||
events_result = (
|
|
||||||
service.events()
|
|
||||||
.list(
|
|
||||||
calendarId=calendarids[i], #"family14345103599446093558@group.calendar.google.com", #"meneelyt@gmail.com", #"ed47cdac4f626432af8c0d1956499d258d0365cf3fe6ee70ce73d7d478b0f1dd@group.calendar.google.com", #"primary",
|
|
||||||
timeMin=now,
|
|
||||||
maxResults=10,
|
|
||||||
singleEvents=True,
|
|
||||||
orderBy="startTime",
|
|
||||||
)
|
|
||||||
.execute()
|
|
||||||
)
|
|
||||||
events = events_result.get("items", [])
|
|
||||||
|
|
||||||
if not events:
|
|
||||||
print("No upcoming events found.")
|
|
||||||
return
|
|
||||||
|
|
||||||
# Prints the start and name of the next 10 events
|
|
||||||
for event in events:
|
|
||||||
start = event["start"].get("dateTime", event["start"].get("date"))
|
|
||||||
print(start, event["summary"],"(from "+calendarsummaries[i]+")")
|
|
||||||
|
|
||||||
except HttpError as error:
|
|
||||||
print(f"An error occurred: {error}")
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
@@ -23,7 +23,7 @@ def get_current_weather(api_key, lat, lng, units="IMPERIAL"):
|
|||||||
return response.json()
|
return response.json()
|
||||||
|
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
#print(f"An error occurred: {e}")
|
print(f"Current weather: An error occurred: {e}")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_daily_forecast(api_key, lat, lng, days=2):
|
def get_daily_forecast(api_key, lat, lng, days=2):
|
||||||
@@ -51,7 +51,7 @@ def get_daily_forecast(api_key, lat, lng, days=2):
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
#print(f"An error occurred: {e}")
|
print(f"Forecast: An error occurred: {e}")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_google_weather():
|
def get_google_weather():
|
||||||
|
|||||||
24
imagegen.py
24
imagegen.py
@@ -3,11 +3,13 @@ import datetime
|
|||||||
import pytz
|
import pytz
|
||||||
import google_weather
|
import google_weather
|
||||||
import mlb
|
import mlb
|
||||||
|
import gcal
|
||||||
|
|
||||||
fontBaseHeight = 25
|
fontBaseHeight = 25
|
||||||
fnt = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf",fontBaseHeight)
|
fnt = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf",fontBaseHeight)
|
||||||
|
fntSmall = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf",fontBaseHeight-10)
|
||||||
fntBold = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf",fontBaseHeight)
|
fntBold = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf",fontBaseHeight)
|
||||||
fntBigBold = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf",fontBaseHeight+10)
|
fntBigBold = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf",fontBaseHeight+5)
|
||||||
|
|
||||||
def WriteTextBlock(text, context, font = fnt, column=0, row=0, anchor = "la"):
|
def WriteTextBlock(text, context, font = fnt, column=0, row=0, anchor = "la"):
|
||||||
context.multiline_text((column, row), text, font=font, fill=0, anchor = anchor)
|
context.multiline_text((column, row), text, font=font, fill=0, anchor = anchor)
|
||||||
@@ -28,12 +30,14 @@ MarginIndent = 10
|
|||||||
d = ImageDraw.Draw(out)
|
d = ImageDraw.Draw(out)
|
||||||
|
|
||||||
# create text
|
# create text
|
||||||
|
txt1a = "As of "+datetime.datetime.now(pytz.timezone('America/New_York')).strftime('%I:%M %p')
|
||||||
|
#row = WriteTextBlock(txt1a,d,fnt,displaysize[0]/2,row,"ma")
|
||||||
|
rowThrowAway = WriteTextBlock(txt1a,d,fntSmall,displaysize[0],row,"ra")
|
||||||
|
|
||||||
txt1 = datetime.datetime.now(pytz.timezone('America/New_York')).strftime('%A %B %d, %Y')
|
txt1 = datetime.datetime.now(pytz.timezone('America/New_York')).strftime('%A %B %d, %Y')
|
||||||
# draw multiline text
|
# draw multiline text
|
||||||
row = WriteTextBlock(txt1,d,fntBigBold,displaysize[0]/2,row,"ma")
|
row = WriteTextBlock(txt1,d,fntBigBold,displaysize[0]/2,row,"ma")
|
||||||
|
|
||||||
txt1a = "As of "+datetime.datetime.now(pytz.timezone('America/New_York')).strftime('%I:%M %p')
|
|
||||||
row = WriteTextBlock(txt1a,d,fnt,displaysize[0]/2,row,"ma")
|
|
||||||
|
|
||||||
row = WriteTextBlock("Weather",d,fntBold,MarginLeft,row,"la")
|
row = WriteTextBlock("Weather",d,fntBold,MarginLeft,row,"la")
|
||||||
try:
|
try:
|
||||||
@@ -48,6 +52,20 @@ row = WriteTextBlock(txt2,d,fnt,MarginIndent,row,"la")
|
|||||||
row = WriteTextBlock("Pirates",d,fntBold,MarginLeft,row,"la")
|
row = WriteTextBlock("Pirates",d,fntBold,MarginLeft,row,"la")
|
||||||
row = WriteTextBlock(mlb.get_pirates(),d,fnt,MarginIndent,row,"la")
|
row = WriteTextBlock(mlb.get_pirates(),d,fnt,MarginIndent,row,"la")
|
||||||
|
|
||||||
|
appointments = gcal.main()
|
||||||
|
apptxt = ""
|
||||||
|
for event in appointments:
|
||||||
|
#start = event["start"].get("dateTime", event["start"].get("date"))
|
||||||
|
#apptxt+= start+": "+event["summary"]+" (from "+event["calendarname"]+")\n"
|
||||||
|
if event["prettytime"]:
|
||||||
|
apptxt+= event["prettytime"]+": "+event["summary"]+" (from "+event["calendarname"]+")\n"
|
||||||
|
else:
|
||||||
|
apptxt+= event["summary"]+" (from "+event["calendarname"]+")\n"
|
||||||
|
|
||||||
|
row = WriteTextBlock("Appointments",d,fntBold,MarginLeft,row,"la")
|
||||||
|
row = WriteTextBlock(apptxt,d,fnt,MarginIndent,row,"la")
|
||||||
|
|
||||||
|
|
||||||
row = WriteTextBlock("========== End =========",d,fnt,MarginLeft,row,"la")
|
row = WriteTextBlock("========== End =========",d,fnt,MarginLeft,row,"la")
|
||||||
|
|
||||||
out.save("/mnt/nfs/HomeAutomation/ForHA.jpg","JPEG")
|
out.save("/mnt/nfs/HomeAutomation/ForHA.jpg","JPEG")
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"token": "ya29.a0AQvPyIPPV_42i2z3CDPSSvvPUQZOQH8EQyuhGd75E4EM7QyfSgL1abzVuY55uYfb0lXX-ncgfkhfQ76t6La6nO2pQQkinpOjJ8E_qee5S7LJYWHD-_jBnykngR3uoCR3JXO6zIxWFzpUcXJ7s4MnUwFkk3-Vs6rJnPPVNtR0sH99Kl8DnYBTpobnD9s2UgKqLotztNWmaCgYKAdcSARMSFQHGX2Mi_OKjLI6I83--Wmui1ER1bg0207", "refresh_token": "1//05gtSbVRZIG0QCgYIARAAGAUSNwF-L9Irsu_pTbTjO_hMIFTJier0k5qwNj703kl1Uzw6bSK9GN9uK8taw1rNofOxQBXJPZJg6_Y", "token_uri": "https://oauth2.googleapis.com/token", "client_id": "639649814827-rt3k1lvdki8ijtf82lqo7v2e9lp2ekl5.apps.googleusercontent.com", "client_secret": "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", "scopes": ["https://www.googleapis.com/auth/calendar.readonly"], "universe_domain": "googleapis.com", "account": "", "expiry": "2026-05-27T02:36:50.193425Z"}
|
{"token": "ya29.a0AQvPyIMP600wh7gMW2d7H3QUZJASVBf5iAK2K-hT59qwZ5C24Q6kW9jElF1vXW-AQOQu0xabV6clQfbvxlXhuHbqlQXZ9eV06IS1lBmQ_NTSG6SOgp2j8V3JV0gHbLYcCsibeD4_hwrXslXEOLSQYmlJkQYD0N8D7PxCnOuJX1JubffTlCQ57z9k2NjJ4KgD9M6D281saCgYKAUMSARMSFQHGX2MiBC1fCe8w0mGVcsXLgtRZQA0207", "refresh_token": "1//05gtSbVRZIG0QCgYIARAAGAUSNwF-L9Irsu_pTbTjO_hMIFTJier0k5qwNj703kl1Uzw6bSK9GN9uK8taw1rNofOxQBXJPZJg6_Y", "token_uri": "https://oauth2.googleapis.com/token", "client_id": "639649814827-rt3k1lvdki8ijtf82lqo7v2e9lp2ekl5.apps.googleusercontent.com", "client_secret": "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", "scopes": ["https://www.googleapis.com/auth/calendar.readonly"], "universe_domain": "googleapis.com", "account": "", "expiry": "2026-06-02T01:00:01.538193Z"}
|
||||||
Reference in New Issue
Block a user