Code Monkey home page Code Monkey logo

sync-to-ical's Introduction

Sync to iCal

中文說明

The main function of Sync to iCal is to convert Events provided by an API into a format that can be used by calendar applications (iCalendar, .ical). It updates regularly and retains historical data. If the data is the same, it will not be duplicated.

Example data:

{"exposed":true,"firstEventStartAt":"2023-03-07T10:00:00Z","lastEventEndAt":"2023-07-31T10:00:00Z","events":
[
  {
    "id": "64bfae823878450b44c32370",
    "title": "T-hind S4 EP.8",
    "label": {
      "id": "640ff2df6018a516af970588",
      "name": "Thind",
      "color": "#F4BDA6"
    },
    "starAttendees": [],
    "linked": false,
    "createdAt": "2023-07-25T11:14:10.532Z",
    "startAt": "2023-08-29T10:00:00Z",
    "allDay": false
  },...]
}

Output ics:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
BEGIN:VEVENT
UID:64bfae823878450b44c32370
DTSTAMP:20230829T100000Z
DTSTART:20230829T100000Z
SUMMARY:T-hind S4 EP.8
DESCRIPTION:🟠 Thind
END:VEVENT
...
END:VCALENDAR

Features

  • Regularly fetch event data from a specific API
  • Convert the data to iCalendar (.ics) format
  • Provide an HTTP server for iCalendar to be read
  • Save the most recent data and compare it with the previous data. Only when the data changes, it will be updated.

How to Use

  1. Rename config.js.example to config.js, and replace the apiUrl with the API url you want to get
  2. Set cronSchedule to schedule regular updates. Use crontab format, such as: '0 */8 * * *'
  3. Start the program with node index.js
  4. The program will save the .ics format data in the /historydata folder
  5. The latest data can be accessed via http://localhost:[port]/calendar.ics

Requirements

  • Node.js (recommended version 12.20.0+)

Installation

  1. Download this project
  2. Install dependencies npm install

Startup

Use the node index.js command to start the application.

License

MIT

sync-to-ical's People

Contributors

scott1991 avatar

Watchers

 avatar

sync-to-ical's Issues

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.