Skip to content
000henPublic

About

Browse and export the National Dong Hwa University (NDHU) academic calendar from your terminal.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

Repository files navigation

ndhucal

Rust libraries for the National Dong Hwa University (NDHU) academic calendar. They parse the official calendar page into dated, classified events and export them as iCalendar. Kotlin/Swift bindings come from UniFFI.

Path What it is
crates/ndhucal-core Event model, classification, HTML parser, iCalendar export
crates/ndhucal-ffi UniFFI bindings (library name ndhucal)
application/ndhucal-tui Terminal app: interactive calendar and CLI export (README)

The libraries don't fetch anything. Fetch CALENDAR_URL with your own HTTP client and pass the HTML to the parser.

Unofficial project. Always confirm important dates on the official page.

Install

Rust:

[dependencies]
ndhucal-core = { git = "https://github.com/000hen/ndhucal" }

Android/Kotlin: build the FFI library for your target, then generate bindings:

cargo ndk -t arm64-v8a build -p ndhucal-ffi --release
cargo run -p uniffi-bindgen -- generate --library target/aarch64-linux-android/release/libndhucal.so --language kotlin --out-dir out

To install the terminal app, see its README.

Usage

Rust:

let html = fetch(ndhucal_core::CALENDAR_URL)?;            // any HTTP client
let events = ndhucal_core::parse_events(&html)?;          // sorted, classified
let ics = ndhucal_core::ics::to_ics(&events);

Kotlin, with OkHttp:

val html = okHttp.newCall(Request.Builder().url(calendarUrl()).build()).execute().body!!.string()
val events: List<Event> = parseCalendar(html)             // throws NdhuCalException
val ics: String = eventsToIcs(events.filter { it.subcategory.isImportant() })

License

MIT. See LICENSE.

About

Browse and export the National Dong Hwa University (NDHU) academic calendar from your terminal.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages