Metadata-Version: 2.4
Name: rtspfinder
Version: 1.4.1
Summary: Discover RTSP cameras on your LAN and auto-configure when only one device is present
Author: Esteban Rodriguez
License-Expression: MIT
Project-URL: Homepage, https://github.com/erodriguez/rtspfinder
Project-URL: Documentation, https://github.com/erodriguez/rtspfinder#readme
Project-URL: Repository, https://github.com/erodriguez/rtspfinder
Project-URL: Issues, https://github.com/erodriguez/rtspfinder/issues
Keywords: rtsp,camera,ip-camera,network,discovery,onvif,security
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: System :: Networking
Classifier: Topic :: Multimedia :: Video :: Capture
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: netifaces
Requires-Dist: netifaces>=0.11.0; extra == "netifaces"
Provides-Extra: dev
Requires-Dist: build>=1.0; extra == "dev"
Requires-Dist: netifaces>=0.11.0; extra == "dev"
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: twine>=4.0; extra == "dev"
Dynamic: license-file

# rtspfinder

Discover RTSP IP cameras on your local network, try common default credentials, and **automatically save configuration when exactly one device is found**.

`admin:123456` is tried first, followed by a built-in list of common camera usernames and passwords.

## Install

From PyPI:

```bash
pip install rtspfinder
```

From source:

```bash
pip install .
# optional: better multi-interface subnet detection
pip install rtspfinder[netifaces]
```

## Quick start (auto mode)

With no arguments, `rtspfinder`:

1. Uses saved config if present (`~/.config/rtspfinder/config.json`) and **connects to the stream**
2. Otherwise scans the LAN for RTSP (port 554)
3. If **one** RTSP host is found, probes paths/credentials, **writes config**, and **opens the stream**
4. If several hosts exist but **only one** authenticates, still auto-configures and connects

### In-terminal video (like [ani-cli](https://github.com/pystardust/ani-cli))

By default, when run from a TTY, video plays **inside the terminal** using mpv (`--vo=kitty`, `tct`, or `caca`) — same idea as ani-cli’s `--no-detach` in-terminal mpv.

```bash
brew install mpv ffmpeg    # required for TTY video
brew install chafa         # optional ASCII fallback
rtspfinder                 # discover → save → play in TTY
rtspfinder --tty           # force TTY even if auto-detection differs
rtspfinder --gui           # separate window (ffplay/mpv)
```

```bash
rtspfinder
```

Force a new scan:

```bash
rtspfinder --refresh
```

Print the saved URL for scripts:

```bash
rtspfinder --url
```

Skip auto-connect:

```bash
rtspfinder --no-connect
```

### Camera controls (YCC365 Plus / Ginatex HTTP + ONVIF)

Per [YCC365 docs](https://www.ycc365plus.com/en/ycc365-plus-camera-rtsp-url-address-and-port-number): HTTP **80**, RTSP **554**, ONVIF **80**.

Many of these cameras (including Ginatex/TAS-Tech firmware) expose **ONVIF PTZ over HTTP without auth** — same approach as the [PTZ-YCC365](https://github.com/fjramirez1987/PTZ-YCC365) Home Assistant component.

```bash
# Discover HTTP/ONVIF endpoints (uses saved config if present)
rtspfinder controls --discover-only --save

# Interactive PTZ in the terminal: w/a/s/d move, x stop, q quit
rtspfinder controls
```

## More commands

| Command | Description |
|---------|-------------|
| `rtspfinder --discover-only` | List hosts with port 554 open |
| `rtspfinder --host 192.168.1.100 -v` | Probe one camera |
| `rtspfinder --show-config` | Show saved configuration |
| `rtspfinder --no-auto` | Scan all hosts without auto-save rules |
| `rtspfinder --no-save` | Discover but do not write config file |

Config file permissions are set to `600` where supported.

## Python API

```python
from rtspfinder import auto_configure, load_config

result = auto_configure()
if result.configured:
    print(result.config.url)
```

## Security

Only use on networks and devices you own or are authorized to test. Change default camera passwords after setup.

## Publish to PyPI

```bash
pip install build twine
python -m build
twine check dist/*
twine upload dist/*
```

Use [PyPI API tokens](https://pypi.org/help/#apitoken); do not commit credentials.

## License

MIT — see [LICENSE](LICENSE).
