Skip to main content

A command line tool written in Python 3 for creating lunar birthday events

Project description

lunar-birthday-ical

这是什么?

一个使用 Python 3 编写的用于创建农历生日事件的命令行工具.

lunar-birthday-ical 读入一个 YAML 配置文件, 生成 iCalendar 格式的 .ics 文件, 可选是否将日历上传到 pastebin, 方便直接订阅, 示例配置文件请参考 config/example-lunar-birthday.yaml, 注释应该足够能解释每个选项分别是什么含义.

可以使用 -h 或者 --help 选项查看命令行工具帮助信息,

$ lunar-birthday-ical -h
usage: lunar-birthday-ical [-h] [-o OUTPUT] input

Generate iCal events for lunar birthday and cycle days.

positional arguments:
  input                 input config.yaml, check config/example-lunar-birthday.yaml for example.

options:
  -h, --help            show this help message and exit
  -o OUTPUT, --output OUTPUT
                        Path to save the generated iCal file.

安装

推荐使用 pipx 来安装 Python 编写的命令行工具, 包括本项目,

$ pipx install lunar-birthday-ical
  installed package lunar-birthday-ical {{ version }}, installed using Python 3.11.2
  These apps are now globally available
    - lunar-birthday-ical
done! ✨ 🌟 ✨

$ lunar-birthday-ical config/example-lunar-birthday.yaml
[2025-01-25 12:17:05,137][lunar_birthday_ical.ical][INFO] iCal file saved to config/example-lunar-birthday.ics

关于 pastebin

在 YAML 配置文件中可选配置是否同时将生成的 .ics 文件同时上传 pastebin, 该 pastebin 实例是 repo owner 运行的一个基于 Cloudflare worker 的 pastebin 服务, 实例所使用的代码是 SharzyL/pastebin-worker.

如果选择启用 pastebin (pastebin.enabled), 在初次执行时, 可以保持 YAML 配置文件中的 pastebin.namepastebin.password 为空, 命令执行时会自动上传, 上传成功后可以将标准输出中 lunar_birthday_ical.pastebin 日志行的 admin 中由 : 分隔的 {{ pastebin.name }}{{ pastebin.password }} 手动填入配置文件, 这样下次再执行时就只会在原本的 URL 上更新, 而不会重新上传, 保持 URL 不变, 避免需要更新订阅日历的链接.

下方为启用 pastebin.enabled 后的命令行输出,

$ lunar-birthday-ical config/example-lunar-birthday.yaml
[2025-01-25 12:17:05,137][lunar_birthday_ical.ical][INFO] iCal file saved to config/example-lunar-birthday.ics
[2025-01-25 12:17:07,040][httpx][INFO] HTTP Request: POST https://komj.uk/ "HTTP/1.1 200 OK"
[2025-01-25 12:17:07,041][lunar_birthday_ical.pastebin][INFO] {'url': 'https://komj.uk/{{ pastebin.name }}', 'suggestUrl': 'https://komj.uk/{{ pastebin.name }}/example-lunar-birthday.ics', 'admin': 'https://komj.uk/{{ pastebin.name }}:{{ pastebin.password }}', 'isPrivate': True, 'expire': None}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lunar_birthday_ical-0.2.2.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lunar_birthday_ical-0.2.2-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file lunar_birthday_ical-0.2.2.tar.gz.

File metadata

  • Download URL: lunar_birthday_ical-0.2.2.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.22.3 CPython/3.13.1 Linux/6.8.0-1020-azure

File hashes

Hashes for lunar_birthday_ical-0.2.2.tar.gz
Algorithm Hash digest
SHA256 2d39a5991237ccf554164587d167a4f321cb346a9f13fa7ae38a5a5c49d0bb37
MD5 205decd3238da925d275b26999c00d13
BLAKE2b-256 b8b8ba2de7b09e78a21873f456b1a0efd8e5d85f84984bd49d4b75d57ad3bf96

See more details on using hashes here.

File details

Details for the file lunar_birthday_ical-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: lunar_birthday_ical-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.22.3 CPython/3.13.1 Linux/6.8.0-1020-azure

File hashes

Hashes for lunar_birthday_ical-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7d89198fefb0513ad2e1e06e9667bf09bb91a6cafb98bf83ca14d3f9135cccaf
MD5 2a33befba7ecea94819c5f76602c7f8b
BLAKE2b-256 22c2e0e77a47bab38fdda6b28200a811c5f72682d1fdcc4c4a371705ffd1e170

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page