16 Jan 2022 |
| crab fog changed their display name from gregfro to JJ11013. | 14:59:47 |
| crab fog changed their display name from JJ11013 to crab fog. | 15:00:29 |
26 Jan 2022 |
| skobido joined the room. | 23:52:38 |
18 Feb 2022 |
| delta joined the room. | 06:25:08 |
8 Mar 2022 |
| silly_rabbit_run joined the room. | 18:20:55 |
9 Mar 2022 |
| BonnieClaire joined the room. | 07:27:28 |
30 Mar 2022 |
| amewzing joined the room. | 04:10:29 |
2 Apr 2022 |
| ks684pbfgz joined the room. | 13:17:56 |
7 Apr 2022 |
| F F joined the room. | 16:17:02 |
18 Apr 2022 |
| ruanime joined the room. | 06:37:31 |
| @wybpip:matrix.org joined the room. | 09:10:36 |
| @wybpip:matrix.org left the room. | 09:10:37 |
1 May 2022 |
| @wybpip:matrix.org joined the room. | 19:14:31 |
| @wybpip:matrix.org left the room. | 19:14:32 |
6 May 2022 |
| @newchair:matrix.org joined the room. | 00:18:34 |
@newchair:matrix.org | If I have data like this:
{
"key": "2022-05-1",
"value": {
"Fajr": "4:51 %am%",
"Duha": "6:15 %am%",
"Dhuhr": "1:13 %pm%",
"Asr": "5:04 %pm%",
"Maghrib": "8:11 %pm%",
"Isha": "9:36 %pm%"
}
}
{
"key": "2022-05-2",
"value": {
"Fajr": "4:49 %am%",
"Duha": "6:14 %am%",
"Dhuhr": "1:13 %pm%",
"Asr": "5:04 %pm%",
"Maghrib": "8:12 %pm%",
"Isha": "9:37 %pm%"
}
}
how can I convert it to:
REM 2022-05-1 AT 4:51AM MSG Fajr
REM 2022-05-1 AT 6:15AM MSG Duha
REM 2022-05-1 AT 1:13PM MSG Dhuhar
REM 2022-05-1 AT 5:04PM MSG Asr
REM 2022-05-1 AT 8:11PM MSG Maghrib
REM 2022-05-1 AT 9:36AM MSG Isha
REM 2022-05-2 AT 4:49AM MSG Fajr
REM 2022-05-2 AT 6:14AM MSG Duha
...
...
using jq
| 00:39:45 |
@cheako:matrix.org | ppl are going to hate this suggestion, but it looks like an awk problem to me. | 00:49:54 |
@newchair:matrix.org | awk is fine too idc I just thought jq would be easier bcs its json | 03:11:38 |
7 May 2022 |
@newchair:matrix.org | I ended up doing it with python
#!/usr/bin/env python
import sys
import requests
import json
params = {
'user_ip': requests.get('http://ifconfig.so').text,
'show_entire_month': '1'
}
response = requests.get('http://www.islamicfinder.us/index.php/api/prayer_times', params=params)
data = json.loads(response.text)['results']
reminders = ""
for date in data:
for rem in data[date]:
time = data[date][rem].replace(str([c for c in '% ']), '').upper()
reminders += f"REM {date} AT {time} MSG {rem} time %2\n"
try:
with open(sys.argv[1], 'w') as f:
f.write(reminders)
except:
print(reminders, end="")
| 21:00:37 |
9 May 2022 |
| @vidaldf:matrix.org joined the room. | 03:36:22 |
| @vidaldf:matrix.org left the room. | 03:40:43 |
18 May 2022 |
| @akc3n:grapheneos.org joined the room. | 02:42:53 |
3 Jun 2022 |
| @_neb_wikipedia:matrix.org | 20:37:40 |
4 Jun 2022 |
| fomapan joined the room. | 21:24:37 |
14 Jun 2022 |
| @sblotgq067:matrix.org joined the room. | 06:32:35 |
15 Jun 2022 |
| @sblotgq067:matrix.org left the room. | 10:10:28 |
16 Jun 2022 |
| @z4lin:matrix.org joined the room. | 16:00:54 |
20 Jun 2022 |
| @better_sleeping:converser.eu joined the room. | 20:43:03 |
| @better_sleeping:converser.eu left the room. | 20:43:28 |
26 Jun 2022 |
| @z4lin:matrix.org changed their display name from zyyylj to no xd challenge. | 20:23:27 |