guessit-js 3.8.1 → 3.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -9,13 +9,13 @@ Extract metadata (title, year, season, episode, codec, language, etc.) from medi
9
9
 
10
10
  ## Features
11
11
 
12
- - **99.3% compatibility** with Python guessit (1018/1025 tests passing)
12
+ - **100% compatibility** with Python guessit (1035/1035 tests passing)
13
13
  - **3.5x faster** than Python (6.87ms vs 23.86ms per parse)
14
14
  - **40+ properties** detected: title, year, season, episode, resolution, codec, language, and more
15
15
  - **Single dependency** ([rebulk-js](https://www.npmjs.com/package/rebulk-js))
16
16
  - **Dual format**: ESM and CommonJS
17
17
  - **TypeScript**: full type definitions included
18
- - **WASM**: runs in any WASI-compatible runtime (wasmtime, wasmer, browsers)
18
+ - **WASM**: runs in any WASI-compatible runtime
19
19
 
20
20
  ## Install
21
21
 
@@ -29,8 +29,6 @@ npm install guessit-js
29
29
  import { guessit } from 'guessit-js';
30
30
 
31
31
  const result = guessit('The.Dark.Knight.2008.1080p.BluRay.x264-GROUP.mkv');
32
-
33
- console.log(result);
34
32
  // {
35
33
  // title: 'The Dark Knight',
36
34
  // year: 2008,
@@ -47,7 +45,6 @@ console.log(result);
47
45
 
48
46
  ```javascript
49
47
  const { guessit } = require('guessit-js');
50
-
51
48
  const result = guessit('Breaking.Bad.S01E02.720p.BluRay.x264-DEMAND.mkv');
52
49
  console.log(result.title); // 'Breaking Bad'
53
50
  console.log(result.season); // 1
@@ -57,20 +54,10 @@ console.log(result.episode); // 2
57
54
  ### Options
58
55
 
59
56
  ```typescript
60
- // Force type detection
61
57
  guessit('file.mkv', { type: 'episode' });
62
-
63
- // Provide expected title for ambiguous filenames
64
58
  guessit('my 720p show S01E02', { expected_title: ['my 720p show'] });
65
-
66
- // Restrict language/country detection
67
- guessit('file.mkv', { allowed_languages: ['en', 'fr'], allowed_countries: ['us', 'gb'] });
68
-
69
- // Exclude specific properties
59
+ guessit('file.mkv', { allowed_languages: ['en', 'fr'] });
70
60
  guessit('file.mkv', { excludes: ['release_group'] });
71
-
72
- // Name-only mode (ignore path separators)
73
- guessit('file.mkv', { name_only: true });
74
61
  ```
75
62
 
76
63
  ## Detected Properties
@@ -86,89 +73,32 @@ guessit('file.mkv', { name_only: true });
86
73
  | **Release** | `release_group`, `edition`, `other`, `proper_count` |
87
74
  | **File** | `container`, `mimetype`, `size`, `crc32`, `uuid` |
88
75
  | **Metadata** | `language`, `subtitle_language`, `country`, `type` |
89
- | **Film** | `film`, `film_title`, `bonus`, `bonus_title` |
90
76
 
91
77
  ## REST API
92
78
 
93
- Self-host the API server:
94
-
95
79
  ```bash
96
- npm start # starts on port 3847
97
- ```
80
+ npm start # port 3847
98
81
 
99
- ```bash
100
- # GET
101
82
  curl "http://localhost:3847/api/guessit?filename=Movie.2024.1080p.mkv"
102
-
103
- # POST with options
104
- curl -X POST http://localhost:3847/api/guessit \
105
- -H "Content-Type: application/json" \
106
- -d '{"filename": "file.mkv", "options": {"type": "movie"}}'
107
-
108
- # Swagger UI at http://localhost:3847/docs
109
- # OpenAPI spec at http://localhost:3847/openapi.json
110
83
  ```
111
84
 
112
85
  ## WASM
113
86
 
114
- guessit-js compiles to WebAssembly via [Javy](https://github.com/bytecodealliance/javy) (QuickJS):
87
+ Compiles to WebAssembly via [Javy](https://github.com/bytecodealliance/javy) (QuickJS engine). For non-JS environments (Rust, Go, C++, edge compute).
115
88
 
116
89
  ```bash
117
- # Build
118
90
  npm run wasm
119
-
120
- # Run (stdin/stdout JSON)
121
91
  echo '{"filename":"Movie.2024.1080p.mkv"}' | wasmtime wasm/guessit.wasm
122
92
  ```
123
93
 
124
- **3.9 MB** raw · **1.6 MB** gzipped · Compatible with wasmtime, wasmer, WasmEdge, browsers
125
-
126
94
  ## Performance
127
95
 
128
- Benchmark: 1000 parses of 10 diverse filenames on the same machine:
129
-
130
96
  | Runtime | ms/parse | vs Python |
131
97
  |---------|----------|-----------|
132
- | **Python 3** (guessit 3.8.0) | 23.86 ms | baseline |
133
- | **Node.js 22** (guessit-js 3.8.1) | 6.87 ms | **3.5x faster** |
134
-
135
- ## Compatibility
136
-
137
- Port of Python guessit v3.8.0. Test suite uses the same YAML fixtures:
138
-
139
- - `movies.yml` — 208 test cases
140
- - `episodes.yml` — 523 test cases
141
- - `various.yml` — 126 test cases
142
- - `streaming_services.yaml` — 197 test cases
143
-
144
- **1018 / 1025 passing** (99.3%)
145
-
146
- ## Architecture
147
-
148
- 4-layer design (~8,400 lines TypeScript across 46 source files):
149
-
150
- 1. **Public API** (`src/api.ts`) — GuessItApi class, config management
151
- 2. **Rebulk Engine** ([rebulk-js](https://www.npmjs.com/package/rebulk-js)) — generic pattern matching engine
152
- 3. **Rules & Properties** (`src/rules/`) — 25 property modules with post-processing rules
153
- 4. **Configuration** (`src/config/options.json`) — JSON-driven pattern definitions
154
-
155
- ## Self-hosting
156
-
157
- ```bash
158
- # Clone and install
159
- git clone https://github.com/opensubtitles/guessit-js
160
- cd guessit-js && npm install
161
-
162
- # Run server (port 3847)
163
- npm start
164
-
165
- # Run tests
166
- npm test
167
-
168
- # Build
169
- npm run build
170
- ```
98
+ | **Python 3.8** (guessit 3.8.0) | 23.86 ms | baseline |
99
+ | **Node.js 22** (guessit-js) | 6.87 ms | **3.5x faster** |
100
+ | **Browser** (IIFE bundle) | ~2-3 ms | **~10x faster** |
171
101
 
172
102
  ## License
173
103
 
174
- LGPL-3.0 — same as Python guessit.
104
+ LGPL-3.0