Re: [misc] adding LOCATION to import

Je Tue, 02 Oct 2018 17:16:24 +0200 skribis Lukas:
> On Tue, 02 Oct 2018 at 11:19:51, Marco van Hulten wrote:
> > I'm looking into FR#1, specifically importing the LOCATION property of
> > iCalendar files to the (anonymous) note to the respective event,
> > together with DESCRIPTION which is already saved there.  I simply
> > thought of
> > 
> >     strcat(note_content, "\n")
> >     strcat(note_content, description_from_ical_event)
> > 
> > even though there are more sophisticated ideas floating around on misc@.  
> 
> Thanks for looking into this. I do not like this way of implementing
> location imports for different reasons; one of the most important ones
> being that exporting such an imported iCal event yields something
> without location and with a modified note. Optimally, import-export
> should yield an iCal event equivalent to the original data. This is
> particularly important since iCal import/export is nowadays also used
> for CalDAV synchronization.

Agreed, if I stands for import from iCalendar and X for export, one
would want (I X)^n for any number n>=0 to have the same result
(idempotent).  But, as a practical short-term goal, I thought anyway to
see if I can make a simple change so that I can see the event's
LOCATION after an import.  That code should then of course not be used
for subsequent in-/exporting or CalDAV synchronisation.

> I think there was the idea of using special keywords (e.g. a separate
> paragraph with something like "Location: Nowhere" and possibly other
> headers) that have a special meaning when importing/exporting.

Yes, I was thinking of a YAML paragraph, so starting with "---\n", then
the lines between "BEGIN:VEVENT" and "END:VEVENT", followed by "...\n".
After this there could be additional text that should/would be ignored
by exports to iCalendar.  I'm not sure if that really makes sense,
because such notes after the YAML header may be thought of as comments
to the event or say a DESCRIPTION, but the latter would already be in
the YAML header!

> > Where in the code is the string after "SUMMARY:", "DESCRIPTION:" and so
> > on read?
> >   
> 
> I think it's part of ical_read_event().
> 
> > vevent.note is the hash/filename of the note.  Is there a variable for the note's content?  
> 
> No, ical_read_note() immediately generates a note file and only returns
> the hash, so you would have to rewrite that part of the import process.

Ah indeed, and there generate_note() is called which writes to the
file.  Maybe it becomes ugly if I modify that... I may look at this
later.

—Marco

Links