Initial commit
Signed-off-by: William Brawner <me@wbrawner.com>
This commit is contained in:
commit
51e54a610b
2 changed files with 27 additions and 0 deletions
7
README.md
Normal file
7
README.md
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# gcal to ical Converter
|
||||||
|
|
||||||
|
This is a quick and dirty script to convert a Google Calendar link into an ical link that can be used in a Nextcloud calendar subscription for example.
|
||||||
|
|
||||||
|
|
||||||
|
Usage: ./gcal-to-ical.py <gcal-url>
|
||||||
|
|
20
gcal-to-ical.py
Executable file
20
gcal-to-ical.py
Executable file
|
@ -0,0 +1,20 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
from urllib.parse import urlparse,parse_qsl
|
||||||
|
import sys
|
||||||
|
from pprint import pprint
|
||||||
|
|
||||||
|
ICAL_FORMAT = 'https://calendar.google.com/calendar/ical/{}/public/basic.ics'
|
||||||
|
|
||||||
|
def main(cli_input):
|
||||||
|
gcal_url = o = urlparse(cli_input)
|
||||||
|
query_string = gcal_url.query
|
||||||
|
src = parse_qsl(query_string)
|
||||||
|
for pair in parse_qsl(query_string):
|
||||||
|
if pair[0] == 'src':
|
||||||
|
print(ICAL_FORMAT.format(pair[1]))
|
||||||
|
return
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main(sys.argv[1])
|
||||||
|
|
Loading…
Reference in a new issue