Metadata-Version: 2.4
Name: autocrc
Version: 2.0.0
Summary: Automated CRC-checking
Author-email: Jonas Bengtsson <jonas@bengtsson.cc>
License-Expression: GPL-3.0-or-later
Project-URL: Homepage, https://github.com/ljb/autocrc
Project-URL: Changelog, https://github.com/ljb/autocrc/blob/master/CHANGELOG.md
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: ruff>=0.11; extra == "dev"
Requires-Dist: pytest>=8.4; extra == "dev"
Dynamic: license-file

# AutoCRC

autocrc uses 32-bit CRC-sums to verify the integrity of files. The CRC-sums are
parsed both from filenames and from sfv files.

autocrc can perform CRC-checks recursively. After it's done, it prints a
summary of the result.

### Prerequisites
Python 3.10 or later

### Installing
Install it with pip:
```
pip install autocrc
```

Or build and install from a checkout:
```
pip install .
```

### Examples of Usage
* To check the CRC of the files in the current directory: `autocrc`

* To check the CRC of the files recursively: `autocrc -r`

* To check the CRC of a specific file: `autocrc file[12345678].mkv`

* To check the CRCs specified in an sfv-file: `autocrc file.sfv`

* To check several files and directories at once: `autocrc file.sfv other[12345678].mkv some/dir`

A path that does not exist is an error, not something autocrc quietly skips:

```
$ autocrc typo.sfv
autocrc: typo.sfv: No such file or directory
```

### Exit Status
`autocrc` exits with a bitmask describing what went wrong:

| Value | Meaning |
| --- | --- |
| 0 | Everything OK |
| 1 | At least one CRC mismatch |
| 2 | At least one missing file |
| 4 | At least one read error, or a directory that could not be read during a recursive walk |
| 8 | A path given on the command line does not exist or could not be read |
| 130 | Interrupted with Ctrl-C |

### Development
```
python -m venv venv
source venv/bin/activate
python -m pip install -e '.[dev]'

pytest -q
ruff check
ruff format --check
```

There is also an end-to-end testbed that exercises the installed command against
real files -- permission bits, symlinks, a fifo, Windows-style sfv paths. It is
worth a pass before a release:

```
pipx install --force .
python testbed/build.py
testbed/run-scenarios.sh
```

See [testbed/README.md](testbed/README.md) for what each scenario covers.

### Changelog

See [CHANGELOG.md](CHANGELOG.md). Note that 2.0.0 contains breaking changes if you
are coming from 1.0.

### Notes

The way the output is formatted is heavily influenced by pure-sfv.

`Current directory:` headers are always absolute, and directories are visited in
sorted order, so the output of a run does not depend on how the paths were typed
or on the order the filesystem returns them.

`-q` reports only the directories in which something went wrong. A run in which
everything checks out prints nothing at all.

A directory that cannot be read during a recursive walk is reported on stderr and
then skipped, so the rest of the tree is still checked -- but the exit status says
that something was missed rather than claiming success.
