Update cal2-4.py
This commit is contained in:
		| @@ -7,7 +7,6 @@ import calendar,  pyowm #calendar and openweathermap wrapper | |||||||
| from ics import Calendar, Event #icalendar parser | from ics import Calendar, Event #icalendar parser | ||||||
| from datetime import datetime #time operations | from datetime import datetime #time operations | ||||||
| from time import sleep #more time operations | from time import sleep #more time operations | ||||||
| ##import requests  #need to try changing from urllib to requests |  | ||||||
| from urllib.request import urlopen #allows url to be 'read' | from urllib.request import urlopen #allows url to be 'read' | ||||||
| import arrow #icalendar parser compatible dates | import arrow #icalendar parser compatible dates | ||||||
| from calibration import calibration | from calibration import calibration | ||||||
| @@ -18,18 +17,17 @@ epd.init() #required | |||||||
| url = "please past a valid calendar url here" | url = "please past a valid calendar url here" | ||||||
| calendar.setfirstweekday(calendar.MONDAY) #mon or sun | calendar.setfirstweekday(calendar.MONDAY) #mon or sun | ||||||
|  |  | ||||||
| c = Calendar(urlopen(url).read().decode('UTF-8')) #was 'iso-8859-1' | c = Calendar(urlopen(url).read().decode('UTF-8')) | ||||||
| ##c = Calendar(requests.get(url)urlopen(url).read().decode('iso-8859-1')) |  | ||||||
| e = Event() | e = Event() | ||||||
| open = Image.open | open = Image.open | ||||||
| EPD_WIDTH = 640 | EPD_WIDTH = 640 | ||||||
| EPD_HEIGHT = 384 | EPD_HEIGHT = 384 | ||||||
| font = ImageFont.truetype('/usr/share/fonts/truetype/Assistant/Assistant-Bold.otf', 18) |  | ||||||
|  |  | ||||||
| path = '/home/pi/Calendar/' | path = '/home/pi/E-Paper-Master/Calendar/' | ||||||
| wpath = path+'weather-icons/' | wpath = path+'weather-icons/' | ||||||
| mpath = path+'months/' | mpath = path+'months/' | ||||||
| dpath = path+'days/' | dpath = path+'days/' | ||||||
|  | font = ImageFont.truetype(path+'Assistant-Bold.otf', 18) | ||||||
|  |  | ||||||
| weekday =               open(path+'/other/weekday.bmp') | weekday =               open(path+'/other/weekday.bmp') | ||||||
| eventicon =             open(path+'other/event.bmp') | eventicon =             open(path+'other/event.bmp') | ||||||
| @@ -39,7 +37,6 @@ humicon =               open(path+'other/hum-icon.bmp') | |||||||
| weekmon =               open(path+'other/week-mon.bmp') | weekmon =               open(path+'other/week-mon.bmp') | ||||||
| weeksun =               open(path+'other/week-sun.bmp') | weeksun =               open(path+'other/week-sun.bmp') | ||||||
| bar =                   open(path+'other/bar.bmp') | bar =                   open(path+'other/bar.bmp') | ||||||
| #qr =                    open(path+'other/qr.bmp') #dev |  | ||||||
|  |  | ||||||
| wiconplace = (570, 219) | wiconplace = (570, 219) | ||||||
| tempplace = (605, 310) | tempplace = (605, 310) | ||||||
| @@ -114,8 +111,8 @@ def main(): | |||||||
|                 pass |                 pass | ||||||
|              |              | ||||||
|             # openweathermap api |             # openweathermap api | ||||||
|             owm = pyowm.OWM('57c07b8f2ae09e348d32317f1bfe3f52') |             owm = pyowm.OWM('Your Openweathermap API') | ||||||
|             observation = owm.weather_at_place('Stuttgart, DE') |             observation = owm.weather_at_place('Your City, Your Country Name') # like (New York, US) | ||||||
|             weather = observation.get_weather() |             weather = observation.get_weather() | ||||||
|             weathericon = weather.get_weather_icon_name() |             weathericon = weather.get_weather_icon_name() | ||||||
|             Temperature = str(int(weather.get_temperature(unit='celsius')['temp'])) |             Temperature = str(int(weather.get_temperature(unit='celsius')['temp'])) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user