- Python 48.3%
- JavaScript 47.9%
- CSS 3.8%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
- Refresh file list now hashes files without a checksum, instead of hooking the thumbnail refresh, which is unavailable without thumbnail support - Checksum column in the Upload Manager is sortable - Drop the help cursor on the checksum badge - Convert the README to AsciiDoc and add a screenshot of the file list Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
| docs | ||
| octoprint_filehash | ||
| .gitignore | ||
| pyproject.toml | ||
| README.adoc | ||
OctoPrint-FileHash
An OctoPrint plugin that computes a CRC32 checksum for each G-code file in local storage, for use as a serial number for 3D prints.
Requires OctoPrint 2.0 or newer.
Features
-
File list: the first 4 characters of the checksum are shown next to each file name. The full 8-character checksum is listed in the file’s details.
-
Upload Manager: a sortable Checksum column shows the full checksum.
-
Search: the search boxes of the file list and the Upload Manager match checksum prefixes in addition to file names. Matching is case-insensitive, and a leading
#or0xis ignored.
Checksum
The checksum is a CRC32 over the file’s contents, formatted as 8 uppercase hexadecimal characters,
for example 3F9A0C12. Identical files have identical checksums.
The 4-character prefix has 65,536 possible values. The full checksum distinguishes between larger numbers of files.
When checksums are computed
-
When a file is uploaded, including when an upload overwrites an existing file.
-
When the file list is refreshed with its Refresh file list button. Only files without a checksum are hashed, such as files that were uploaded before the plugin was installed.
Copied and moved files keep their checksum.
Storage and API
Checksums are stored in OctoPrint’s file metadata under the filehash key. The files API
(GET /api/files) includes them for each G-code file:
"filehash": {"crc32": "3F9A0C12"}
The plugin’s API accepts a refresh command:
POST /api/plugin/filehash
Content-Type: application/json
{"command": "refresh", "path": "", "force": true, "recursive": true}
path-
File or folder in local storage; empty for the top-level folder.
force-
Recompute existing checksums. Without it, only missing checksums are computed.
recursive-
Include subfolders.
The response contains the number of files hashed, e.g. {"hashed": 3}. The command requires the
Upload files permission.
Limitations
-
Only files in OctoPrint’s local storage are hashed. Files on the printer’s SD card are not.
-
On OctoPrint 2.0.2, files placed in the uploads folder outside of OctoPrint (for example over a network share) do not receive a checksum, because OctoPrint does not store metadata for them.
Installation
From a checkout, inside OctoPrint’s Python environment:
pip install .
Restart OctoPrint afterwards.