SyncBerry is a two-way calendar synchronization script designed specifically for macOS users. Crafted in AppleScript, it serves as a bridge between two distinct Apple Calendars, ensuring both are always up-to-date. Leveraging Python and the python-dateutil library, SyncBerry provides accurate handling of recurring events through RRULE parsing.
The script designates one calendar as the 'source' and the other as the 'destination,' reversing these roles for bi-directional synchronization. Before duplicating events, it removes prior script-generated entries by scanning the 'location' field for a unique ParentID. This ensures source integrity while enabling precise synchronization. Roles are then reversed to complete the two-way sync.
- Two-way synchronization between Apple Calendars
- Support for both single and recurring events
- Python-assisted RRULE parsing for nuanced recurrence patterns
- Customizable time window for synchronization
Make sure you are equipped with the following:
- macOS Catalina or later
- Python 3.x
- AppleScript :-)
- JSON Helper (AppleScript Library)
-
Clone the Repository:
git clone https://github.com/bartolli/syncberry.git
-
Set Up Virtual Environment:
Create a Python virtual environment named
.venv
in your project directory. You can do that in VS Code or PyCharm Activate the virtual environment and installpython-dateutil
with the following commands:source .venv/bin/activate pip install python-dateutil
-
Shell Script Permissions: Make
shell.sh
executable. Runchmod +x shell.sh
in the terminal. This script is your liaison to the Python virtual environment and is called each time RRULEs need parsing. -
Script Permissions: Once everything is set up, launch the script using Apple's Script Editor and execute it for the initial run. The script will request permission to access your Calendar and employ JSON Helper.
-
Run SyncBerry: With the preliminary configuration complete, execute 'osascript syncberry.applescript' to initiate the synchronization process. To automate this operation or convert it into a standalone application, consider using Automator.
The script provides a set of predefined variables that you can adjust to meet your specific needs. Customizing these variables allows the script to better fit your workflow and calendar setup.
Find this section in the AppleScript:
-- Constants: Our guiding stars
property calendarAName : "Work Sync"
property calendarBName : "Familie"
property timeScopeDays : 14
property pythonScriptPath : "/your_path/syncberry/vscode/shell.sh"
calendarAName
: The name of the first calendar you wish to sync.calendarBName
: The name of the second calendar you wish to sync.timeScopeDays
: The time scope, in days, for which the script should sync events. Configured by default to encompass a 14-day span: 7 days prior and 7 days forthcoming.pythonScriptPath
: The full path to the shell script which activates your Python virtual environment.
Note: Before diving in, create two new calendars specifically for testing. Confirm the script operates as intended. This ensures a safeguard for your existing schedules.
Edit the shell.sh
script to include your specific paths:
#!/bin/sh
source '/your_path/syncberry/vscode/.venv/bin/activate'
python /your_path/syncberry/vscode/main.py "$1"
Ensure that the paths to the virtual environment and Python script are correct.
Before running the script, make sure you have activated your Python virtual environment and installed the python-dateutil
package. This is essential as the shell script used by SyncBerry utilizes this package to parse RRULEs for recurring events.
To install the package, run:
pip install python-dateutil
Once installed, you're ready to utilize SyncBerry to its full potential.