logseq-plugin-agenda icon indicating copy to clipboard operation
logseq-plugin-agenda copied to clipboard

Import .ics calendars

Open Aelfrik opened this issue 2 years ago • 6 comments

Hi, @haydenull !

I was exploring the plugin today, and I really loved all of the functionalities. My only issue to start using it would be that I have all of my calendar information in .ics files stored locally in my computer (since I use Thunderbird as a calendar app), instead of online calendars.

I saw that the plugin supports taking .ics documents from URLs, and other apps accept the "file:///..." notation as a URL to receive the path of a local .irc file, so I tried to do the same in the plugin, but it flagged the "file:///..." URL as invalid, so I guess it does not accept it. Since the plugin does import from online .ics already, it might not be too hard of a tweak, and it would prevent a lot of people like me from having to type in thousands of calendar entries by hand just to be able to use the plugin.

Do you think it could be possible for the plugin to import from a local .ics file, be it directly or via the "file:///..." URL?

Aelfrik avatar Aug 25 '22 22:08 Aelfrik

Thanks for the feedback, the next version will support file protocol.

haydenull avatar Aug 28 '22 23:08 haydenull

Version 2.8.0 can support local files.

haydenull avatar Sep 09 '22 00:09 haydenull

Thank you for your effort! If you don't mind me asking, though, how does it work now? I tried writing the "file:///..." address that would point to my local calendar .ics file in the URL section of the Subscription tab, but it didn't appear at the calendar, not even after reopening the plugin or restarting the whole programme. Seeing this, I'm afraid I may not understand how it is supposed to work now.

Aelfrik avatar Sep 09 '22 09:09 Aelfrik

file:///C:/Users/Hayden/Downloads/basic.ics

Are there any errors reported, or can you send an ics file for me to test?

haydenull avatar Sep 18 '22 23:09 haydenull

Is it possible to point to a directory? For example, if I an using vdirsyncer and have a folder containing all the ICS files? Alternatively, is it possible to point to a username/password protected radicale (CalDAV) server?

3lpsy avatar Feb 22 '23 02:02 3lpsy

For anyone using vdirsyncer / radicale / CalDAV, you can use vdirsyncer to create a single file ICS and point to that using the file:// protocol.

Here's a single file sync example that has 1 remote, 1 normal local synced copy, and 1 single file synced copy to be referenced by the plugin (replace the credentials section with your preferred method or just hardcode them without .fetch):

[general]
status_path = "~/.local/share/vdirsyncer/status/"

[pair local_and_single]
a = "single"
b = "local"
collections = ["from a", "from b"]
conflict_resolution = "b wins"

[pair remote_and_local]
a = "local"
b = "remote"
collections = ["from a", "from b"]

[storage single]
type = "singlefile"
path = "~/.local/share/vdirsyncer/single/%s.ics"

[storage local]
type = "filesystem"
path = "~/.local/share/vdirsyncer/local"
fileext = ".ics"

[storage remote]
type = "caldav"
url.fetch = ["command", "secret-tool", "lookup", "vdirsyncer", "url"]
username.fetch = ["command", "secret-tool", "lookup", "vdirsyncer", "username"]
password.fetch = ["command", "secret-tool", "lookup", "vdirsyncer", "password"]
item_types = ["VTODO", "VEVENT"]

Once synced, go into your single calendar directory and find the right calendar ICS. For me, this was just [theremotecalendardid].ics. This is the path to use (not the %s.ics path). There's a simpler way to set this up without the local storage with a filesystem but I needed that one for khal.

3lpsy avatar Feb 28 '23 16:02 3lpsy