guessit-js 4.5.2 → 4.5.3
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 +17 -1
- package/bin/cli.mjs +51 -0
- package/dist/guessit-js.cjs +3 -0
- package/dist/guessit-js.cjs.map +1 -1
- package/dist/guessit-js.js +4 -1
- package/dist/guessit-js.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/package.json +15 -8
package/README.md
CHANGED
|
@@ -25,6 +25,18 @@ Extract metadata (title, year, season, episode, codec, language, etc.) from medi
|
|
|
25
25
|
npm install guessit-js
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
+
## CLI
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npx guessit-js "The.Dark.Knight.2008.1080p.BluRay.x264-GROUP.mkv"
|
|
32
|
+
# title: The Dark Knight
|
|
33
|
+
# year: 2008
|
|
34
|
+
# ...
|
|
35
|
+
|
|
36
|
+
npx guessit-js -j "Mob Psycho 100 - 09.mkv" # JSON output
|
|
37
|
+
npx guessit-js -t episode "ambiguous.file.mkv" # force type
|
|
38
|
+
```
|
|
39
|
+
|
|
28
40
|
## Usage
|
|
29
41
|
|
|
30
42
|
```typescript
|
|
@@ -67,6 +79,10 @@ guessit('file.mkv', { allowed_languages: ['en', 'fr'] });
|
|
|
67
79
|
guessit('file.mkv', { excludes: ['release_group'] });
|
|
68
80
|
```
|
|
69
81
|
|
|
82
|
+
```typescript
|
|
83
|
+
import { version } from 'guessit-js'; // package version string
|
|
84
|
+
```
|
|
85
|
+
|
|
70
86
|
## Detected Properties
|
|
71
87
|
|
|
72
88
|
| Category | Properties |
|
|
@@ -118,7 +134,7 @@ echo '{"filename":"Movie.2024.1080p.mkv"}' | wasmtime wasm/guessit.wasm
|
|
|
118
134
|
```
|
|
119
135
|
|
|
120
136
|
The WASM build is **bit-identical to the JS build** across the entire test corpus
|
|
121
|
-
(
|
|
137
|
+
(1035/1035, including accented titles) — verified by `test/wasm-full.test.ts`.
|
|
122
138
|
|
|
123
139
|
## Differences from Python guessit
|
|
124
140
|
|
package/bin/cli.mjs
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// guessit-js CLI — mirrors the Python `guessit` command.
|
|
3
|
+
// guessit-js <filename> [<filename> ...] property: value lines
|
|
4
|
+
// guessit-js -j <filename> JSON output
|
|
5
|
+
// guessit-js -t movie <filename> force type
|
|
6
|
+
import { guessit, version } from '../dist/guessit-js.js';
|
|
7
|
+
|
|
8
|
+
const args = process.argv.slice(2);
|
|
9
|
+
const filenames = [];
|
|
10
|
+
let json = false;
|
|
11
|
+
let type = null;
|
|
12
|
+
|
|
13
|
+
for (let i = 0; i < args.length; i++) {
|
|
14
|
+
const a = args[i];
|
|
15
|
+
if (a === '-j' || a === '--json') json = true;
|
|
16
|
+
else if (a === '-t' || a === '--type') type = args[++i];
|
|
17
|
+
else if (a === '-v' || a === '--version') {
|
|
18
|
+
console.log(version);
|
|
19
|
+
process.exit(0);
|
|
20
|
+
} else if (a === '-h' || a === '--help') {
|
|
21
|
+
console.log(`guessit-js ${version} — extract metadata from media filenames
|
|
22
|
+
|
|
23
|
+
Usage: guessit-js [options] <filename> [<filename> ...]
|
|
24
|
+
|
|
25
|
+
Options:
|
|
26
|
+
-j, --json output JSON (single object, or array for multiple files)
|
|
27
|
+
-t, --type <type> suggested type: movie or episode
|
|
28
|
+
-v, --version print version
|
|
29
|
+
-h, --help this help`);
|
|
30
|
+
process.exit(0);
|
|
31
|
+
} else filenames.push(a);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (!filenames.length) {
|
|
35
|
+
console.error('usage: guessit-js [options] <filename> — see --help');
|
|
36
|
+
process.exit(2);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const options = type ? { type } : {};
|
|
40
|
+
const results = filenames.map((f) => guessit(f, options));
|
|
41
|
+
|
|
42
|
+
if (json) {
|
|
43
|
+
console.log(JSON.stringify(filenames.length === 1 ? results[0] : results, null, 2));
|
|
44
|
+
} else {
|
|
45
|
+
results.forEach((r, i) => {
|
|
46
|
+
if (filenames.length > 1) console.log(`${i ? '\n' : ''}For: ${filenames[i]}`);
|
|
47
|
+
for (const [k, v] of Object.entries(r)) {
|
|
48
|
+
console.log(`${k}: ${Array.isArray(v) ? JSON.stringify(v) : v}`);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
package/dist/guessit-js.cjs
CHANGED
|
@@ -14516,6 +14516,8 @@ function configure(options, rulesBuilder, force = false) {
|
|
|
14516
14516
|
function reset() {
|
|
14517
14517
|
defaultApi.reset();
|
|
14518
14518
|
}
|
|
14519
|
+
const version$1 = "4.5.3";
|
|
14520
|
+
const version = version$1;
|
|
14519
14521
|
exports.GUESSIT_SCHEMA = GUESSIT_SCHEMA;
|
|
14520
14522
|
exports.GuessItApi = GuessItApi;
|
|
14521
14523
|
exports.GuessItException = GuessItException;
|
|
@@ -14528,4 +14530,5 @@ exports.parseOptions = parseOptions;
|
|
|
14528
14530
|
exports.properties = properties;
|
|
14529
14531
|
exports.rebulkBuilder = rebulkBuilder;
|
|
14530
14532
|
exports.reset = reset;
|
|
14533
|
+
exports.version = version;
|
|
14531
14534
|
//# sourceMappingURL=guessit-js.cjs.map
|