-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathathan-cli.py
executable file
·51 lines (39 loc) · 1.23 KB
/
athan-cli.py
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
#!/usr/bin/python
# Doha, Qatar - 25.3, 51.5, 3
from datetime import date
from core.praytimes import PrayTimes
from core.settings import SettingsManager as settings
import configparser
prayTimes = PrayTimes()
cfg = configparser.ConfigParser()
def setup_wizard():
cfg['Location'] = {}
text = ''
while text == '':
text = input("Insert latitude: > ")
cfg['Location']['latitude'] = text
text = ''
while text == '':
text = input("Insert longitude: > ")
cfg['Location']['longitude'] = text
text = ''
while text == '':
text = input("Insert timezone: > ")
cfg['Location']['timezone'] = text
print("Choose a method")
for method in PrayTimes.methods:
print(method)
cfg['Location']['calcCode'] = input("> ")
with open('athanpy.cfg', 'w') as cfgfile:
cfg.write(cfgfile)
settings.refreshVariables()
settings.calcTimes()
# Does not work
#print("from athanterm.py: ", str(calcCode))
#prayTimes = PrayTimes(str(calcCode))
#cfg.read('athanpy.cfg')
#print("Settings chosen: ", lat, lon, tz)
# getTimes(self, date, coords, timezone)
times = settings.times
for i in ['Fajr', 'Sunrise', 'Dhuhr', 'Asr', 'Maghrib', 'Isha', 'Midnight']:
print(i + ': ' + times[i.lower()])