Code Monkey home page Code Monkey logo

ics-merger's Introduction

Calendar merger

Suite of tools to merge multiple external calendars into a single view or a single file for importing.

Components

Package

dist/ical-merger*.js

Default export is a relatively simple function that merges multiple .ics files into one.

merge(inputs, options);
icals = [
	fs.readFileSync('cal.ics', 'utf8'),
	fs.readFileSync('another.ics', 'utf8')
];
merge(icals, {
	calname: 'Merged Calendar',
	timezone: 'America/Chicago',
	caldesc: 'Two calendars put together'
})

Calendar name, description, and timezone default to their respective values in the first calendar encountered (inputs[0]);

CLI tool

cli.js

A small wrapper for the underlying package.

ical-merge <filenames...>
CALNAME="Merged Calendar"\
TIMEZONE="America/Chicago"\
CALDESC="Two calendars put together"\
ical-merge cal.ics another.ics

Accepts filenames, options are set by environment variables. Output is sent to stdout.

Web service

dist/server.js

Web service that serves the calendar webapp and serves merged .ics files.

/combine.ics accepts an array of URLs to externally-hosted .ics files, and responds with the merged file. URLs are specified with PHP-style array syntax: ?urls[]=โ€ฆ.

Other /[ID].ics merged files are returned, based on the .env.json configuration file.

Webapp

public/**/*

Webapp that displays public calendars from Google Calendar in a single view. Uses FullCalendar heavily.

Webapp view

Requirements

.env.json

The web service and the webapp require configuration via .env.json in the project's root

{
	"GOOGLE_CALENDAR_API_KEY": "[API KEY]",
	"GOOGLE_ANALYTICS_TRACKING_ID": "[ID]",
	"calendars": {
		"cal1": {
			"calname": "Calendar 1",
			"caldesc": "Calendar 1 desc",
			"timezone": "America/Chicago",
			"color": "#462aa3",
			"googleCalendarId": "[ID]@group.calendar.google.com",
			"url": "https://calendar.google.com/calendar/ical/[ID]%40group.calendar.google.com/public/basic.ics"
		},
		"cal2": {
			"calname": "Calendar 2",
			"caldesc": "Calendar 2 desc",
			"timezone": "America/Chicago",
			"color": "#001f3f",
			"subCalendars": [
				{
					"calname": "Subcalendar 1",
					"caldesc": "Subcalendar 1 desc",
					"timezone": "America/Chicago",
					"color": "#0074D9",
					"googleCalendarId": "[ID]@group.calendar.google.com",
					"url": "https://calendar.google.com/calendar/ical/[ID]%40group.calendar.google.com/public/basic.ics"
				},
				{
					"calname": "Subcalendar 2",
					"caldesc": "Subcalendar 2 desc",
					"timezone": "America/Chicago",
					"color": "#7FDBFF",
					"googleCalendarId": "[ID]@group.calendar.google.com",
					"url": "https://calendar.google.com/calendar/ical/[ID]%40group.calendar.google.com/public/basic.ics"
				}
			]
		}
	},
	"calendarGroups": {
		"basic": {
			"calname": "Group Name",
			"caldesc": "Main calendar group",
			"timezone": "America/Chicago",
			"color": "#36a2eb",
			"calendars": [
				"cal1",
				"cal2"
			]
		}
	},
	"combine": {
		"calname": "Combined Calendar",
		"caldesc": "Combined calendar desc",
		"timezone": "America/Chicago"
	}
}

Webapp uses googleCalendarIds, web service uses urls.

FullCalendar instructions for Google Calendar API key and calendar IDs

Docker

Build

To build the Docker container run the following command in ./Docker:

  1. cd Docker
  2. cp example.env.json env.json
  3. (Edit env.json to your needs)
  4. docker build . -t ics-merger

Run

To run the tool in a Docker-container build it first then run:

docker run -p 80:3000 -d -v $PWD/env.json:/ics-merger/env.json:ro ics-merger

Where env.json is your configured file.

ics-merger's People

Contributors

8sd avatar jacobmischka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ics-merger's Issues

combine.ics examples?

Do you have any working combine.ics examples?

I'm trying to combine multiple ics calendars (with just "{}" as .env.json) but the output from getIcalsFromUrls is always empty.

Time zones not respected

After merging all text/calendar attachments from my inbox, I'm getting events which are overlapping and at the wrong time. I think this is because timezone information is not being considered when merging.

add prefix for combined calendars

What do you think about (optionally) prefixing events with a certain string, so that you can tell from which calendar they came from?

Cannot compile docker-container.

I get the follow error when "docker build . -t ics-merger":

Sending build context to Docker daemon   5.12kB
Step 1/7 : FROM node
 ---> 9c23a8242f8b
Step 2/7 : RUN git clone https://github.com/jacobmischka/ics-merger.git
 ---> Using cache
 ---> b5e461b89a1b
Step 3/7 : RUN cd /ics-merger && npm install && npm run-script build
 ---> Running in c36928a3f3e6
npm notice
npm notice New major version of npm available! 7.24.0 -> 8.1.0
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.1.0>
npm notice Run `npm install -g [email protected]` to update!
npm notice
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: @jacobmischka/[email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR!   react@"^17.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^15.4.2" from [email protected]
npm ERR! node_modules/react-addons-transition-group
npm ERR!   react-addons-transition-group@"^15.5.2" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /root/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-10-19T18_57_29_672Z-debug.log
The command '/bin/sh -c cd /ics-merger && npm install && npm run-script build' returned a non-zero code: 1

Please help.

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.