-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathat_ienc.py
More file actions
executable file
·33 lines (25 loc) · 953 Bytes
/
at_ienc.py
File metadata and controls
executable file
·33 lines (25 loc) · 953 Bytes
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
#!/usr/bin/python
"""Script to process the Atom feed of the Austrian IENC charts list and convert it to the XML catalog format
Part of the ChartCatalogs project
Copyright (c) 2024 Pavel Kalian
Licensed under GPLv2 or, at yoir will later version
"""
import sys
from ChartCatalogs.RncChartCatalog import RncChartCatalog
from ChartCatalogs.Chart import Chart
from datetime import datetime
import xml.etree.ElementTree as ET
import dateutil.parser
catalog = RncChartCatalog()
catalog.title = "AT IENC Charts"
xmldoc = ET.parse(sys.argv[1])
feed = xmldoc.getroot()
for entry in feed.find('channel').findall('item'):
chart = Chart()
chart.chart_format = 'Sailing Chart, International Chart'
chart.url = entry.find('link').text
chart.number = entry.find('guid').text
chart.title = entry.find('title').text
chart.zipfile_ts = dateutil.parser.parse(entry.find('pubDate').text)
catalog.add_chart(chart)
catalog.print_xml(True)