call the openweather scraper from the image module
This commit is contained in:
		| @@ -55,7 +55,7 @@ class Inkyimage: | |||||||
|                 image = Image.open(path) |                 image = Image.open(path) | ||||||
|         except FileNotFoundError: |         except FileNotFoundError: | ||||||
|             logger.error('No image file found', exc_info=True) |             logger.error('No image file found', exc_info=True) | ||||||
|             raise Exception('Your file could not be found. Please check the filepath') |             raise Exception(f'Your file could not be found. Please check the filepath: {path}') | ||||||
|  |  | ||||||
|         except OSError: |         except OSError: | ||||||
|             logger.error('Invalid Image file provided', exc_info=True) |             logger.error('Invalid Image file provided', exc_info=True) | ||||||
|   | |||||||
| @@ -6,6 +6,7 @@ Copyright by aceinnolab | |||||||
| """ | """ | ||||||
|  |  | ||||||
| from inkycal.modules.template import inkycal_module | from inkycal.modules.template import inkycal_module | ||||||
|  | from inkycal.modules.inkycal_openweather_scrape import get_scraped_weatherforecast_image | ||||||
| from inkycal.custom import * | from inkycal.custom import * | ||||||
|  |  | ||||||
| from inkycal.modules.inky_image import Inkyimage as Images | from inkycal.modules.inky_image import Inkyimage as Images | ||||||
| @@ -68,6 +69,9 @@ class Inkyimage(inkycal_module): | |||||||
|         print(f'{__name__} loaded') |         print(f'{__name__} loaded') | ||||||
|  |  | ||||||
|     def generate_image(self): |     def generate_image(self): | ||||||
|  |         """Call the openweather scraper""" | ||||||
|  |         _,_ = get_scraped_weatherforecast_image() | ||||||
|  |          | ||||||
|         """Generate image for this module""" |         """Generate image for this module""" | ||||||
|  |  | ||||||
|         # Define new image size with respect to padding |         # Define new image size with respect to padding | ||||||
|   | |||||||
| @@ -78,3 +78,10 @@ def get_scraped_weatherforecast_image() -> Image: | |||||||
|     im = ImageEnhance.Contrast(im).enhance(1.3) |     im = ImageEnhance.Contrast(im).enhance(1.3) | ||||||
|     im.save(image_filename) |     im.save(image_filename) | ||||||
|     return im, im |     return im, im | ||||||
|  |  | ||||||
|  | def main(): | ||||||
|  |     _, _ = get_scraped_weatherforecast_image() | ||||||
|  |  | ||||||
|  | if __name__ == '__main__': | ||||||
|  |     print(f'running {__name__} in standalone/debug mode') | ||||||
|  |     main() | ||||||
		Reference in New Issue
	
	Block a user
	 mrbwburns
					mrbwburns