Giter Site home page Giter Site logo

ics_caldav_sync's Introduction

ICS to CalDAV synchronisation

Downloads a calendar in ICS format and uploads it to a CalDAV server, regularly. Your employee, school, or whoever shares a calendar as a link to an ICS file and you'd like to have it on another CalDAV server? Look no further.

Standalone usage

Install requirements from requirements.txt and run ics_caldav_sync.py file using Python 3.8 or higher.

There exist also Dockerfile and docker-compose.yml files so you can run it on your Docker server.

Set the settings as environment variables:

  • REMOTE_URL (str): ICS file URL.
  • LOCAL_URL (str): CalDAV URL.
  • LOCAL_CALENDAR_NAME (str): The name of your CalDAV calendar.
  • LOCAL_USERNAME (str): CalDAV username.
  • LOCAL_PASSWORD (str): CalDAV password.
  • REMOTE_USERNAME (str, optional): ICS host username.
  • REMOTE_PASSWORD (str, optional): ICS host password.
  • SYNC_EVERY (str): How often should the synchronisation occur? For example: 2 minutes, 1 hour. Synchronise once if empty.

Library usage

This script can be also used as a library in your Python script using ICSToCalDAVSync class and its synchronise method.

    def ICSToCalDAVSync.__init__(
        self,
        *,
        remote_url: str,
        local_url: str,
        local_calendar_name: str,
        local_username: str,
        local_password: str,
        remote_username: str = "",
        remote_password: str = "",
    )

    def ICSToCalDavSync.synchronise(self):
        """
        The main function which:
        1) Pulls all the events from the remote calendar,
        2) Saves them into the local calendar,
        3) Removes local events which are not in the remote any more.
        """

Rationale

In my case, my new shiny Bluetooth wristwatch, Casio Edifice ECB-10, did not support synchronisation with [https://support.apple.com/en-us/HT202361](calendar subscriptions). And so this script was created.

ics_caldav_sync's People

Contributors

przemub avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

ics_caldav_sync's Issues

Docker errors

Hi Przemysław, thanks for releasing this. I am using the docker container and getting errors while syncing a remote ICS feed with my Nextcloud.

  • Remote: Microsoft 365 feed
  • Local: Latest Nextcloud 28.0.3
  • Docker host: Ubuntu 22.04
  • Docker compose version: v2.20.3
  • Docker version: 24.0.5

My .env file:

REMOTE_URL: https://outlook.office365.com/owa/calendar/[email protected]/745ceeb327c140dc977ac05cd28ac18b6802823428239003014/calendar.ics
LOCAL_URL: https://<redacted>/remote.php/dav/
LOCAL_CALENDAR_NAME: Business
LOCAL_USERNAME: <redacted>
LOCAL_PASSWORD: <redacted>
SYNC_EVERY: 15 minutes

The error log:

/usr/local/lib/python3.11/site-packages/ics/component.py:85: FutureWarning: Behaviour of str(Component) will change in version 0.9 to only return a short description, NOT the ics representation. Use the explicit Component.serialize() to get the ics representation.
  warnings.warn(

The outcome:
No events are synchronized

Issues with arrow package while installation

I've installed newest Python and created a new virtualenv and tried to install all packages with

pip3.11 install -r requirements.txt

But it throws the arrow:

ERROR: Cannot install -r requirements.txt (line 5) and arrow==1.2.1 because these package versions have conflicting dependencies.

The conflict is caused by:
    The user requested arrow==1.2.1
    ics 0.7 depends on arrow<0.15 and >=0.11

Please add open source `LICENSE`

What a great script! Thanks for publishing it here. ❤️

However, right now there is no LICENSE file in this repository that is an open source license so it is difficult for me to learn from and utilize your amazing work. Could you follow these easy instructions in GitHub's documentation to choose and apply a proper open source license for this package, such as the GNU GPLv3. Otherwise, other people won't be allowed to study, share, and build on the code.

If it helps, I'm happy to submit a pull request with the needed changes. Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.