A high-performance Rust implementation of The Best Damn Filename Parser You've Ever Used!
- Upstream PTT reference: https://github.com/dreulavelle/PTT
- Upstream RTN reference: https://github.com/dreulavelle/rank-torrent-name
- Fast
PTTparsing API for raw torrent names. RTNranking/filtering API with configurable quality rules.- Python-first usage (
from PTT import parse_title,from RTN import RTN). - Rust performance without changing your Python integration style.
uv add --editable /absolute/path/to/torrent-parse-rankuv add "torrent-parse-rank@git+https://github.com/g0ldyy/torrent-parse-rank"Notes:
- Installing from source requires a Rust toolchain (
cargo) available inPATH. - The import names are
PTTandRTN.
from PTT import parse_title
data = parse_title("The.Simpsons.S01E01.1080p.BluRay.x265", False)
print(data["title"]) # The Simpsons
print(data["resolution"]) # 1080pfrom RTN import RTN
from RTN.models import DefaultRanking, SettingsModel
rtn = RTN(SettingsModel(), DefaultRanking())
item = rtn.rank(
raw_title="The Walking Dead S05E03 720p x264-ASAP",
infohash="c08a9ee8ce3a5c2c08865e2b05406273cabc97e7",
)
print(item.fetch) # True/False after filters
print(item.rank) # computed rank score
print(item.data.parsed_title)from RTN import parse
parsed = parse("Oppenheimer.2023.2160p.REMUX.DV.HDR10Plus.TrueHD.7.1.HEVC")
print(parsed.resolution)
print(parsed.codec)cd torrent-parse-rank
uv sync --group dev
uv run maturin develop --releasecd torrent-parse-rank
./scripts/quality_gate.sh
./scripts/quality_gate.sh --full--full includes upstream parity tests.
Python API speedup vs upstream (PTT + RTN): ~3.20x geometric-mean throughput.
| Parser (N=30,000) | Upstream Python (items/s) | Rust port (items/s) | Speedup | Upstream p50 (ms) | Rust p50 (ms) |
|---|---|---|---|---|---|
PTT.parse_title |
1,832.2 | 5,763.9 | 3.15x | 0.550 | 0.173 |
RTN.parse |
1,726.1 | 5,446.9 | 3.16x | 0.583 | 0.183 |
Full benchmark report: benchmarks/README.md