Metadata-Version: 2.4
Name: ehviewer-parser
Version: 0.1.0
Summary: Pure Python parser for Ehviewer .ehviewer SpiderInfo metadata and directory utilities
Author: ResidualBlood
License: MIT
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Provides-Extra: dev
Requires-Dist: pytest>=8.0.0; extra == "dev"

# ehviewer-parser

Pure Python library for parsing Ehviewer `.ehviewer` SpiderInfo metadata files and directory utilities.

## Features

- Parse Ehviewer SpiderInfo `VERSION1` and `VERSION2` files without external dependencies.
- Fault-tolerant parsing with structured warnings for malformed or incomplete entries.
- Utility functions for gallery directory handling:
  - `strip_gid_prefix`: Strip leading GID prefixes from gallery names/folders.
  - `natural_key`: Natural sort key for filenames with numeric sequences.

## Installation

```bash
pip install ehviewer-parser
```

Or for local development:

```bash
pip install -e .
```

## Quick Start

```python
from ehviewer_parser import parse_spider_info, strip_gid_prefix, natural_key

text = """VERSION2
0
123456
abcdef123456
0
1
20
2
0 abcdef0001
1 abcdef0002
"""

info = parse_spider_info(text)
print(f"GID: {info.gid}, Token: {info.token}, Pages: {info.pages}")
print(f"P-Tokens: {info.p_tokens}")

clean_name = strip_gid_prefix("123456 - My Gallery Title", gid=123456)
print(clean_name)  # "My Gallery Title"
```
