-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComb-Jelly-Time.py
More file actions
79 lines (72 loc) · 2.69 KB
/
Comb-Jelly-Time.py
File metadata and controls
79 lines (72 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
from datetime import datetime
import numpy as np
import pygame
from pygame.locals import *
import pycountry as pc
import pytz
import reverse_geocoder as rg
from time import sleep
from timezonefinder import TimezoneFinder
tf = TimezoneFinder()
if False:
while True:
lat, lon = (1 - (2 * np.random.random(2))) * (90, 180)
# print(lat, lon)
try:
timezoneobject = pytz.timezone(tf.timezone_at(lng=lon, lat=lat))
timedata = datetime.now(timezoneobject)
if timedata.hour == 10 and timedata.minute == 4:
place = rg.get((lat, lon), mode=1, verbose=False)
placename = [place["name"],
place["admin2"], place["admin1"],
pc.countries.get(alpha_2=place["cc"]).name]
try:
placename.remove("")
except ValueError:
pass
i = 0
while i < len(placename) - 1:
if placename[i].upper() == placename[i + 1].upper():
placename.pop(i)
else:
i += 1
print("Comb Jelly Time in {}!!! (UTC{})\nLocal Time = 10:04, UTC = {}"
.format(", ".join(placename),
str(datetime.now(timezoneobject))[-6:],
str(datetime.utcnow().time())[:5]))
sleep(65)
except AttributeError as e:
pass
else:
pygame.init()
w, h = 500, 500
screen = pygame.display.set_mode((w, h))
screensize = np.int32((w, h))
for i in range(-180, 181, 5):
for j in range(-90, 91, 5):
try:
timezonename = tf.timezone_at(lng=i, lat=j)
timezoneobject = pytz.timezone(timezonename)
timestring = datetime.now(timezoneobject)
points = 200 + (np.float32(tf.get_geometry(timezonename, coords_as_pairs=True)[0][0]) * (1, -1))
# print(points)
pygame.draw.polygon(screen, np.random.randint(0, 255, 3, "int32"), points)
# print(i, j, timezonename, timestring)
except Exception as e:
pass # print(i, j, e)
pygame.display.flip()
for e in pygame.event.get():
if e.type == QUIT:
quit()
keys = set()
while True:
for e in pygame.event.get():
if e.type == QUIT:
quit()
elif e.type == KEYDOWN:
keys.add(e.key)
if e.key == K_ESCAPE:
quit()
elif e.type == KEYUP:
keys.discard(e.key)
sleep(0.001)