Skip to content

Commit

Permalink
add copyright and HK OBS copyright disclaim
Browse files Browse the repository at this point in the history
  • Loading branch information
infinet committed Feb 4, 2014
1 parent 9fb1fd2 commit 5c11e73
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 17 deletions.
22 changes: 22 additions & 0 deletions COPYRIGHT
@@ -0,0 +1,22 @@
Copyright (c) 2014, Chen Wei <weichen302@gmail.com>
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 changes: 21 additions & 15 deletions README.md
Expand Up @@ -4,24 +4,27 @@ Google, Apple, and Microsoft used to provide Chinese Lunar Calender in iCalender
format, but most links were died over years. It is become hard to find a usable
Chinese Lunar Calendar for use with online and offline calendar apps.

The Chinese Lunar Calender is mostly based on the motion of the Moon. It is said
the motion of Moon is very hard to predict, especially on the long run. Luckily
[Hong Kong Observatory] has published a convertion table for the period from
1901 to 2100. It is the most trustworthy Lunar Calender I can find on the web so
far.
The Chinese Lunar Calender is mostly based on the motion of the Moon. It is
said due to the complicate interaction, mostly from the Sun and the Earth, the
motion of Moon is very hard to predict, especially on the long run. Luckily
[Hong Kong Observatory][HK_Obs] has published a convertion table for the period
from 1901 to 2100. It is the most trustworthy Lunar Calender I can find on the
web so far.


### License

This package is released under the terms and conditions of the BSD License, a
copy of which is include in the file COPYRIGHT.

*Hong Kong Observatory* has been very kind to provide and grant the permission
of using their convertion table, which is only for Non-Commercial use.

### How to run

run `lunar_ical`, it will fetch data from [Hong Kong Observatory][HK_Obs], save the data
to a local sqlite database, then use that database to generate a ics file, which
covers from the previous to the end of next year.
run `lunar_ical`, it will fetch data from Hong Kong Observatory, save
the data to a local sqlite database, then use that database to generate a ics
file, which covers from the previous to the end of next year.

Try the Chinese Lunar Calendar by add this [ics file][iCal] to your favorite
calendar app.
Expand All @@ -38,16 +41,14 @@ The date must in ISO format.
iCalendar是一种通用的日历交换格式,很多软件和设备,比如google calendar, apple
calendar, thunderbird + lightning插件, iphone/ipad, 安卓都支持。

以前订过iCalendar格式农历日历,但慢慢地它们都停止了更新。所幸[香港天文台][HK_Obs]上可以
找到从1901年到2100年间两百年的农历-公历对照表,也就是这里用到的数据。
以前订过iCalendar格式农历日历,但慢慢地它们都停止了更新。所幸香港天文台为公众提供了从1901年到2100年间两百年的农历-公历对照表,也就是这里用到的数据。

下面是覆盖前年、今年以及明年三年的日历[ics文件][iCal]链接,把它加入到你最常用的软件
就可以了。
下面是覆盖前年、今年以及明年三年的日历[ics文件][iCal]链接,把它加入到你最常用的软件就可以了。

[https://raw.github.com/infinet/lunar-calender/master/chinese_lunar_prev_year_next_year.ics][iCal]

苹果设备上应该是:
设置 => 邮件、通讯录、日历 => 添加账户 => 日历 添加已订阅日历
设置 => 邮件、通讯录、日历 => 添加账户 => 其它 => 日历 添加已订阅日历

如果在Mac的*iCal*里订阅到iCloud,这个日历还可以自动推送到所有使用那个iCloud
账户的ios设备。
Expand All @@ -56,7 +57,7 @@ calendar, thunderbird + lightning插件, iphone/ipad, 安卓都支持。

### 生成更长时段农历

如果你需要更长时段的农历,可以下载`lunar_ical.py`
如果需要更长时段的农历,可以下载`lunar_ical.py`

直接运行`./lunar_ical.py`会从香港天文台抓取1901到2100年间所有数据,然后生成上面
那个前后三年时段的农历ics文件;
Expand All @@ -66,9 +67,14 @@ calendar, thunderbird + lightning插件, iphone/ipad, 安卓都支持。
./lunar_ical.py --start=2010-05-01 --end=2021-12-31


### 版权

本项目版权使用BSD协议,请参见所附COPYRIGHT文件。

感谢[香港天文台][HK_Obs]为公众提供并授权本项目使用农历-公历对照数据,该部分数据仅限非商业用途。


[Contact me](mailto: weichen302@gmail.com)

[iCal]: https://raw.github.com/infinet/lunar-calender/master/chinese_lunar_prev_year_next_year.ics
[HK_Obs]: http://gb.weather.gov.hk/gts/time/conversionc.htm
[HK_Obs]: http://data.weather.gov.hk/gts/time/conversion1_text_c.htm
9 changes: 7 additions & 2 deletions lunar_ical.py
@@ -1,7 +1,12 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

'''get lunar calendar from hk observatory '''
'''get lunar calendar from hk observatory
Hong Kong Observatory has been very kind to grant the permission for using the
lunar calendar data from their website.
'''

__license__ = 'BSD'
__copyright__ = '2014, Chen Wei <weichen302@gmail.com>'
Expand All @@ -24,7 +29,7 @@
DB_FILE = os.path.join(APPDIR, 'db', 'lunarcal.sqlite')
RE_CAL = re.compile(u'(\d{4})年(\d{1,2})月(\d{1,2})日')
PROXY = {'http': 'http://localhost:8001'}
URL = 'http://gb.weather.gov.hk/gts/time/calendar/text/T%dc.txt'
URL = 'http://data.weather.gov.hk/gts/time/calendar/text/T%dc.txt'
OUTPUT = os.path.join(APPDIR, 'chinese_lunar_%s_%s.ics')

ICAL_HEAD = ('BEGIN:VCALENDAR\n'
Expand Down

0 comments on commit 5c11e73

Please sign in to comment.