Giter Club home page Giter Club logo

b2c's Introduction

b2c

Creates an iCalendar file with birthday events based on a vCard 3.0 vcf file with contact information.

What problem does it solve?

Birthday reminders is a good thing to have in a calendar. Unfortunately, fastmail, which I use, doesn't have a good support for them; it does have the birthdays calendar that's automatically generated from contacts data, but without any reminder options.

b2c is a tiny utility that generates a calendar file with the birthday events from an exported vCard 3.0 file. That calendar can then be imported to fastmail. Thus, it's a more customizable version of the automatic birthdays calendar, but involving more manual steps.

The calendar will have one event for each contact with birthday information; it will start in the year when the program is run and repeat yearly. The event details are currently hardcoded this way: the event title is "<full name>'s Birthday" and an event alert is at 07:00 that day (local time).

Building

  • Install Haskell stack using your package manager or the installer script.
  • git clone --recurse-submodules https://github.com/eunikolsky/b2c && cd b2c && stack build.

Running

Running stack install b2c will install the program to your local bin directory ($HOME/.local/bin by default, check with stack path --local-bin).

Now it's easy to feed your vCards vcf file into the program and save the output to a file:

$ b2c < ~/contacts.vcf > ~/birthdays.ics

That's it, no program options at the moment!

If there is an error parsing the input, the errors will be printed to stderr and the exit code will be 1:

$ echo -e "BEGIN:VCARD\nVERSION:3.0\nFN:Adam Ford\nBDAY;X-APPLE-OMIT-YEAR=1604:1604-01-01\nEND:VCARD\n" | b2c
5:10:
  |
5 | END:VCARD
  |          ^
vCard must have the N type
$ echo $?
1

The program has been manually tested on OS X, and should work on Linux too.

The Fastmail flow

Known issues

This initial version is a proof-of-concept, so there are known issues:

  • The vCard parser handles unfolding in a limited way, so not all vcf files can be parsed at this time.
  • The program doesn't parse any options to override the hardcoded settings (i.e., alert time, event title).
  • There are few unit tests.

Tests

stack test runs the unit tests.

Note: you can plug your own vcf file into the tests by creating a symlink called test/contacts.vcf pointing to your file:

$ ln -sv ~/Downloads/All\ Contacts.vcf test/contacts.vcf

If it's found, a unit test will verify that it is parsed correctly.

b2c's People

Contributors

eunikolsky avatar

Watchers

 avatar  avatar

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.