mirror of
https://github.com/infinet/lunar-calendar.git
synced 2026-01-12 13:15:28 +08:00
add copyright and HK OBS copyright disclaim
This commit is contained in:
22
COPYRIGHT
Normal file
22
COPYRIGHT
Normal file
@@ -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
README.md
36
README.md
@@ -4,11 +4,12 @@ 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
|
||||
@@ -16,12 +17,14 @@ far.
|
||||
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.
|
||||
@@ -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设备。
|
||||
@@ -56,7 +57,7 @@ calendar, thunderbird + lightning插件, iphone/ipad, 安卓都支持。
|
||||
|
||||
### 生成更长时段农历
|
||||
|
||||
如果你需要更长时段的农历,可以下载`lunar_ical.py`
|
||||
如果需要更长时段的农历,可以下载`lunar_ical.py`
|
||||
|
||||
直接运行`./lunar_ical.py`会从香港天文台抓取1901到2100年间所有数据,然后生成上面
|
||||
那个前后三年时段的农历ics文件;
|
||||
@@ -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
|
||||
|
||||
@@ -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>'
|
||||
@@ -24,7 +29,7 @@ APPDIR = os.path.abspath(os.path.dirname(__file__))
|
||||
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'
|
||||
|
||||
Reference in New Issue
Block a user