weather: Rework moon phases icons

This commit is contained in:
nemunaire 2022-08-26 08:48:18 +02:00
parent a5282f5179
commit 9004a83dda

View File

@ -102,64 +102,62 @@ class DarkSkyAPI:
def get_moon_icon(self, day=0):
moon_phase = self.get_daily()["data"][day]["moonPhase"]
if moon_phase <= 0:
if moon_phase < 0.035:
return "wi-moon-alt-new.png"
elif moon_phase <= 0.035:
elif moon_phase < 0.071:
return "wi-moon-alt-waxing-crescent-1.png"
elif moon_phase <= 0.071:
elif moon_phase < 0.107:
return "wi-moon-alt-waxing-crescent-2.png"
elif moon_phase <= 0.107:
elif moon_phase < 0.142:
return "wi-moon-alt-waxing-crescent-3.png"
elif moon_phase <= 0.142:
elif moon_phase < 0.178:
return "wi-moon-alt-waxing-crescent-4.png"
elif moon_phase <= 0.178:
elif moon_phase < 0.214:
return "wi-moon-alt-waxing-crescent-5.png"
elif moon_phase <= 0.214:
elif moon_phase < 0.25:
return "wi-moon-alt-waxing-crescent-6.png"
elif moon_phase <= 0.25:
elif moon_phase < 0.285:
return "wi-moon-alt-first-quarter.png"
elif moon_phase <= 0.285:
elif moon_phase < 0.321:
return "wi-moon-alt-waxing-gibbous-1.png"
elif moon_phase <= 0.321:
elif moon_phase < 0.357:
return "wi-moon-alt-waxing-gibbous-2.png"
elif moon_phase <= 0.357:
elif moon_phase < 0.392:
return "wi-moon-alt-waxing-gibbous-3.png"
elif moon_phase <= 0.392:
elif moon_phase < 0.428:
return "wi-moon-alt-waxing-gibbous-4.png"
elif moon_phase <= 0.428:
elif moon_phase < 0.464:
return "wi-moon-alt-waxing-gibbous-5.png"
elif moon_phase <= 0.464:
elif moon_phase < 0.5:
return "wi-moon-alt-waxing-gibbous-6.png"
elif moon_phase <= 0.5:
elif moon_phase < 0.535:
return "wi-moon-alt-full.png"
elif moon_phase <= 0.535:
elif moon_phase < 0.571:
return "wi-moon-alt-waning-gibbous-1.png"
elif moon_phase <= 0.571:
elif moon_phase < 0.607:
return "wi-moon-alt-waning-gibbous-2.png"
elif moon_phase <= 0.607:
elif moon_phase < 0.642:
return "wi-moon-alt-waning-gibbous-3.png"
elif moon_phase <= 0.642:
elif moon_phase < 0.678:
return "wi-moon-alt-waning-gibbous-4.png"
elif moon_phase <= 0.678:
elif moon_phase < 0.714:
return "wi-moon-alt-waning-gibbous-5.png"
elif moon_phase <= 0.714:
elif moon_phase < 0.75:
return "wi-moon-alt-waning-gibbous-6.png"
elif moon_phase <= 0.75:
elif moon_phase < 0.785:
return "wi-moon-alt-third-quarter.png"
elif moon_phase <= 0.785:
elif moon_phase < 0.821:
return "wi-moon-alt-waning-crescent-1.png"
elif moon_phase <= 0.821:
elif moon_phase < 0.857:
return "wi-moon-alt-waning-crescent-2.png"
elif moon_phase <= 0.857:
elif moon_phase < 0.892:
return "wi-moon-alt-waning-crescent-3.png"
elif moon_phase <= 0.892:
elif moon_phase < 0.928:
return "wi-moon-alt-waning-crescent-4.png"
elif moon_phase <= 0.928:
elif moon_phase < 0.964:
return "wi-moon-alt-waning-crescent-5.png"
elif moon_phase <= 0.964:
return "wi-moon-alt-waning-crescent-6.png"
else:
return "wi-alien.png"
return "wi-moon-alt-waning-crescent-6.png"
def get_currently(self, *args, **kwargs):