Commit 0c7fec10 authored by fuzzle's avatar fuzzle

some improvements like categories and geo and stuff

parent 25a86459
......@@ -42,6 +42,7 @@ sed -i '/END:VCALENDAR/d' $calendar
sed -i '1i METHOD:PUBLISH' $calendar
sed -i '1i CALSCALE:GREGORIAN' $calendar
sed -i '1i VERSION:2.0' $calendar
sed -i '1i PRODID:cccfr tacker.fr2ics script' $calendar
sed -i '1i BEGIN:VCALENDAR' $calendar
echo END:VCALENDAR >> $calendar
......
......@@ -95,6 +95,22 @@ except:
# geoics = geojson['leaflet']['leaflet-map']['features'][0]['lat']+";"+(geojson['leaflet']['leaflet-map']['features'][0]['lon']))
# get all categories
print len(soup.select(".field__item"))
#print (soup.select(".field__item"))
cat = []
for i in soup.select(".field__item"):
#find all categories
if "taxonomy/term" in str(i):
# check if its not None
if i.string:
# check if its already in list
if i.string not in cat:
cat.append(i.string)
#print i.string
#print i
## calendar magic
cal = Calendar()
event = Event()
......@@ -104,6 +120,10 @@ event.add('dtend', (datetime.strptime(xxdate, "%Y-%m-%dT%H:%M:%SZ") + timedelta(
# dtstamp should be "now"
# event.add('dtstamp', datetime(now, "%Y-%m-%dT%H:%M:%SZ"))
event.add('dtstamp', datetime.strptime(xxdate, "%Y-%m-%dT%H:%M:%SZ"))
event.add('transp', "TRANSPARENT")
event.add('tzid', "Europe/Berlin")
event.add('CATEGORIES', cat)
event.add('class', "PUBLIC")
event.add('description', xxdesc)
event.add('location', "\""+xxlocation+"\"")
# try add GEO Tag
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment