mirror of
https://github.com/Death916/deathclock.git
synced 2026-04-10 03:04:40 -07:00
weather showing
This commit is contained in:
parent
3bec50f40e
commit
802bcfac6a
3 changed files with 7 additions and 6 deletions
|
|
@ -7,8 +7,8 @@ class Weather:
|
|||
# Get the directory where this script (weather.py) is located
|
||||
self.script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
# Construct the absolute path to the 'assets' directory in the same directory as the script
|
||||
self.assets_dir = os.path.join(self.script_dir, 'assets')
|
||||
# Construct the absolute path to the 'assets' directory in the project root
|
||||
self.assets_dir = os.path.join(os.path.dirname(os.path.dirname(self.script_dir)), 'assets')
|
||||
|
||||
# Ensure the assets directory exists
|
||||
if not os.path.exists(self.assets_dir):
|
||||
|
|
@ -30,7 +30,7 @@ class Weather:
|
|||
try:
|
||||
# Create a timestamp for the filename
|
||||
timestamp = datetime.datetime.now().strftime("%Y%m%d-%H%M%S")
|
||||
screenshot_filename = f"sacramento_weather_{timestamp}.png"
|
||||
screenshot_filename = "weather.png"
|
||||
screenshot_path = os.path.join(self.assets_dir, screenshot_filename) # save to the proper location
|
||||
|
||||
# Use curl to get the weather data from wttr.in and save it as a PNG.
|
||||
|
|
@ -52,4 +52,4 @@ class Weather:
|
|||
return None
|
||||
except Exception as e:
|
||||
print(f"An unexpected error occurred: {e}")
|
||||
return None
|
||||
return None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue