Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hagemt/sv-transit-py
Python scripts for BART and Caltrain, etc.
https://github.com/hagemt/sv-transit-py
Last synced: about 1 month ago
JSON representation
Python scripts for BART and Caltrain, etc.
- Host: GitHub
- URL: https://github.com/hagemt/sv-transit-py
- Owner: hagemt
- License: mit
- Created: 2022-02-20T20:28:16.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-09-28T04:00:40.000Z (about 1 year ago)
- Last Synced: 2024-04-14T06:00:26.875Z (7 months ago)
- Language: Python
- Size: 265 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Python for BART and Caltrain
[![Tests](https://github.com/hagemt/sv-transit-py/actions/workflows/tests.yml/badge.svg)](https://github.com/hagemt/sv-transit-py/actions/workflows/tests.yml)
We may add other transit modes in future. (your contributions = welcome)
See [screenshots](#screenshots) below to understand potential use cases.
All supported OS/Python variants should be exercised through:
[GitHub Actions](https://github.com/hagemt/sv-transit-py/actions)## Setup
In an executable script named `ct` or `calt` for Caltrain:
```bash
#!/usr/bin/env bash
exec "${CALT:-/path/to/caltrain.py}" "$@"
```Put the file in your `PATH` for easy customization. For BART:
```bash
#!/usr/bin/env bash
exec "${BART_CLI:-/path/to/bart.py}" "$@"
```The best location on macOS is `/usr/local/bin` or `/opt/...` maybe.
Another option is to clone this repo and run the `make` targets for either.
### Releases
If someone actually files a request, I may publish dists of this repo.
The overhead of releases beyond GitHub is a lot for one author/maintainer.
In future: publish to PyPi, maybe Docker images, AUR (open Issue/PRs, please)
## Usage
NOTE: BART line colors may appear differently in your terminal than mine!
Caltrain stations have names like `millbrae` plus aliases I found useful.
```bash
# simplest operation, assumes both home and work:
$ ct
Caltrain #128 South Local in 17 min at Belmont
Caltrain #314 South Limited in 56 min at Belmont
Caltrain #130 South Local in 82 min at Belmont
Caltrain #311 North Limited in 4 min at Belmont
Caltrain #129 North Local in 42 min at Belmont
Caltrain #313 North Limited in 64 min at Belmont
Caltrain #128 South Local in 11 min at Hayward Park
Caltrain #130 South Local in 75 min at Hayward Park
Caltrain #132 South Local in 130 min at Hayward Park
Caltrain #129 North Local in 49 min at Hayward Park
Caltrain #131 North Local in 109 min at Hayward Park
Caltrain #133 North Local in 167 min at Hayward Park### advanced operation:
# calt rtt sf22 --fmt=json | jq
## ... or: pipe to grep, sort, etc.
```Set `CALT_HOME=belmont` and/or `CALT_WORK=hayward-park` as necessary.
### Screenshots
re: Caltrain, see examples above vs. all BART departures:
![image](https://user-images.githubusercontent.com/593274/160048897-14a79534-3f13-47a3-a270-ba449522a42a.png)