PYTHON=python
XSLTPROC=xsltproc

W=../..
WW=http://www.w3.org/
CAL=$(W)/2002/12/cal
SWAP=$(W)/2000/10/swap
DATA4=$(HOME)/projects/data4-uk
PALMAGENT=$(HOME)/projects/palmagent

ITIN=sou19
ITIN_TITLE="TAG Southampton Trip 2007-09 Connolly"

$(ITIN).ics: $(ITIN).rdf
	PYTHONPATH=$(SWAP):$(CAL) \
		$(PYTHON) $(SWAP)/pim/toIcal.py $(ITIN).rdf >$@

# el-cheapo GRDDL implementation...
ITINW=$(WW)/2007/07dc-lhr/$(ITIN)
$(ITIN).rdf: $(ITIN).html $(CAL)/glean-hcal.xsl
	$(XSLTPROC) --novalid --output ,1$@ \
		--stringparam Source $(ITINW) \
		$(CAL)/glean-hcal.xsl $(ITIN).html
	$(XSLTPROC) --novalid --output ,2$@ \
		--stringparam baseUri $(ITINW) \
		http://purl.org/NET/erdf/extract-rdf.xsl $(ITIN).html
	$(XSLTPROC) --novalid --output ,3$@ \
		http://www.w3.org/2006/vcard/hcard2rdf.xsl $(ITIN).html
	$(PYTHON) $(SWAP)/cwm.py ,1$@ ,2$@ ,3$@ --rdf >$@

$(ITIN).html: $(ITIN)-full.msg $(DATA4)/flightCal.py $(DATA4)/flttbl.xml
	$(PYTHON) $(DATA4)/flightCal.py --online $(ITIN_TITLE) \
		<$(ITIN)-full.msg >$@

# @@ should use icon string names from icon URIs
TRAVEL=15
pda-load: $(ITIN).rdf $(PALMAGENT)/hipAgent.py
	PYTHONPATH=$(SWAP) $(PYTHON) $(PALMAGENT)/hipAgent.py --icon $(TRAVEL) \
		--number=majo --client="Missing Sync" \
		--importRDF $(ITIN).rdf
