guessit-js 3.8.1 → 4.0.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 +97 -83
- package/dist/api.d.ts +3 -3
- package/dist/guessit-js.cjs +3236 -169
- package/dist/guessit-js.cjs.map +1 -1
- package/dist/guessit-js.js +3236 -169
- package/dist/guessit-js.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/rules/common/diacritics.d.ts +1 -0
- package/dist/rules/common/formatters.d.ts +13 -0
- package/dist/rules/properties/imdb.d.ts +3 -0
- package/dist/rules/properties/title.d.ts +0 -3
- package/dist/rules/properties/volume.d.ts +3 -0
- package/dist/schema.d.ts +75 -0
- package/package.json +7 -3
- package/dist/index.html +0 -675
- package/dist/openapi.json +0 -617
- package/dist/wasm-test.html +0 -467
package/dist/guessit-js.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
var _a;
|
|
4
5
|
function defaultFormatter(value) {
|
|
5
6
|
return value;
|
|
6
7
|
}
|
|
@@ -2238,7 +2239,7 @@ const WORD_NUMERALS = {
|
|
|
2238
2239
|
"trois": 3,
|
|
2239
2240
|
"quatre": 4,
|
|
2240
2241
|
"cinq": 5,
|
|
2241
|
-
|
|
2242
|
+
// 'six' is shared with the English list above (same spelling and value)
|
|
2242
2243
|
"sept": 7,
|
|
2243
2244
|
"huit": 8,
|
|
2244
2245
|
"neuf": 9,
|
|
@@ -2303,6 +2304,857 @@ function and_(...validators) {
|
|
|
2303
2304
|
function or_(...validators) {
|
|
2304
2305
|
return (m) => validators.some((v) => v(m));
|
|
2305
2306
|
}
|
|
2307
|
+
const DIACRITIC_FOLD = {
|
|
2308
|
+
"À": "A",
|
|
2309
|
+
"Á": "A",
|
|
2310
|
+
"Â": "A",
|
|
2311
|
+
"Ã": "A",
|
|
2312
|
+
"Ä": "A",
|
|
2313
|
+
"Å": "A",
|
|
2314
|
+
"Ç": "C",
|
|
2315
|
+
"È": "E",
|
|
2316
|
+
"É": "E",
|
|
2317
|
+
"Ê": "E",
|
|
2318
|
+
"Ë": "E",
|
|
2319
|
+
"Ì": "I",
|
|
2320
|
+
"Í": "I",
|
|
2321
|
+
"Î": "I",
|
|
2322
|
+
"Ï": "I",
|
|
2323
|
+
"Ñ": "N",
|
|
2324
|
+
"Ò": "O",
|
|
2325
|
+
"Ó": "O",
|
|
2326
|
+
"Ô": "O",
|
|
2327
|
+
"Õ": "O",
|
|
2328
|
+
"Ö": "O",
|
|
2329
|
+
"Ù": "U",
|
|
2330
|
+
"Ú": "U",
|
|
2331
|
+
"Û": "U",
|
|
2332
|
+
"Ü": "U",
|
|
2333
|
+
"Ý": "Y",
|
|
2334
|
+
"à": "a",
|
|
2335
|
+
"á": "a",
|
|
2336
|
+
"â": "a",
|
|
2337
|
+
"ã": "a",
|
|
2338
|
+
"ä": "a",
|
|
2339
|
+
"å": "a",
|
|
2340
|
+
"ç": "c",
|
|
2341
|
+
"è": "e",
|
|
2342
|
+
"é": "e",
|
|
2343
|
+
"ê": "e",
|
|
2344
|
+
"ë": "e",
|
|
2345
|
+
"ì": "i",
|
|
2346
|
+
"í": "i",
|
|
2347
|
+
"î": "i",
|
|
2348
|
+
"ï": "i",
|
|
2349
|
+
"ñ": "n",
|
|
2350
|
+
"ò": "o",
|
|
2351
|
+
"ó": "o",
|
|
2352
|
+
"ô": "o",
|
|
2353
|
+
"õ": "o",
|
|
2354
|
+
"ö": "o",
|
|
2355
|
+
"ù": "u",
|
|
2356
|
+
"ú": "u",
|
|
2357
|
+
"û": "u",
|
|
2358
|
+
"ü": "u",
|
|
2359
|
+
"ý": "y",
|
|
2360
|
+
"ÿ": "y",
|
|
2361
|
+
"Ā": "A",
|
|
2362
|
+
"ā": "a",
|
|
2363
|
+
"Ă": "A",
|
|
2364
|
+
"ă": "a",
|
|
2365
|
+
"Ą": "A",
|
|
2366
|
+
"ą": "a",
|
|
2367
|
+
"Ć": "C",
|
|
2368
|
+
"ć": "c",
|
|
2369
|
+
"Ĉ": "C",
|
|
2370
|
+
"ĉ": "c",
|
|
2371
|
+
"Ċ": "C",
|
|
2372
|
+
"ċ": "c",
|
|
2373
|
+
"Č": "C",
|
|
2374
|
+
"č": "c",
|
|
2375
|
+
"Ď": "D",
|
|
2376
|
+
"ď": "d",
|
|
2377
|
+
"Ē": "E",
|
|
2378
|
+
"ē": "e",
|
|
2379
|
+
"Ĕ": "E",
|
|
2380
|
+
"ĕ": "e",
|
|
2381
|
+
"Ė": "E",
|
|
2382
|
+
"ė": "e",
|
|
2383
|
+
"Ę": "E",
|
|
2384
|
+
"ę": "e",
|
|
2385
|
+
"Ě": "E",
|
|
2386
|
+
"ě": "e",
|
|
2387
|
+
"Ĝ": "G",
|
|
2388
|
+
"ĝ": "g",
|
|
2389
|
+
"Ğ": "G",
|
|
2390
|
+
"ğ": "g",
|
|
2391
|
+
"Ġ": "G",
|
|
2392
|
+
"ġ": "g",
|
|
2393
|
+
"Ģ": "G",
|
|
2394
|
+
"ģ": "g",
|
|
2395
|
+
"Ĥ": "H",
|
|
2396
|
+
"ĥ": "h",
|
|
2397
|
+
"Ĩ": "I",
|
|
2398
|
+
"ĩ": "i",
|
|
2399
|
+
"Ī": "I",
|
|
2400
|
+
"ī": "i",
|
|
2401
|
+
"Ĭ": "I",
|
|
2402
|
+
"ĭ": "i",
|
|
2403
|
+
"Į": "I",
|
|
2404
|
+
"į": "i",
|
|
2405
|
+
"İ": "I",
|
|
2406
|
+
"Ĵ": "J",
|
|
2407
|
+
"ĵ": "j",
|
|
2408
|
+
"Ķ": "K",
|
|
2409
|
+
"ķ": "k",
|
|
2410
|
+
"Ĺ": "L",
|
|
2411
|
+
"ĺ": "l",
|
|
2412
|
+
"Ļ": "L",
|
|
2413
|
+
"ļ": "l",
|
|
2414
|
+
"Ľ": "L",
|
|
2415
|
+
"ľ": "l",
|
|
2416
|
+
"Ń": "N",
|
|
2417
|
+
"ń": "n",
|
|
2418
|
+
"Ņ": "N",
|
|
2419
|
+
"ņ": "n",
|
|
2420
|
+
"Ň": "N",
|
|
2421
|
+
"ň": "n",
|
|
2422
|
+
"Ō": "O",
|
|
2423
|
+
"ō": "o",
|
|
2424
|
+
"Ŏ": "O",
|
|
2425
|
+
"ŏ": "o",
|
|
2426
|
+
"Ő": "O",
|
|
2427
|
+
"ő": "o",
|
|
2428
|
+
"Ŕ": "R",
|
|
2429
|
+
"ŕ": "r",
|
|
2430
|
+
"Ŗ": "R",
|
|
2431
|
+
"ŗ": "r",
|
|
2432
|
+
"Ř": "R",
|
|
2433
|
+
"ř": "r",
|
|
2434
|
+
"Ś": "S",
|
|
2435
|
+
"ś": "s",
|
|
2436
|
+
"Ŝ": "S",
|
|
2437
|
+
"ŝ": "s",
|
|
2438
|
+
"Ş": "S",
|
|
2439
|
+
"ş": "s",
|
|
2440
|
+
"Š": "S",
|
|
2441
|
+
"š": "s",
|
|
2442
|
+
"Ţ": "T",
|
|
2443
|
+
"ţ": "t",
|
|
2444
|
+
"Ť": "T",
|
|
2445
|
+
"ť": "t",
|
|
2446
|
+
"Ũ": "U",
|
|
2447
|
+
"ũ": "u",
|
|
2448
|
+
"Ū": "U",
|
|
2449
|
+
"ū": "u",
|
|
2450
|
+
"Ŭ": "U",
|
|
2451
|
+
"ŭ": "u",
|
|
2452
|
+
"Ů": "U",
|
|
2453
|
+
"ů": "u",
|
|
2454
|
+
"Ű": "U",
|
|
2455
|
+
"ű": "u",
|
|
2456
|
+
"Ų": "U",
|
|
2457
|
+
"ų": "u",
|
|
2458
|
+
"Ŵ": "W",
|
|
2459
|
+
"ŵ": "w",
|
|
2460
|
+
"Ŷ": "Y",
|
|
2461
|
+
"ŷ": "y",
|
|
2462
|
+
"Ÿ": "Y",
|
|
2463
|
+
"Ź": "Z",
|
|
2464
|
+
"ź": "z",
|
|
2465
|
+
"Ż": "Z",
|
|
2466
|
+
"ż": "z",
|
|
2467
|
+
"Ž": "Z",
|
|
2468
|
+
"ž": "z",
|
|
2469
|
+
"Ơ": "O",
|
|
2470
|
+
"ơ": "o",
|
|
2471
|
+
"Ư": "U",
|
|
2472
|
+
"ư": "u",
|
|
2473
|
+
"Ǎ": "A",
|
|
2474
|
+
"ǎ": "a",
|
|
2475
|
+
"Ǐ": "I",
|
|
2476
|
+
"ǐ": "i",
|
|
2477
|
+
"Ǒ": "O",
|
|
2478
|
+
"ǒ": "o",
|
|
2479
|
+
"Ǔ": "U",
|
|
2480
|
+
"ǔ": "u",
|
|
2481
|
+
"Ǖ": "U",
|
|
2482
|
+
"ǖ": "u",
|
|
2483
|
+
"Ǘ": "U",
|
|
2484
|
+
"ǘ": "u",
|
|
2485
|
+
"Ǚ": "U",
|
|
2486
|
+
"ǚ": "u",
|
|
2487
|
+
"Ǜ": "U",
|
|
2488
|
+
"ǜ": "u",
|
|
2489
|
+
"Ǟ": "A",
|
|
2490
|
+
"ǟ": "a",
|
|
2491
|
+
"Ǡ": "A",
|
|
2492
|
+
"ǡ": "a",
|
|
2493
|
+
"Ǣ": "Æ",
|
|
2494
|
+
"ǣ": "æ",
|
|
2495
|
+
"Ǧ": "G",
|
|
2496
|
+
"ǧ": "g",
|
|
2497
|
+
"Ǩ": "K",
|
|
2498
|
+
"ǩ": "k",
|
|
2499
|
+
"Ǫ": "O",
|
|
2500
|
+
"ǫ": "o",
|
|
2501
|
+
"Ǭ": "O",
|
|
2502
|
+
"ǭ": "o",
|
|
2503
|
+
"Ǯ": "Ʒ",
|
|
2504
|
+
"ǯ": "ʒ",
|
|
2505
|
+
"ǰ": "j",
|
|
2506
|
+
"Ǵ": "G",
|
|
2507
|
+
"ǵ": "g",
|
|
2508
|
+
"Ǹ": "N",
|
|
2509
|
+
"ǹ": "n",
|
|
2510
|
+
"Ǻ": "A",
|
|
2511
|
+
"ǻ": "a",
|
|
2512
|
+
"Ǽ": "Æ",
|
|
2513
|
+
"ǽ": "æ",
|
|
2514
|
+
"Ǿ": "Ø",
|
|
2515
|
+
"ǿ": "ø",
|
|
2516
|
+
"Ȁ": "A",
|
|
2517
|
+
"ȁ": "a",
|
|
2518
|
+
"Ȃ": "A",
|
|
2519
|
+
"ȃ": "a",
|
|
2520
|
+
"Ȅ": "E",
|
|
2521
|
+
"ȅ": "e",
|
|
2522
|
+
"Ȇ": "E",
|
|
2523
|
+
"ȇ": "e",
|
|
2524
|
+
"Ȉ": "I",
|
|
2525
|
+
"ȉ": "i",
|
|
2526
|
+
"Ȋ": "I",
|
|
2527
|
+
"ȋ": "i",
|
|
2528
|
+
"Ȍ": "O",
|
|
2529
|
+
"ȍ": "o",
|
|
2530
|
+
"Ȏ": "O",
|
|
2531
|
+
"ȏ": "o",
|
|
2532
|
+
"Ȑ": "R",
|
|
2533
|
+
"ȑ": "r",
|
|
2534
|
+
"Ȓ": "R",
|
|
2535
|
+
"ȓ": "r",
|
|
2536
|
+
"Ȕ": "U",
|
|
2537
|
+
"ȕ": "u",
|
|
2538
|
+
"Ȗ": "U",
|
|
2539
|
+
"ȗ": "u",
|
|
2540
|
+
"Ș": "S",
|
|
2541
|
+
"ș": "s",
|
|
2542
|
+
"Ț": "T",
|
|
2543
|
+
"ț": "t",
|
|
2544
|
+
"Ȟ": "H",
|
|
2545
|
+
"ȟ": "h",
|
|
2546
|
+
"Ȧ": "A",
|
|
2547
|
+
"ȧ": "a",
|
|
2548
|
+
"Ȩ": "E",
|
|
2549
|
+
"ȩ": "e",
|
|
2550
|
+
"Ȫ": "O",
|
|
2551
|
+
"ȫ": "o",
|
|
2552
|
+
"Ȭ": "O",
|
|
2553
|
+
"ȭ": "o",
|
|
2554
|
+
"Ȯ": "O",
|
|
2555
|
+
"ȯ": "o",
|
|
2556
|
+
"Ȱ": "O",
|
|
2557
|
+
"ȱ": "o",
|
|
2558
|
+
"Ȳ": "Y",
|
|
2559
|
+
"ȳ": "y",
|
|
2560
|
+
"΅": "¨",
|
|
2561
|
+
"Ά": "Α",
|
|
2562
|
+
"Έ": "Ε",
|
|
2563
|
+
"Ή": "Η",
|
|
2564
|
+
"Ί": "Ι",
|
|
2565
|
+
"Ό": "Ο",
|
|
2566
|
+
"Ύ": "Υ",
|
|
2567
|
+
"Ώ": "Ω",
|
|
2568
|
+
"ΐ": "ι",
|
|
2569
|
+
"Ϊ": "Ι",
|
|
2570
|
+
"Ϋ": "Υ",
|
|
2571
|
+
"ά": "α",
|
|
2572
|
+
"έ": "ε",
|
|
2573
|
+
"ή": "η",
|
|
2574
|
+
"ί": "ι",
|
|
2575
|
+
"ΰ": "υ",
|
|
2576
|
+
"ϊ": "ι",
|
|
2577
|
+
"ϋ": "υ",
|
|
2578
|
+
"ό": "ο",
|
|
2579
|
+
"ύ": "υ",
|
|
2580
|
+
"ώ": "ω",
|
|
2581
|
+
"ϓ": "ϒ",
|
|
2582
|
+
"ϔ": "ϒ",
|
|
2583
|
+
"Ѐ": "Е",
|
|
2584
|
+
"Ё": "Е",
|
|
2585
|
+
"Ѓ": "Г",
|
|
2586
|
+
"Ї": "І",
|
|
2587
|
+
"Ќ": "К",
|
|
2588
|
+
"Ѝ": "И",
|
|
2589
|
+
"Ў": "У",
|
|
2590
|
+
"Й": "И",
|
|
2591
|
+
"й": "и",
|
|
2592
|
+
"ѐ": "е",
|
|
2593
|
+
"ё": "е",
|
|
2594
|
+
"ѓ": "г",
|
|
2595
|
+
"ї": "і",
|
|
2596
|
+
"ќ": "к",
|
|
2597
|
+
"ѝ": "и",
|
|
2598
|
+
"ў": "у",
|
|
2599
|
+
"Ѷ": "Ѵ",
|
|
2600
|
+
"ѷ": "ѵ",
|
|
2601
|
+
"Ӂ": "Ж",
|
|
2602
|
+
"ӂ": "ж",
|
|
2603
|
+
"Ӑ": "А",
|
|
2604
|
+
"ӑ": "а",
|
|
2605
|
+
"Ӓ": "А",
|
|
2606
|
+
"ӓ": "а",
|
|
2607
|
+
"Ӗ": "Е",
|
|
2608
|
+
"ӗ": "е",
|
|
2609
|
+
"Ӛ": "Ә",
|
|
2610
|
+
"ӛ": "ә",
|
|
2611
|
+
"Ӝ": "Ж",
|
|
2612
|
+
"ӝ": "ж",
|
|
2613
|
+
"Ӟ": "З",
|
|
2614
|
+
"ӟ": "з",
|
|
2615
|
+
"Ӣ": "И",
|
|
2616
|
+
"ӣ": "и",
|
|
2617
|
+
"Ӥ": "И",
|
|
2618
|
+
"ӥ": "и",
|
|
2619
|
+
"Ӧ": "О",
|
|
2620
|
+
"ӧ": "о",
|
|
2621
|
+
"Ӫ": "Ө",
|
|
2622
|
+
"ӫ": "ө",
|
|
2623
|
+
"Ӭ": "Э",
|
|
2624
|
+
"ӭ": "э",
|
|
2625
|
+
"Ӯ": "У",
|
|
2626
|
+
"ӯ": "у",
|
|
2627
|
+
"Ӱ": "У",
|
|
2628
|
+
"ӱ": "у",
|
|
2629
|
+
"Ӳ": "У",
|
|
2630
|
+
"ӳ": "у",
|
|
2631
|
+
"Ӵ": "Ч",
|
|
2632
|
+
"ӵ": "ч",
|
|
2633
|
+
"Ӹ": "Ы",
|
|
2634
|
+
"ӹ": "ы",
|
|
2635
|
+
"Ḁ": "A",
|
|
2636
|
+
"ḁ": "a",
|
|
2637
|
+
"Ḃ": "B",
|
|
2638
|
+
"ḃ": "b",
|
|
2639
|
+
"Ḅ": "B",
|
|
2640
|
+
"ḅ": "b",
|
|
2641
|
+
"Ḇ": "B",
|
|
2642
|
+
"ḇ": "b",
|
|
2643
|
+
"Ḉ": "C",
|
|
2644
|
+
"ḉ": "c",
|
|
2645
|
+
"Ḋ": "D",
|
|
2646
|
+
"ḋ": "d",
|
|
2647
|
+
"Ḍ": "D",
|
|
2648
|
+
"ḍ": "d",
|
|
2649
|
+
"Ḏ": "D",
|
|
2650
|
+
"ḏ": "d",
|
|
2651
|
+
"Ḑ": "D",
|
|
2652
|
+
"ḑ": "d",
|
|
2653
|
+
"Ḓ": "D",
|
|
2654
|
+
"ḓ": "d",
|
|
2655
|
+
"Ḕ": "E",
|
|
2656
|
+
"ḕ": "e",
|
|
2657
|
+
"Ḗ": "E",
|
|
2658
|
+
"ḗ": "e",
|
|
2659
|
+
"Ḙ": "E",
|
|
2660
|
+
"ḙ": "e",
|
|
2661
|
+
"Ḛ": "E",
|
|
2662
|
+
"ḛ": "e",
|
|
2663
|
+
"Ḝ": "E",
|
|
2664
|
+
"ḝ": "e",
|
|
2665
|
+
"Ḟ": "F",
|
|
2666
|
+
"ḟ": "f",
|
|
2667
|
+
"Ḡ": "G",
|
|
2668
|
+
"ḡ": "g",
|
|
2669
|
+
"Ḣ": "H",
|
|
2670
|
+
"ḣ": "h",
|
|
2671
|
+
"Ḥ": "H",
|
|
2672
|
+
"ḥ": "h",
|
|
2673
|
+
"Ḧ": "H",
|
|
2674
|
+
"ḧ": "h",
|
|
2675
|
+
"Ḩ": "H",
|
|
2676
|
+
"ḩ": "h",
|
|
2677
|
+
"Ḫ": "H",
|
|
2678
|
+
"ḫ": "h",
|
|
2679
|
+
"Ḭ": "I",
|
|
2680
|
+
"ḭ": "i",
|
|
2681
|
+
"Ḯ": "I",
|
|
2682
|
+
"ḯ": "i",
|
|
2683
|
+
"Ḱ": "K",
|
|
2684
|
+
"ḱ": "k",
|
|
2685
|
+
"Ḳ": "K",
|
|
2686
|
+
"ḳ": "k",
|
|
2687
|
+
"Ḵ": "K",
|
|
2688
|
+
"ḵ": "k",
|
|
2689
|
+
"Ḷ": "L",
|
|
2690
|
+
"ḷ": "l",
|
|
2691
|
+
"Ḹ": "L",
|
|
2692
|
+
"ḹ": "l",
|
|
2693
|
+
"Ḻ": "L",
|
|
2694
|
+
"ḻ": "l",
|
|
2695
|
+
"Ḽ": "L",
|
|
2696
|
+
"ḽ": "l",
|
|
2697
|
+
"Ḿ": "M",
|
|
2698
|
+
"ḿ": "m",
|
|
2699
|
+
"Ṁ": "M",
|
|
2700
|
+
"ṁ": "m",
|
|
2701
|
+
"Ṃ": "M",
|
|
2702
|
+
"ṃ": "m",
|
|
2703
|
+
"Ṅ": "N",
|
|
2704
|
+
"ṅ": "n",
|
|
2705
|
+
"Ṇ": "N",
|
|
2706
|
+
"ṇ": "n",
|
|
2707
|
+
"Ṉ": "N",
|
|
2708
|
+
"ṉ": "n",
|
|
2709
|
+
"Ṋ": "N",
|
|
2710
|
+
"ṋ": "n",
|
|
2711
|
+
"Ṍ": "O",
|
|
2712
|
+
"ṍ": "o",
|
|
2713
|
+
"Ṏ": "O",
|
|
2714
|
+
"ṏ": "o",
|
|
2715
|
+
"Ṑ": "O",
|
|
2716
|
+
"ṑ": "o",
|
|
2717
|
+
"Ṓ": "O",
|
|
2718
|
+
"ṓ": "o",
|
|
2719
|
+
"Ṕ": "P",
|
|
2720
|
+
"ṕ": "p",
|
|
2721
|
+
"Ṗ": "P",
|
|
2722
|
+
"ṗ": "p",
|
|
2723
|
+
"Ṙ": "R",
|
|
2724
|
+
"ṙ": "r",
|
|
2725
|
+
"Ṛ": "R",
|
|
2726
|
+
"ṛ": "r",
|
|
2727
|
+
"Ṝ": "R",
|
|
2728
|
+
"ṝ": "r",
|
|
2729
|
+
"Ṟ": "R",
|
|
2730
|
+
"ṟ": "r",
|
|
2731
|
+
"Ṡ": "S",
|
|
2732
|
+
"ṡ": "s",
|
|
2733
|
+
"Ṣ": "S",
|
|
2734
|
+
"ṣ": "s",
|
|
2735
|
+
"Ṥ": "S",
|
|
2736
|
+
"ṥ": "s",
|
|
2737
|
+
"Ṧ": "S",
|
|
2738
|
+
"ṧ": "s",
|
|
2739
|
+
"Ṩ": "S",
|
|
2740
|
+
"ṩ": "s",
|
|
2741
|
+
"Ṫ": "T",
|
|
2742
|
+
"ṫ": "t",
|
|
2743
|
+
"Ṭ": "T",
|
|
2744
|
+
"ṭ": "t",
|
|
2745
|
+
"Ṯ": "T",
|
|
2746
|
+
"ṯ": "t",
|
|
2747
|
+
"Ṱ": "T",
|
|
2748
|
+
"ṱ": "t",
|
|
2749
|
+
"Ṳ": "U",
|
|
2750
|
+
"ṳ": "u",
|
|
2751
|
+
"Ṵ": "U",
|
|
2752
|
+
"ṵ": "u",
|
|
2753
|
+
"Ṷ": "U",
|
|
2754
|
+
"ṷ": "u",
|
|
2755
|
+
"Ṹ": "U",
|
|
2756
|
+
"ṹ": "u",
|
|
2757
|
+
"Ṻ": "U",
|
|
2758
|
+
"ṻ": "u",
|
|
2759
|
+
"Ṽ": "V",
|
|
2760
|
+
"ṽ": "v",
|
|
2761
|
+
"Ṿ": "V",
|
|
2762
|
+
"ṿ": "v",
|
|
2763
|
+
"Ẁ": "W",
|
|
2764
|
+
"ẁ": "w",
|
|
2765
|
+
"Ẃ": "W",
|
|
2766
|
+
"ẃ": "w",
|
|
2767
|
+
"Ẅ": "W",
|
|
2768
|
+
"ẅ": "w",
|
|
2769
|
+
"Ẇ": "W",
|
|
2770
|
+
"ẇ": "w",
|
|
2771
|
+
"Ẉ": "W",
|
|
2772
|
+
"ẉ": "w",
|
|
2773
|
+
"Ẋ": "X",
|
|
2774
|
+
"ẋ": "x",
|
|
2775
|
+
"Ẍ": "X",
|
|
2776
|
+
"ẍ": "x",
|
|
2777
|
+
"Ẏ": "Y",
|
|
2778
|
+
"ẏ": "y",
|
|
2779
|
+
"Ẑ": "Z",
|
|
2780
|
+
"ẑ": "z",
|
|
2781
|
+
"Ẓ": "Z",
|
|
2782
|
+
"ẓ": "z",
|
|
2783
|
+
"Ẕ": "Z",
|
|
2784
|
+
"ẕ": "z",
|
|
2785
|
+
"ẖ": "h",
|
|
2786
|
+
"ẗ": "t",
|
|
2787
|
+
"ẘ": "w",
|
|
2788
|
+
"ẙ": "y",
|
|
2789
|
+
"ẛ": "ſ",
|
|
2790
|
+
"Ạ": "A",
|
|
2791
|
+
"ạ": "a",
|
|
2792
|
+
"Ả": "A",
|
|
2793
|
+
"ả": "a",
|
|
2794
|
+
"Ấ": "A",
|
|
2795
|
+
"ấ": "a",
|
|
2796
|
+
"Ầ": "A",
|
|
2797
|
+
"ầ": "a",
|
|
2798
|
+
"Ẩ": "A",
|
|
2799
|
+
"ẩ": "a",
|
|
2800
|
+
"Ẫ": "A",
|
|
2801
|
+
"ẫ": "a",
|
|
2802
|
+
"Ậ": "A",
|
|
2803
|
+
"ậ": "a",
|
|
2804
|
+
"Ắ": "A",
|
|
2805
|
+
"ắ": "a",
|
|
2806
|
+
"Ằ": "A",
|
|
2807
|
+
"ằ": "a",
|
|
2808
|
+
"Ẳ": "A",
|
|
2809
|
+
"ẳ": "a",
|
|
2810
|
+
"Ẵ": "A",
|
|
2811
|
+
"ẵ": "a",
|
|
2812
|
+
"Ặ": "A",
|
|
2813
|
+
"ặ": "a",
|
|
2814
|
+
"Ẹ": "E",
|
|
2815
|
+
"ẹ": "e",
|
|
2816
|
+
"Ẻ": "E",
|
|
2817
|
+
"ẻ": "e",
|
|
2818
|
+
"Ẽ": "E",
|
|
2819
|
+
"ẽ": "e",
|
|
2820
|
+
"Ế": "E",
|
|
2821
|
+
"ế": "e",
|
|
2822
|
+
"Ề": "E",
|
|
2823
|
+
"ề": "e",
|
|
2824
|
+
"Ể": "E",
|
|
2825
|
+
"ể": "e",
|
|
2826
|
+
"Ễ": "E",
|
|
2827
|
+
"ễ": "e",
|
|
2828
|
+
"Ệ": "E",
|
|
2829
|
+
"ệ": "e",
|
|
2830
|
+
"Ỉ": "I",
|
|
2831
|
+
"ỉ": "i",
|
|
2832
|
+
"Ị": "I",
|
|
2833
|
+
"ị": "i",
|
|
2834
|
+
"Ọ": "O",
|
|
2835
|
+
"ọ": "o",
|
|
2836
|
+
"Ỏ": "O",
|
|
2837
|
+
"ỏ": "o",
|
|
2838
|
+
"Ố": "O",
|
|
2839
|
+
"ố": "o",
|
|
2840
|
+
"Ồ": "O",
|
|
2841
|
+
"ồ": "o",
|
|
2842
|
+
"Ổ": "O",
|
|
2843
|
+
"ổ": "o",
|
|
2844
|
+
"Ỗ": "O",
|
|
2845
|
+
"ỗ": "o",
|
|
2846
|
+
"Ộ": "O",
|
|
2847
|
+
"ộ": "o",
|
|
2848
|
+
"Ớ": "O",
|
|
2849
|
+
"ớ": "o",
|
|
2850
|
+
"Ờ": "O",
|
|
2851
|
+
"ờ": "o",
|
|
2852
|
+
"Ở": "O",
|
|
2853
|
+
"ở": "o",
|
|
2854
|
+
"Ỡ": "O",
|
|
2855
|
+
"ỡ": "o",
|
|
2856
|
+
"Ợ": "O",
|
|
2857
|
+
"ợ": "o",
|
|
2858
|
+
"Ụ": "U",
|
|
2859
|
+
"ụ": "u",
|
|
2860
|
+
"Ủ": "U",
|
|
2861
|
+
"ủ": "u",
|
|
2862
|
+
"Ứ": "U",
|
|
2863
|
+
"ứ": "u",
|
|
2864
|
+
"Ừ": "U",
|
|
2865
|
+
"ừ": "u",
|
|
2866
|
+
"Ử": "U",
|
|
2867
|
+
"ử": "u",
|
|
2868
|
+
"Ữ": "U",
|
|
2869
|
+
"ữ": "u",
|
|
2870
|
+
"Ự": "U",
|
|
2871
|
+
"ự": "u",
|
|
2872
|
+
"Ỳ": "Y",
|
|
2873
|
+
"ỳ": "y",
|
|
2874
|
+
"Ỵ": "Y",
|
|
2875
|
+
"ỵ": "y",
|
|
2876
|
+
"Ỷ": "Y",
|
|
2877
|
+
"ỷ": "y",
|
|
2878
|
+
"Ỹ": "Y",
|
|
2879
|
+
"ỹ": "y",
|
|
2880
|
+
"ἀ": "α",
|
|
2881
|
+
"ἁ": "α",
|
|
2882
|
+
"ἂ": "α",
|
|
2883
|
+
"ἃ": "α",
|
|
2884
|
+
"ἄ": "α",
|
|
2885
|
+
"ἅ": "α",
|
|
2886
|
+
"ἆ": "α",
|
|
2887
|
+
"ἇ": "α",
|
|
2888
|
+
"Ἀ": "Α",
|
|
2889
|
+
"Ἁ": "Α",
|
|
2890
|
+
"Ἂ": "Α",
|
|
2891
|
+
"Ἃ": "Α",
|
|
2892
|
+
"Ἄ": "Α",
|
|
2893
|
+
"Ἅ": "Α",
|
|
2894
|
+
"Ἆ": "Α",
|
|
2895
|
+
"Ἇ": "Α",
|
|
2896
|
+
"ἐ": "ε",
|
|
2897
|
+
"ἑ": "ε",
|
|
2898
|
+
"ἒ": "ε",
|
|
2899
|
+
"ἓ": "ε",
|
|
2900
|
+
"ἔ": "ε",
|
|
2901
|
+
"ἕ": "ε",
|
|
2902
|
+
"Ἐ": "Ε",
|
|
2903
|
+
"Ἑ": "Ε",
|
|
2904
|
+
"Ἒ": "Ε",
|
|
2905
|
+
"Ἓ": "Ε",
|
|
2906
|
+
"Ἔ": "Ε",
|
|
2907
|
+
"Ἕ": "Ε",
|
|
2908
|
+
"ἠ": "η",
|
|
2909
|
+
"ἡ": "η",
|
|
2910
|
+
"ἢ": "η",
|
|
2911
|
+
"ἣ": "η",
|
|
2912
|
+
"ἤ": "η",
|
|
2913
|
+
"ἥ": "η",
|
|
2914
|
+
"ἦ": "η",
|
|
2915
|
+
"ἧ": "η",
|
|
2916
|
+
"Ἠ": "Η",
|
|
2917
|
+
"Ἡ": "Η",
|
|
2918
|
+
"Ἢ": "Η",
|
|
2919
|
+
"Ἣ": "Η",
|
|
2920
|
+
"Ἤ": "Η",
|
|
2921
|
+
"Ἥ": "Η",
|
|
2922
|
+
"Ἦ": "Η",
|
|
2923
|
+
"Ἧ": "Η",
|
|
2924
|
+
"ἰ": "ι",
|
|
2925
|
+
"ἱ": "ι",
|
|
2926
|
+
"ἲ": "ι",
|
|
2927
|
+
"ἳ": "ι",
|
|
2928
|
+
"ἴ": "ι",
|
|
2929
|
+
"ἵ": "ι",
|
|
2930
|
+
"ἶ": "ι",
|
|
2931
|
+
"ἷ": "ι",
|
|
2932
|
+
"Ἰ": "Ι",
|
|
2933
|
+
"Ἱ": "Ι",
|
|
2934
|
+
"Ἲ": "Ι",
|
|
2935
|
+
"Ἳ": "Ι",
|
|
2936
|
+
"Ἴ": "Ι",
|
|
2937
|
+
"Ἵ": "Ι",
|
|
2938
|
+
"Ἶ": "Ι",
|
|
2939
|
+
"Ἷ": "Ι",
|
|
2940
|
+
"ὀ": "ο",
|
|
2941
|
+
"ὁ": "ο",
|
|
2942
|
+
"ὂ": "ο",
|
|
2943
|
+
"ὃ": "ο",
|
|
2944
|
+
"ὄ": "ο",
|
|
2945
|
+
"ὅ": "ο",
|
|
2946
|
+
"Ὀ": "Ο",
|
|
2947
|
+
"Ὁ": "Ο",
|
|
2948
|
+
"Ὂ": "Ο",
|
|
2949
|
+
"Ὃ": "Ο",
|
|
2950
|
+
"Ὄ": "Ο",
|
|
2951
|
+
"Ὅ": "Ο",
|
|
2952
|
+
"ὐ": "υ",
|
|
2953
|
+
"ὑ": "υ",
|
|
2954
|
+
"ὒ": "υ",
|
|
2955
|
+
"ὓ": "υ",
|
|
2956
|
+
"ὔ": "υ",
|
|
2957
|
+
"ὕ": "υ",
|
|
2958
|
+
"ὖ": "υ",
|
|
2959
|
+
"ὗ": "υ",
|
|
2960
|
+
"Ὑ": "Υ",
|
|
2961
|
+
"Ὓ": "Υ",
|
|
2962
|
+
"Ὕ": "Υ",
|
|
2963
|
+
"Ὗ": "Υ",
|
|
2964
|
+
"ὠ": "ω",
|
|
2965
|
+
"ὡ": "ω",
|
|
2966
|
+
"ὢ": "ω",
|
|
2967
|
+
"ὣ": "ω",
|
|
2968
|
+
"ὤ": "ω",
|
|
2969
|
+
"ὥ": "ω",
|
|
2970
|
+
"ὦ": "ω",
|
|
2971
|
+
"ὧ": "ω",
|
|
2972
|
+
"Ὠ": "Ω",
|
|
2973
|
+
"Ὡ": "Ω",
|
|
2974
|
+
"Ὢ": "Ω",
|
|
2975
|
+
"Ὣ": "Ω",
|
|
2976
|
+
"Ὤ": "Ω",
|
|
2977
|
+
"Ὥ": "Ω",
|
|
2978
|
+
"Ὦ": "Ω",
|
|
2979
|
+
"Ὧ": "Ω",
|
|
2980
|
+
"ὰ": "α",
|
|
2981
|
+
"ά": "α",
|
|
2982
|
+
"ὲ": "ε",
|
|
2983
|
+
"έ": "ε",
|
|
2984
|
+
"ὴ": "η",
|
|
2985
|
+
"ή": "η",
|
|
2986
|
+
"ὶ": "ι",
|
|
2987
|
+
"ί": "ι",
|
|
2988
|
+
"ὸ": "ο",
|
|
2989
|
+
"ό": "ο",
|
|
2990
|
+
"ὺ": "υ",
|
|
2991
|
+
"ύ": "υ",
|
|
2992
|
+
"ὼ": "ω",
|
|
2993
|
+
"ώ": "ω",
|
|
2994
|
+
"ᾀ": "α",
|
|
2995
|
+
"ᾁ": "α",
|
|
2996
|
+
"ᾂ": "α",
|
|
2997
|
+
"ᾃ": "α",
|
|
2998
|
+
"ᾄ": "α",
|
|
2999
|
+
"ᾅ": "α",
|
|
3000
|
+
"ᾆ": "α",
|
|
3001
|
+
"ᾇ": "α",
|
|
3002
|
+
"ᾈ": "Α",
|
|
3003
|
+
"ᾉ": "Α",
|
|
3004
|
+
"ᾊ": "Α",
|
|
3005
|
+
"ᾋ": "Α",
|
|
3006
|
+
"ᾌ": "Α",
|
|
3007
|
+
"ᾍ": "Α",
|
|
3008
|
+
"ᾎ": "Α",
|
|
3009
|
+
"ᾏ": "Α",
|
|
3010
|
+
"ᾐ": "η",
|
|
3011
|
+
"ᾑ": "η",
|
|
3012
|
+
"ᾒ": "η",
|
|
3013
|
+
"ᾓ": "η",
|
|
3014
|
+
"ᾔ": "η",
|
|
3015
|
+
"ᾕ": "η",
|
|
3016
|
+
"ᾖ": "η",
|
|
3017
|
+
"ᾗ": "η",
|
|
3018
|
+
"ᾘ": "Η",
|
|
3019
|
+
"ᾙ": "Η",
|
|
3020
|
+
"ᾚ": "Η",
|
|
3021
|
+
"ᾛ": "Η",
|
|
3022
|
+
"ᾜ": "Η",
|
|
3023
|
+
"ᾝ": "Η",
|
|
3024
|
+
"ᾞ": "Η",
|
|
3025
|
+
"ᾟ": "Η",
|
|
3026
|
+
"ᾠ": "ω",
|
|
3027
|
+
"ᾡ": "ω",
|
|
3028
|
+
"ᾢ": "ω",
|
|
3029
|
+
"ᾣ": "ω",
|
|
3030
|
+
"ᾤ": "ω",
|
|
3031
|
+
"ᾥ": "ω",
|
|
3032
|
+
"ᾦ": "ω",
|
|
3033
|
+
"ᾧ": "ω",
|
|
3034
|
+
"ᾨ": "Ω",
|
|
3035
|
+
"ᾩ": "Ω",
|
|
3036
|
+
"ᾪ": "Ω",
|
|
3037
|
+
"ᾫ": "Ω",
|
|
3038
|
+
"ᾬ": "Ω",
|
|
3039
|
+
"ᾭ": "Ω",
|
|
3040
|
+
"ᾮ": "Ω",
|
|
3041
|
+
"ᾯ": "Ω",
|
|
3042
|
+
"ᾰ": "α",
|
|
3043
|
+
"ᾱ": "α",
|
|
3044
|
+
"ᾲ": "α",
|
|
3045
|
+
"ᾳ": "α",
|
|
3046
|
+
"ᾴ": "α",
|
|
3047
|
+
"ᾶ": "α",
|
|
3048
|
+
"ᾷ": "α",
|
|
3049
|
+
"Ᾰ": "Α",
|
|
3050
|
+
"Ᾱ": "Α",
|
|
3051
|
+
"Ὰ": "Α",
|
|
3052
|
+
"Ά": "Α",
|
|
3053
|
+
"ᾼ": "Α",
|
|
3054
|
+
"῁": "¨",
|
|
3055
|
+
"ῂ": "η",
|
|
3056
|
+
"ῃ": "η",
|
|
3057
|
+
"ῄ": "η",
|
|
3058
|
+
"ῆ": "η",
|
|
3059
|
+
"ῇ": "η",
|
|
3060
|
+
"Ὲ": "Ε",
|
|
3061
|
+
"Έ": "Ε",
|
|
3062
|
+
"Ὴ": "Η",
|
|
3063
|
+
"Ή": "Η",
|
|
3064
|
+
"ῌ": "Η",
|
|
3065
|
+
"῍": "᾿",
|
|
3066
|
+
"῎": "᾿",
|
|
3067
|
+
"῏": "᾿",
|
|
3068
|
+
"ῐ": "ι",
|
|
3069
|
+
"ῑ": "ι",
|
|
3070
|
+
"ῒ": "ι",
|
|
3071
|
+
"ΐ": "ι",
|
|
3072
|
+
"ῖ": "ι",
|
|
3073
|
+
"ῗ": "ι",
|
|
3074
|
+
"Ῐ": "Ι",
|
|
3075
|
+
"Ῑ": "Ι",
|
|
3076
|
+
"Ὶ": "Ι",
|
|
3077
|
+
"Ί": "Ι",
|
|
3078
|
+
"῝": "῾",
|
|
3079
|
+
"῞": "῾",
|
|
3080
|
+
"῟": "῾",
|
|
3081
|
+
"ῠ": "υ",
|
|
3082
|
+
"ῡ": "υ",
|
|
3083
|
+
"ῢ": "υ",
|
|
3084
|
+
"ΰ": "υ",
|
|
3085
|
+
"ῤ": "ρ",
|
|
3086
|
+
"ῥ": "ρ",
|
|
3087
|
+
"ῦ": "υ",
|
|
3088
|
+
"ῧ": "υ",
|
|
3089
|
+
"Ῠ": "Υ",
|
|
3090
|
+
"Ῡ": "Υ",
|
|
3091
|
+
"Ὺ": "Υ",
|
|
3092
|
+
"Ύ": "Υ",
|
|
3093
|
+
"Ῥ": "Ρ",
|
|
3094
|
+
"῭": "¨",
|
|
3095
|
+
"΅": "¨",
|
|
3096
|
+
"ῲ": "ω",
|
|
3097
|
+
"ῳ": "ω",
|
|
3098
|
+
"ῴ": "ω",
|
|
3099
|
+
"ῶ": "ω",
|
|
3100
|
+
"ῷ": "ω",
|
|
3101
|
+
"Ὸ": "Ο",
|
|
3102
|
+
"Ό": "Ο",
|
|
3103
|
+
"Ὼ": "Ω",
|
|
3104
|
+
"Ώ": "Ω",
|
|
3105
|
+
"ῼ": "Ω",
|
|
3106
|
+
"Å": "A",
|
|
3107
|
+
"↚": "←",
|
|
3108
|
+
"↛": "→",
|
|
3109
|
+
"↮": "↔",
|
|
3110
|
+
"⇍": "⇐",
|
|
3111
|
+
"⇎": "⇔",
|
|
3112
|
+
"⇏": "⇒",
|
|
3113
|
+
"∄": "∃",
|
|
3114
|
+
"∉": "∈",
|
|
3115
|
+
"∌": "∋",
|
|
3116
|
+
"∤": "∣",
|
|
3117
|
+
"∦": "∥",
|
|
3118
|
+
"≁": "∼",
|
|
3119
|
+
"≄": "≃",
|
|
3120
|
+
"≇": "≅",
|
|
3121
|
+
"≉": "≈",
|
|
3122
|
+
"≠": "=",
|
|
3123
|
+
"≢": "≡",
|
|
3124
|
+
"≭": "≍",
|
|
3125
|
+
"≮": "<",
|
|
3126
|
+
"≯": ">",
|
|
3127
|
+
"≰": "≤",
|
|
3128
|
+
"≱": "≥",
|
|
3129
|
+
"≴": "≲",
|
|
3130
|
+
"≵": "≳",
|
|
3131
|
+
"≸": "≶",
|
|
3132
|
+
"≹": "≷",
|
|
3133
|
+
"⊀": "≺",
|
|
3134
|
+
"⊁": "≻",
|
|
3135
|
+
"⊄": "⊂",
|
|
3136
|
+
"⊅": "⊃",
|
|
3137
|
+
"⊈": "⊆",
|
|
3138
|
+
"⊉": "⊇",
|
|
3139
|
+
"⊬": "⊢",
|
|
3140
|
+
"⊭": "⊨",
|
|
3141
|
+
"⊮": "⊩",
|
|
3142
|
+
"⊯": "⊫",
|
|
3143
|
+
"⋠": "≼",
|
|
3144
|
+
"⋡": "≽",
|
|
3145
|
+
"⋢": "⊑",
|
|
3146
|
+
"⋣": "⊒",
|
|
3147
|
+
"⋪": "⊲",
|
|
3148
|
+
"⋫": "⊳",
|
|
3149
|
+
"⋬": "⊴",
|
|
3150
|
+
"⋭": "⊵",
|
|
3151
|
+
"⫝̸": "⫝"
|
|
3152
|
+
};
|
|
3153
|
+
function foldDiacritics(input) {
|
|
3154
|
+
let out = "";
|
|
3155
|
+
for (const ch of input) out += DIACRITIC_FOLD[ch] ?? ch;
|
|
3156
|
+
return out.replace(/[̀-ͯ]/g, "");
|
|
3157
|
+
}
|
|
2306
3158
|
const EXCLUDED_CLEAN_CHARS = /* @__PURE__ */ new Set([",", ":", ";", "-", "/", "\\"]);
|
|
2307
3159
|
const cleanChars = seps.split("").filter((c) => !EXCLUDED_CLEAN_CHARS.has(c)).join("");
|
|
2308
3160
|
function potentialBefore(i, inputString) {
|
|
@@ -2457,6 +3309,14 @@ function validateRoman(match) {
|
|
|
2457
3309
|
}
|
|
2458
3310
|
return sepsSurround(match);
|
|
2459
3311
|
}
|
|
3312
|
+
function seasonWordNotYear(match) {
|
|
3313
|
+
const raw = String(match.raw ?? "");
|
|
3314
|
+
if (/^\d{4}$/.test(raw)) {
|
|
3315
|
+
const n = parseInt(raw, 10);
|
|
3316
|
+
if (n >= 1900 && n <= 2100) return false;
|
|
3317
|
+
}
|
|
3318
|
+
return validateRoman(match);
|
|
3319
|
+
}
|
|
2460
3320
|
function episodes(config) {
|
|
2461
3321
|
config.range_separators;
|
|
2462
3322
|
const discreteSeparators = config.discrete_separators;
|
|
@@ -2518,6 +3378,9 @@ function episodes(config) {
|
|
|
2518
3378
|
conflictSolver: seasonEpisodeConflictSolver,
|
|
2519
3379
|
abbreviations: [altDash]
|
|
2520
3380
|
});
|
|
3381
|
+
rebulk.regex("第(?<episode>\\d{1,4})話", { tags: ["SxxExx"] });
|
|
3382
|
+
rebulk.regex("(?:シーズン|シリーズ)(?<season>\\d{1,2})", { tags: ["SxxExx"] });
|
|
3383
|
+
rebulk.regex("(?<season>\\d{1,2})期", {});
|
|
2521
3384
|
const seasonMarkerPattern = buildOrPattern(config.season_markers, "seasonMarker");
|
|
2522
3385
|
const episodeMarkerPattern = buildOrPattern(
|
|
2523
3386
|
[...config.episode_markers, ...config.disc_markers],
|
|
@@ -2596,14 +3459,14 @@ function episodes(config) {
|
|
|
2596
3459
|
formatter: { season: parseNumber, season_count: parseNumber },
|
|
2597
3460
|
validator: {
|
|
2598
3461
|
__parent__: and_(sepsSurround, orderingValidator),
|
|
2599
|
-
season:
|
|
3462
|
+
season: seasonWordNotYear,
|
|
2600
3463
|
season_count: validateRoman
|
|
2601
3464
|
},
|
|
2602
3465
|
chainBreaker: (matches) => episodesSeasonChainBreaker(matches, config),
|
|
2603
3466
|
disabled: (context) => context?.type === "movie" || isDisabled(context, "season")
|
|
2604
3467
|
}).defaults({
|
|
2605
3468
|
formatter: { season: parseNumber, season_count: parseNumber },
|
|
2606
|
-
validator: { season:
|
|
3469
|
+
validator: { season: seasonWordNotYear, season_count: validateRoman },
|
|
2607
3470
|
conflictSolver: seasonEpisodeConflictSolver
|
|
2608
3471
|
}).regex(seasonWordPattern + `@?(?P<season>${numeralWithWords})`).regex(ofWordPattern + `@?(?P<season_count>${numeral})`).repeater("?").regex(
|
|
2609
3472
|
`@?` + buildOrPattern(
|
|
@@ -2614,13 +3477,13 @@ function episodes(config) {
|
|
|
2614
3477
|
).repeater("*");
|
|
2615
3478
|
const episodeWordPattern = buildOrPattern(config.episode_words, "episodeMarker");
|
|
2616
3479
|
rebulk.regex(
|
|
2617
|
-
`(?<![a-zA-Z])` + episodeWordPattern + `@?(?<episode>\\d+)(?:v(?<version>\\d+))?(?:@?` + ofWordPattern + `@?(?<count>\\d+))?`,
|
|
3480
|
+
`(?<![a-zA-Z\\d])` + episodeWordPattern + `@?(?<episode>\\d+)(?:v(?<version>\\d+))?(?:@?` + ofWordPattern + `@?(?<count>\\d+))?`,
|
|
2618
3481
|
{
|
|
2619
3482
|
disabled: (context) => context?.type === "episode" || isDisabled(context, "episode")
|
|
2620
3483
|
}
|
|
2621
3484
|
);
|
|
2622
3485
|
rebulk.regex(
|
|
2623
|
-
`(?<![a-zA-Z])` + episodeWordPattern + `@?(?<episode>${numeral})(?:v(?<version>\\d+))?(?:@?` + ofWordPattern + `@?(?<count>\\d+))?`,
|
|
3486
|
+
`(?<![a-zA-Z\\d])` + episodeWordPattern + `@?(?<episode>${numeral})(?:v(?<version>\\d+))?(?:@?` + ofWordPattern + `@?(?<count>\\d+))?`,
|
|
2624
3487
|
{
|
|
2625
3488
|
validator: { episode: validateRoman },
|
|
2626
3489
|
formatter: { episode: parseNumber },
|
|
@@ -2673,7 +3536,7 @@ function episodes(config) {
|
|
|
2673
3536
|
}).repeater("*");
|
|
2674
3537
|
rebulk.chain({
|
|
2675
3538
|
disabled: (context) => isDisabled(context, "episode")
|
|
2676
|
-
}).defaults({ validator: null }).regex(`(?<![a-zA-Z])ep-?(?<episode>\\d{1,4})`).regex(`v(?<version>\\d+)`).repeater("?").regex(`(?<episodeSeparator>ep|e|x|-)(?<episode>\\d{1,4})`, {
|
|
3539
|
+
}).defaults({ validator: null }).regex(`(?<![a-zA-Z\\d])ep-?(?<episode>\\d{1,4})`).regex(`v(?<version>\\d+)`).repeater("?").regex(`(?<episodeSeparator>ep|e|x|-)(?<episode>\\d{1,4})`, {
|
|
2677
3540
|
abbreviations: null
|
|
2678
3541
|
}).repeater("*");
|
|
2679
3542
|
rebulk.chain({
|
|
@@ -2720,6 +3583,7 @@ function episodes(config) {
|
|
|
2720
3583
|
FixCorruptedGroupBoundaryValues,
|
|
2721
3584
|
new RangeExpansionRule(config),
|
|
2722
3585
|
WeakConflictSolverRule,
|
|
3586
|
+
RemoveWeakDuplicateRule,
|
|
2723
3587
|
RemoveWeakIfSxxExxRule,
|
|
2724
3588
|
AbsoluteEpisodeInGroupRule,
|
|
2725
3589
|
RemoveInvalidSeasonRule,
|
|
@@ -2728,7 +3592,7 @@ function episodes(config) {
|
|
|
2728
3592
|
);
|
|
2729
3593
|
return rebulk;
|
|
2730
3594
|
}
|
|
2731
|
-
class
|
|
3595
|
+
const _DiscMarkerRule = class _DiscMarkerRule extends Rule {
|
|
2732
3596
|
constructor(config) {
|
|
2733
3597
|
super();
|
|
2734
3598
|
this.priority = 128;
|
|
@@ -2755,14 +3619,29 @@ class DiscMarkerRule extends Rule {
|
|
|
2755
3619
|
}
|
|
2756
3620
|
return toRename.length > 0 ? toRename : false;
|
|
2757
3621
|
}
|
|
2758
|
-
then(matches, toRename,
|
|
3622
|
+
then(matches, toRename, context) {
|
|
3623
|
+
const discExcluded = isDisabled(context, "disc");
|
|
2759
3624
|
for (const ep of toRename) {
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
3625
|
+
if (discExcluded) {
|
|
3626
|
+
const initiator = ep.initiator;
|
|
3627
|
+
matches.remove(ep);
|
|
3628
|
+
if (initiator) {
|
|
3629
|
+
const siblings = initiator.children ? typeof initiator.children[Symbol.iterator] === "function" ? [...initiator.children] : [] : [];
|
|
3630
|
+
for (const sib of siblings) {
|
|
3631
|
+
if (matches.includes(sib)) matches.remove(sib);
|
|
3632
|
+
}
|
|
3633
|
+
if (matches.includes(initiator)) matches.remove(initiator);
|
|
3634
|
+
}
|
|
3635
|
+
} else {
|
|
3636
|
+
matches.remove(ep);
|
|
3637
|
+
ep.name = "disc";
|
|
3638
|
+
matches.append(ep);
|
|
3639
|
+
}
|
|
2763
3640
|
}
|
|
2764
3641
|
}
|
|
2765
|
-
}
|
|
3642
|
+
};
|
|
3643
|
+
_DiscMarkerRule.priority = 128;
|
|
3644
|
+
let DiscMarkerRule = _DiscMarkerRule;
|
|
2766
3645
|
class FixCorruptedGroupBoundaryValues extends Rule {
|
|
2767
3646
|
when(matches, _context) {
|
|
2768
3647
|
const toFix = [];
|
|
@@ -2833,13 +3712,11 @@ class RangeExpansionRule extends Rule {
|
|
|
2833
3712
|
const gap = nextVal - curVal;
|
|
2834
3713
|
if (gap <= 1 || gap > maxRange) continue;
|
|
2835
3714
|
const between = matches.inputString?.slice(current.end, next.start) || "";
|
|
2836
|
-
const betweenClean = between.replace(/[\s.
|
|
2837
|
-
const betweenStripMarkers = betweenClean.replace(/[
|
|
2838
|
-
const
|
|
2839
|
-
const
|
|
2840
|
-
|
|
2841
|
-
const isDiscrete = discreteSeps.has(betweenClean);
|
|
2842
|
-
if (isRange || sameChain && !isDiscrete) {
|
|
3715
|
+
const betweenClean = between.replace(/[\s.]/g, "").toLowerCase();
|
|
3716
|
+
const betweenStripMarkers = betweenClean.replace(/[sexp]/gi, "");
|
|
3717
|
+
const hasRangeChar = /[-~_]/.test(between);
|
|
3718
|
+
const isRange = hasRangeChar || rangeSeps.has(betweenClean) || rangeSeps.has(betweenStripMarkers);
|
|
3719
|
+
if (isRange) {
|
|
2843
3720
|
for (let v = curVal + 1; v < nextVal; v++) {
|
|
2844
3721
|
const m = new Match(current.start, next.end, {
|
|
2845
3722
|
name,
|
|
@@ -2855,7 +3732,7 @@ class RangeExpansionRule extends Rule {
|
|
|
2855
3732
|
return toAppend.length > 0 ? toAppend : false;
|
|
2856
3733
|
}
|
|
2857
3734
|
}
|
|
2858
|
-
class
|
|
3735
|
+
const _RemoveInvalidSeasonRule = class _RemoveInvalidSeasonRule extends Rule {
|
|
2859
3736
|
constructor() {
|
|
2860
3737
|
super(...arguments);
|
|
2861
3738
|
this.consequence = RemoveMatch;
|
|
@@ -2888,8 +3765,10 @@ class RemoveInvalidSeasonRule extends Rule {
|
|
|
2888
3765
|
}
|
|
2889
3766
|
return toRemove.length > 0 ? toRemove : false;
|
|
2890
3767
|
}
|
|
2891
|
-
}
|
|
2892
|
-
|
|
3768
|
+
};
|
|
3769
|
+
_RemoveInvalidSeasonRule.priority = 64;
|
|
3770
|
+
let RemoveInvalidSeasonRule = _RemoveInvalidSeasonRule;
|
|
3771
|
+
const _RemoveInvalidEpisodeRule = class _RemoveInvalidEpisodeRule extends Rule {
|
|
2893
3772
|
constructor() {
|
|
2894
3773
|
super(...arguments);
|
|
2895
3774
|
this.consequence = RemoveMatch;
|
|
@@ -2939,8 +3818,44 @@ class RemoveInvalidEpisodeRule extends Rule {
|
|
|
2939
3818
|
(m) => !m.private && ["episodeMarker", "episodeSeparator"].includes(m.name)
|
|
2940
3819
|
)?.[0];
|
|
2941
3820
|
}
|
|
2942
|
-
}
|
|
2943
|
-
|
|
3821
|
+
};
|
|
3822
|
+
_RemoveInvalidEpisodeRule.priority = 64;
|
|
3823
|
+
let RemoveInvalidEpisodeRule = _RemoveInvalidEpisodeRule;
|
|
3824
|
+
const _RemoveWeakDuplicateRule = class _RemoveWeakDuplicateRule extends Rule {
|
|
3825
|
+
constructor() {
|
|
3826
|
+
super(...arguments);
|
|
3827
|
+
this.consequence = RemoveMatch;
|
|
3828
|
+
this.priority = 64;
|
|
3829
|
+
}
|
|
3830
|
+
when(matches, _context) {
|
|
3831
|
+
const toRemove = [];
|
|
3832
|
+
const fileparts = matches.markers?.named("path") || [];
|
|
3833
|
+
const filepartArr = Array.isArray(fileparts) ? fileparts : fileparts ? [fileparts] : [];
|
|
3834
|
+
for (const filepart of filepartArr) {
|
|
3835
|
+
const weakDups = (matches.range?.(
|
|
3836
|
+
filepart.start,
|
|
3837
|
+
filepart.end,
|
|
3838
|
+
(m) => m.tags?.includes("weak-duplicate")
|
|
3839
|
+
) || []).slice().reverse();
|
|
3840
|
+
const seen = {};
|
|
3841
|
+
for (const match of weakDups) {
|
|
3842
|
+
const name = match.name ?? "";
|
|
3843
|
+
const pattern = match.initiator?.pattern ?? match.pattern ?? null;
|
|
3844
|
+
if (!pattern) continue;
|
|
3845
|
+
if (!seen[name]) seen[name] = /* @__PURE__ */ new Set();
|
|
3846
|
+
if (seen[name].has(pattern)) {
|
|
3847
|
+
toRemove.push(match);
|
|
3848
|
+
} else {
|
|
3849
|
+
seen[name].add(pattern);
|
|
3850
|
+
}
|
|
3851
|
+
}
|
|
3852
|
+
}
|
|
3853
|
+
return toRemove.length > 0 ? toRemove : false;
|
|
3854
|
+
}
|
|
3855
|
+
};
|
|
3856
|
+
_RemoveWeakDuplicateRule.priority = 64;
|
|
3857
|
+
let RemoveWeakDuplicateRule = _RemoveWeakDuplicateRule;
|
|
3858
|
+
let RemoveUndeterminedLanguagesRule$1 = (_a = class extends Rule {
|
|
2944
3859
|
constructor() {
|
|
2945
3860
|
super(...arguments);
|
|
2946
3861
|
this.consequence = RemoveMatch;
|
|
@@ -2949,8 +3864,8 @@ let RemoveUndeterminedLanguagesRule$1 = class RemoveUndeterminedLanguagesRule ex
|
|
|
2949
3864
|
when(matches, context) {
|
|
2950
3865
|
return false;
|
|
2951
3866
|
}
|
|
2952
|
-
};
|
|
2953
|
-
class
|
|
3867
|
+
}, _a.priority = 32, _a);
|
|
3868
|
+
const _WeakConflictSolverRule = class _WeakConflictSolverRule extends Rule {
|
|
2954
3869
|
constructor() {
|
|
2955
3870
|
super(...arguments);
|
|
2956
3871
|
this.consequence = RemoveMatch;
|
|
@@ -3029,8 +3944,10 @@ class WeakConflictSolverRule extends Rule {
|
|
|
3029
3944
|
}
|
|
3030
3945
|
return toRemove.length > 0 ? toRemove : false;
|
|
3031
3946
|
}
|
|
3032
|
-
}
|
|
3033
|
-
|
|
3947
|
+
};
|
|
3948
|
+
_WeakConflictSolverRule.priority = 128;
|
|
3949
|
+
let WeakConflictSolverRule = _WeakConflictSolverRule;
|
|
3950
|
+
const _AbsoluteEpisodeInGroupRule = class _AbsoluteEpisodeInGroupRule extends Rule {
|
|
3034
3951
|
constructor() {
|
|
3035
3952
|
super(...arguments);
|
|
3036
3953
|
this.priority = -1;
|
|
@@ -3068,8 +3985,10 @@ class AbsoluteEpisodeInGroupRule extends Rule {
|
|
|
3068
3985
|
matches.append(match);
|
|
3069
3986
|
}
|
|
3070
3987
|
}
|
|
3071
|
-
}
|
|
3072
|
-
|
|
3988
|
+
};
|
|
3989
|
+
_AbsoluteEpisodeInGroupRule.priority = -1;
|
|
3990
|
+
let AbsoluteEpisodeInGroupRule = _AbsoluteEpisodeInGroupRule;
|
|
3991
|
+
const _RemoveWeakIfSxxExxRule = class _RemoveWeakIfSxxExxRule extends Rule {
|
|
3073
3992
|
constructor() {
|
|
3074
3993
|
super(...arguments);
|
|
3075
3994
|
this.consequence = RemoveMatch;
|
|
@@ -3134,7 +4053,9 @@ class RemoveWeakIfSxxExxRule extends Rule {
|
|
|
3134
4053
|
matches.append(match);
|
|
3135
4054
|
}
|
|
3136
4055
|
}
|
|
3137
|
-
}
|
|
4056
|
+
};
|
|
4057
|
+
_RemoveWeakIfSxxExxRule.priority = 64;
|
|
4058
|
+
let RemoveWeakIfSxxExxRule = _RemoveWeakIfSxxExxRule;
|
|
3138
4059
|
function container(config) {
|
|
3139
4060
|
const rebulk = new Rebulk({ disabled: (context) => isDisabled(context, "container") });
|
|
3140
4061
|
rebulk.regexDefaults({ flags: "i" }).stringDefaults({ ignoreCase: true });
|
|
@@ -3149,6 +4070,17 @@ function container(config) {
|
|
|
3149
4070
|
const videos = config["videos"] || [];
|
|
3150
4071
|
const torrent = config["torrent"] || [];
|
|
3151
4072
|
const nzb = config["nzb"] || [];
|
|
4073
|
+
const archives = config["archives"] || [];
|
|
4074
|
+
const images = config["images"] || [];
|
|
4075
|
+
if (archives.length) rebulk.regex("\\." + buildOrPattern(archives, void 0, true) + "$", {
|
|
4076
|
+
exts: archives,
|
|
4077
|
+
tags: ["extension", "archive"]
|
|
4078
|
+
});
|
|
4079
|
+
rebulk.regex("\\.r\\d{2}$", { tags: ["extension", "archive"] });
|
|
4080
|
+
if (images.length) rebulk.regex("\\." + buildOrPattern(images, void 0, true) + "$", {
|
|
4081
|
+
exts: images,
|
|
4082
|
+
tags: ["extension", "image"]
|
|
4083
|
+
});
|
|
3152
4084
|
if (subtitles.length) rebulk.regex("\\." + buildOrPattern(subtitles, void 0, true) + "$", {
|
|
3153
4085
|
exts: subtitles,
|
|
3154
4086
|
tags: ["extension", "subtitle"]
|
|
@@ -3842,6 +4774,9 @@ const COMPOUND_PROFILES = {
|
|
|
3842
4774
|
"Dolby Digital": "EX"
|
|
3843
4775
|
};
|
|
3844
4776
|
const _CompoundAudioProfileRule = class _CompoundAudioProfileRule extends Rule {
|
|
4777
|
+
enabled(context) {
|
|
4778
|
+
return !isDisabled(context, "audio_profile");
|
|
4779
|
+
}
|
|
3845
4780
|
when(matches) {
|
|
3846
4781
|
const codecs = matches.named("audio_codec");
|
|
3847
4782
|
for (const codec of codecs) {
|
|
@@ -4349,10 +5284,38 @@ const DATE_REGEXPS = [
|
|
|
4349
5284
|
new RegExp(`(?:^|[^\\d])((\\d{1,2})${DSEP}(\\d{1,2})${DSEP}(\\d{2}))(?:$|[^\\d])`, "i"),
|
|
4350
5285
|
new RegExp(`(?:^|[^\\d])((\\d{4})${DSEP_BIS}(\\d{1,2})${DSEP}(\\d{1,2}))(?:$|[^\\d])`, "i"),
|
|
4351
5286
|
new RegExp(`(?:^|[^\\d])((\\d{1,2})${DSEP}(\\d{1,2})${DSEP_BIS}(\\d{4}))(?:$|[^\\d])`, "i"),
|
|
4352
|
-
new RegExp(`(?:^|[^\\d])((\\d{1,2}(?:st|nd|rd|th)?${DSEP}(?:[a-z]{3,10})${DSEP}\\d{4}))(?:$|[^\\d])`, "i")
|
|
5287
|
+
new RegExp(`(?:^|[^\\d])((\\d{1,2}(?:st|nd|rd|th)?${DSEP}(?:[a-z]{3,10})${DSEP}\\d{4}))(?:$|[^\\d])`, "i"),
|
|
5288
|
+
// Month-name first: "July 30 2021", "Jul.30.2021"
|
|
5289
|
+
new RegExp(`(?:^|[^a-z\\d])(([a-z]{3,10})${DSEP}\\d{1,2}(?:st|nd|rd|th)?${DSEP}\\d{4})(?:$|[^\\d])`, "i")
|
|
4353
5290
|
];
|
|
5291
|
+
const MONTHS = {
|
|
5292
|
+
jan: 1,
|
|
5293
|
+
january: 1,
|
|
5294
|
+
feb: 2,
|
|
5295
|
+
february: 2,
|
|
5296
|
+
mar: 3,
|
|
5297
|
+
march: 3,
|
|
5298
|
+
apr: 4,
|
|
5299
|
+
april: 4,
|
|
5300
|
+
may: 5,
|
|
5301
|
+
jun: 6,
|
|
5302
|
+
june: 6,
|
|
5303
|
+
jul: 7,
|
|
5304
|
+
july: 7,
|
|
5305
|
+
aug: 8,
|
|
5306
|
+
august: 8,
|
|
5307
|
+
sep: 9,
|
|
5308
|
+
sept: 9,
|
|
5309
|
+
september: 9,
|
|
5310
|
+
oct: 10,
|
|
5311
|
+
october: 10,
|
|
5312
|
+
nov: 11,
|
|
5313
|
+
november: 11,
|
|
5314
|
+
dec: 12,
|
|
5315
|
+
december: 12
|
|
5316
|
+
};
|
|
4354
5317
|
function validYear(year) {
|
|
4355
|
-
return year >=
|
|
5318
|
+
return year >= 1900 && year < 2035;
|
|
4356
5319
|
}
|
|
4357
5320
|
function validWeek(week) {
|
|
4358
5321
|
return week >= 1 && week < 53;
|
|
@@ -4377,6 +5340,27 @@ function tryParseDate(match, groups2, yearFirst, dayFirst) {
|
|
|
4377
5340
|
for (const yf of yearFirstOpts) {
|
|
4378
5341
|
for (const df of dayFirstOpts) {
|
|
4379
5342
|
let year, month, day;
|
|
5343
|
+
const monthNameIdx = parts.findIndex((x) => MONTHS[x.toLowerCase()] !== void 0);
|
|
5344
|
+
if (parts.length === 3 && monthNameIdx >= 0) {
|
|
5345
|
+
month = MONTHS[parts[monthNameIdx].toLowerCase()];
|
|
5346
|
+
const rest = parts.filter((_, i) => i !== monthNameIdx).map((x) => parseInt(x.replace(/(st|nd|rd|th)$/i, ""), 10));
|
|
5347
|
+
const yearPos = rest.findIndex((n) => n >= 1e3);
|
|
5348
|
+
if (yearPos >= 0) {
|
|
5349
|
+
year = rest[yearPos];
|
|
5350
|
+
day = rest[1 - yearPos];
|
|
5351
|
+
} else {
|
|
5352
|
+
year = rest[1];
|
|
5353
|
+
day = rest[0];
|
|
5354
|
+
}
|
|
5355
|
+
if (month >= 1 && month <= 12 && day >= 1 && day <= 31 && validYear(year)) {
|
|
5356
|
+
const ts = Date.UTC(year, month - 1, day);
|
|
5357
|
+
const d = new Date(ts);
|
|
5358
|
+
if (d.getUTCFullYear() === year && d.getUTCMonth() === month - 1 && d.getUTCDate() === day) {
|
|
5359
|
+
return d;
|
|
5360
|
+
}
|
|
5361
|
+
}
|
|
5362
|
+
continue;
|
|
5363
|
+
}
|
|
4380
5364
|
if (parts.length === 1) {
|
|
4381
5365
|
const s = parts[0];
|
|
4382
5366
|
if (s.length === 8) {
|
|
@@ -4511,6 +5495,31 @@ const _KeepMarkedYearInFilepart = class _KeepMarkedYearInFilepart extends Rule {
|
|
|
4511
5495
|
};
|
|
4512
5496
|
_KeepMarkedYearInFilepart.priority = 64;
|
|
4513
5497
|
let KeepMarkedYearInFilepart = _KeepMarkedYearInFilepart;
|
|
5498
|
+
const _RemoveGroupedYearWithSxxExx = class _RemoveGroupedYearWithSxxExx extends Rule {
|
|
5499
|
+
constructor() {
|
|
5500
|
+
super(...arguments);
|
|
5501
|
+
this.consequence = RemoveMatch;
|
|
5502
|
+
}
|
|
5503
|
+
when(matches, _context) {
|
|
5504
|
+
const ret = [];
|
|
5505
|
+
const hasSxxExx = matches.named("episode").some(
|
|
5506
|
+
(m) => m.tags?.includes("SxxExx")
|
|
5507
|
+
);
|
|
5508
|
+
if (!hasSxxExx) return ret;
|
|
5509
|
+
for (const year of matches.named("year")) {
|
|
5510
|
+
const group = matches.markers.atMatch(year, (m) => m.name === "group", 0);
|
|
5511
|
+
if (!group) continue;
|
|
5512
|
+
const groupLen = group.end - group.start;
|
|
5513
|
+
const yearLen = year.end - year.start;
|
|
5514
|
+
if (groupLen - yearLen > 4) {
|
|
5515
|
+
ret.push(year);
|
|
5516
|
+
}
|
|
5517
|
+
}
|
|
5518
|
+
return ret;
|
|
5519
|
+
}
|
|
5520
|
+
};
|
|
5521
|
+
_RemoveGroupedYearWithSxxExx.priority = 64;
|
|
5522
|
+
let RemoveGroupedYearWithSxxExx = _RemoveGroupedYearWithSxxExx;
|
|
4514
5523
|
function date(config) {
|
|
4515
5524
|
const rebulk = new Rebulk().defaults({ validator: sepsSurround });
|
|
4516
5525
|
rebulk.regex("\\d{4}", {
|
|
@@ -4550,7 +5559,7 @@ function date(config) {
|
|
|
4550
5559
|
disabled: (context) => isDisabled(context, "date"),
|
|
4551
5560
|
conflictSolver: (match, other2) => other2.name === "episode" || other2.name === "season" || other2.name === "crc32" ? other2 : "__default__"
|
|
4552
5561
|
});
|
|
4553
|
-
rebulk.rules(KeepMarkedYearInFilepart);
|
|
5562
|
+
rebulk.rules(KeepMarkedYearInFilepart, RemoveGroupedYearWithSxxExx);
|
|
4554
5563
|
return rebulk;
|
|
4555
5564
|
}
|
|
4556
5565
|
function markerComparatorPredicate(m) {
|
|
@@ -4610,6 +5619,32 @@ function buildExpectedFunction(optionName) {
|
|
|
4610
5619
|
return results;
|
|
4611
5620
|
};
|
|
4612
5621
|
}
|
|
5622
|
+
const TITLE_STOP_WORDS = /* @__PURE__ */ new Set([
|
|
5623
|
+
"the",
|
|
5624
|
+
"a",
|
|
5625
|
+
"an",
|
|
5626
|
+
"and",
|
|
5627
|
+
"or",
|
|
5628
|
+
"of",
|
|
5629
|
+
"to",
|
|
5630
|
+
"in",
|
|
5631
|
+
"on",
|
|
5632
|
+
"at",
|
|
5633
|
+
"for",
|
|
5634
|
+
"from",
|
|
5635
|
+
"by",
|
|
5636
|
+
"with",
|
|
5637
|
+
"into",
|
|
5638
|
+
"onto",
|
|
5639
|
+
"no",
|
|
5640
|
+
"le",
|
|
5641
|
+
"la",
|
|
5642
|
+
"les",
|
|
5643
|
+
"de",
|
|
5644
|
+
"du",
|
|
5645
|
+
"des",
|
|
5646
|
+
"el"
|
|
5647
|
+
]);
|
|
4613
5648
|
function hasmatch$1(result) {
|
|
4614
5649
|
if (result === null || result === void 0) return false;
|
|
4615
5650
|
if (Array.isArray(result)) return result.length > 0;
|
|
@@ -4657,9 +5692,21 @@ const _TitleBaseRule = class _TitleBaseRule extends Rule {
|
|
|
4657
5692
|
}
|
|
4658
5693
|
/**
|
|
4659
5694
|
* Determine if a match should be ignored (e.g., language, country).
|
|
5695
|
+
*
|
|
5696
|
+
* Python parity: a full-word (len > 3) UPPERCASE language/country is a real
|
|
5697
|
+
* token, not title filler, so it is NOT ignored — e.g. the trailing "FRENCH"
|
|
5698
|
+
* in "...XViD-NTK.FRENCH..." must not be pulled into an alternative_title.
|
|
5699
|
+
* Lowercase or short (<= 3 char) language/country codes remain ignored.
|
|
4660
5700
|
*/
|
|
4661
5701
|
isIgnored(match) {
|
|
4662
|
-
|
|
5702
|
+
if (!(match.name === "language" || match.name === "country" || match.name === "episode_details")) {
|
|
5703
|
+
return false;
|
|
5704
|
+
}
|
|
5705
|
+
const raw = match.raw ?? "";
|
|
5706
|
+
if (match.end - match.start > 3 && raw !== "" && raw === raw.toUpperCase() && raw !== raw.toLowerCase()) {
|
|
5707
|
+
return false;
|
|
5708
|
+
}
|
|
5709
|
+
return true;
|
|
4663
5710
|
}
|
|
4664
5711
|
/**
|
|
4665
5712
|
* Determine if we should keep a hole boundary (don't trim this side).
|
|
@@ -4768,6 +5815,7 @@ const _TitleBaseRule = class _TitleBaseRule extends Rule {
|
|
|
4768
5815
|
formatter: formatters(cleanup, reorderTitle),
|
|
4769
5816
|
ignore: (m) => {
|
|
4770
5817
|
if (this.isIgnored(m)) return true;
|
|
5818
|
+
if (m.private && m.tags?.includes("weak-episode")) return true;
|
|
4771
5819
|
if (m.tags?.includes("weak-episode") || m.tags?.includes("weak-duplicate")) {
|
|
4772
5820
|
const initiator = m.initiator;
|
|
4773
5821
|
const startsAtFilepart = m.start === filepart.start || initiator.start === filepart.start;
|
|
@@ -4780,6 +5828,19 @@ const _TitleBaseRule = class _TitleBaseRule extends Rule {
|
|
|
4780
5828
|
if (firstYearInFilepart && m.end <= firstYearInFilepart.start) {
|
|
4781
5829
|
return true;
|
|
4782
5830
|
}
|
|
5831
|
+
if (m.tags?.includes("weak-duplicate")) {
|
|
5832
|
+
const init = m.initiator || m;
|
|
5833
|
+
const laterWds = matches.range(
|
|
5834
|
+
init.end,
|
|
5835
|
+
filepart.end,
|
|
5836
|
+
(other2) => other2.tags?.includes("weak-duplicate") && !other2.private
|
|
5837
|
+
) || [];
|
|
5838
|
+
const hasLaterDifferent = laterWds.some((other2) => {
|
|
5839
|
+
const otherInit = other2.initiator || other2;
|
|
5840
|
+
return otherInit !== init;
|
|
5841
|
+
});
|
|
5842
|
+
if (hasLaterDifferent) return true;
|
|
5843
|
+
}
|
|
4783
5844
|
}
|
|
4784
5845
|
return false;
|
|
4785
5846
|
},
|
|
@@ -4849,6 +5910,15 @@ const _TitleBaseRule = class _TitleBaseRule extends Rule {
|
|
|
4849
5910
|
while (ignoredArray.length > 0) {
|
|
4850
5911
|
const lastIgnored = ignoredArray[ignoredArray.length - 1];
|
|
4851
5912
|
if (lastIgnored.end === trimmedHole.end) {
|
|
5913
|
+
if (lastIgnored.name === "language" || lastIgnored.name === "country") {
|
|
5914
|
+
const beforeWords = inp.slice(trimmedHole.start, lastIgnored.start).toLowerCase().split(/[^a-z0-9]+/i).filter(Boolean);
|
|
5915
|
+
const lastWord = beforeWords[beforeWords.length - 1];
|
|
5916
|
+
if (lastWord && TITLE_STOP_WORDS.has(lastWord)) {
|
|
5917
|
+
toRemove.push(lastIgnored);
|
|
5918
|
+
ignoredArray.pop();
|
|
5919
|
+
break;
|
|
5920
|
+
}
|
|
5921
|
+
}
|
|
4852
5922
|
if (lastIgnored.name === "episode_details" && lastIgnored.value === "Special") {
|
|
4853
5923
|
const nextMatch = matches.range(
|
|
4854
5924
|
lastIgnored.end,
|
|
@@ -4909,6 +5979,16 @@ const _TitleBaseRule = class _TitleBaseRule extends Rule {
|
|
|
4909
5979
|
}
|
|
4910
5980
|
}
|
|
4911
5981
|
}
|
|
5982
|
+
const mainTitle = toAppend.find((t) => t.name === this.matchName);
|
|
5983
|
+
if (mainTitle) {
|
|
5984
|
+
const absorbedRaw = matches.range(
|
|
5985
|
+
mainTitle.start,
|
|
5986
|
+
mainTitle.end,
|
|
5987
|
+
(m) => m.name === "episode_details" || m.name === "country" || m.name === "language"
|
|
5988
|
+
);
|
|
5989
|
+
const absorbed = Array.isArray(absorbedRaw) ? absorbedRaw : absorbedRaw ? [absorbedRaw] : [];
|
|
5990
|
+
for (const m of absorbed) if (!toRemove.includes(m)) toRemove.push(m);
|
|
5991
|
+
}
|
|
4912
5992
|
return { toAppend, toRemove };
|
|
4913
5993
|
}
|
|
4914
5994
|
/**
|
|
@@ -5014,13 +6094,7 @@ const _TitleBaseRule = class _TitleBaseRule extends Rule {
|
|
|
5014
6094
|
const result = this.checkTitlesInFilepart(filepart, matches);
|
|
5015
6095
|
if (result.toAppend.length > 0 || result.toRemove.length > 0) {
|
|
5016
6096
|
if (serieNameMatch) {
|
|
5017
|
-
const normTitle = (s) =>
|
|
5018
|
-
try {
|
|
5019
|
-
s = s.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
|
|
5020
|
-
} catch {
|
|
5021
|
-
}
|
|
5022
|
-
return s.replace(/[''`]/g, "").replace(/\.+$/, "").toLowerCase().trim();
|
|
5023
|
-
};
|
|
6097
|
+
const normTitle = (s) => foldDiacritics(s).replace(/[''`]/g, "").replace(/\.+$/, "").toLowerCase().trim();
|
|
5024
6098
|
for (const titleMatch of result.toAppend) {
|
|
5025
6099
|
if (normTitle(String(titleMatch.value)) !== normTitle(String(serieNameMatch.value))) {
|
|
5026
6100
|
titleMatch.name = "episode_title";
|
|
@@ -5042,20 +6116,23 @@ const _TitleBaseRule = class _TitleBaseRule extends Rule {
|
|
|
5042
6116
|
continue;
|
|
5043
6117
|
}
|
|
5044
6118
|
const newVal = String(newTitle.value ?? "");
|
|
5045
|
-
const norm = (s) =>
|
|
5046
|
-
try {
|
|
5047
|
-
s = s.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
|
|
5048
|
-
} catch {
|
|
5049
|
-
}
|
|
5050
|
-
return s.replace(/[''`]/g, "").toLowerCase();
|
|
5051
|
-
};
|
|
6119
|
+
const norm = (s) => foldDiacritics(s).replace(/[''`]/g, "").toLowerCase();
|
|
5052
6120
|
const existingIdx = toAppend.findIndex((m) => {
|
|
5053
|
-
if (m.name !== this.matchName) return false;
|
|
5054
6121
|
const existingVal = String(m.value ?? "");
|
|
5055
6122
|
return norm(existingVal) === norm(newVal) && existingVal !== newVal;
|
|
5056
6123
|
});
|
|
5057
6124
|
if (existingIdx !== -1) {
|
|
5058
|
-
toAppend[existingIdx]
|
|
6125
|
+
const existing = toAppend[existingIdx];
|
|
6126
|
+
if (existing.name === this.matchName) {
|
|
6127
|
+
existing.value = newVal;
|
|
6128
|
+
} else if (existing.name === this.alternativePropertyName) {
|
|
6129
|
+
existing.value = newVal;
|
|
6130
|
+
const mainTitle = toAppend.find((m) => m.name === this.matchName);
|
|
6131
|
+
if (mainTitle) {
|
|
6132
|
+
mainTitle.name = this.alternativePropertyName || "alternative_title";
|
|
6133
|
+
existing.name = this.matchName;
|
|
6134
|
+
}
|
|
6135
|
+
}
|
|
5059
6136
|
continue;
|
|
5060
6137
|
}
|
|
5061
6138
|
const isSuperset = toAppend.some((m) => {
|
|
@@ -5133,11 +6210,253 @@ const _PreferTitleWithYear = class _PreferTitleWithYear extends Rule {
|
|
|
5133
6210
|
_PreferTitleWithYear.priority = 32;
|
|
5134
6211
|
_PreferTitleWithYear.dependency = [TitleFromPosition];
|
|
5135
6212
|
let PreferTitleWithYear = _PreferTitleWithYear;
|
|
6213
|
+
const ARTICLES = /* @__PURE__ */ new Set([
|
|
6214
|
+
"the",
|
|
6215
|
+
"a",
|
|
6216
|
+
"an",
|
|
6217
|
+
"le",
|
|
6218
|
+
"la",
|
|
6219
|
+
"les",
|
|
6220
|
+
"l'",
|
|
6221
|
+
"el",
|
|
6222
|
+
"los",
|
|
6223
|
+
"las",
|
|
6224
|
+
"il",
|
|
6225
|
+
"lo",
|
|
6226
|
+
"un",
|
|
6227
|
+
"una",
|
|
6228
|
+
"der",
|
|
6229
|
+
"die",
|
|
6230
|
+
"das",
|
|
6231
|
+
"de",
|
|
6232
|
+
"het",
|
|
6233
|
+
"o",
|
|
6234
|
+
"os"
|
|
6235
|
+
]);
|
|
6236
|
+
const _ExtendLoneArticleTitle = class _ExtendLoneArticleTitle extends Rule {
|
|
6237
|
+
constructor() {
|
|
6238
|
+
super(...arguments);
|
|
6239
|
+
this.consequence = RemoveMatch;
|
|
6240
|
+
}
|
|
6241
|
+
when(matches, _context) {
|
|
6242
|
+
const inp = matches.inputString || "";
|
|
6243
|
+
const out = [];
|
|
6244
|
+
const titles = matches.named("title");
|
|
6245
|
+
const titleArr = Array.isArray(titles) ? titles : titles ? [titles] : [];
|
|
6246
|
+
for (const title2 of titleArr) {
|
|
6247
|
+
if (!ARTICLES.has(String(title2.value ?? "").trim().toLowerCase())) continue;
|
|
6248
|
+
const filepart = matches.markers.atMatch(title2, (m) => m.name === "path", 0);
|
|
6249
|
+
if (!filepart) continue;
|
|
6250
|
+
const prop = matches.range(
|
|
6251
|
+
title2.end,
|
|
6252
|
+
filepart.end,
|
|
6253
|
+
(m) => !m.private && ["edition", "language", "country", "other", "source"].includes(m.name ?? ""),
|
|
6254
|
+
0
|
|
6255
|
+
);
|
|
6256
|
+
if (!prop) continue;
|
|
6257
|
+
if (![...inp.slice(title2.end, prop.start)].every((c) => seps.includes(c))) continue;
|
|
6258
|
+
const next = matches.range(
|
|
6259
|
+
prop.end,
|
|
6260
|
+
filepart.end,
|
|
6261
|
+
(m) => !m.private && ["year", "season", "episode", "date"].includes(m.name ?? ""),
|
|
6262
|
+
0
|
|
6263
|
+
);
|
|
6264
|
+
if (next && inp.slice(prop.end, next.start).replace(/[sexd]/gi, "").split("").some((c) => !seps.includes(c))) continue;
|
|
6265
|
+
out.push({ title: title2, prop });
|
|
6266
|
+
}
|
|
6267
|
+
return out.length ? out : false;
|
|
6268
|
+
}
|
|
6269
|
+
then(matches, whenResponse, _context) {
|
|
6270
|
+
for (const { title: title2, prop } of whenResponse) {
|
|
6271
|
+
const inp = matches.inputString || "";
|
|
6272
|
+
matches.remove(title2);
|
|
6273
|
+
matches.remove(prop);
|
|
6274
|
+
title2.end = prop.end;
|
|
6275
|
+
title2.value = cleanup(inp.slice(title2.start, title2.end));
|
|
6276
|
+
matches.append(title2);
|
|
6277
|
+
}
|
|
6278
|
+
}
|
|
6279
|
+
};
|
|
6280
|
+
_ExtendLoneArticleTitle.priority = -32;
|
|
6281
|
+
let ExtendLoneArticleTitle = _ExtendLoneArticleTitle;
|
|
6282
|
+
const _CountryAtTitlePosition = class _CountryAtTitlePosition extends Rule {
|
|
6283
|
+
constructor() {
|
|
6284
|
+
super(...arguments);
|
|
6285
|
+
this.consequence = RemoveMatch;
|
|
6286
|
+
}
|
|
6287
|
+
when(matches, _context) {
|
|
6288
|
+
const inp = matches.inputString || "";
|
|
6289
|
+
const out = [];
|
|
6290
|
+
const cand = matches.range(
|
|
6291
|
+
0,
|
|
6292
|
+
inp.length,
|
|
6293
|
+
(m) => !m.private && ["country", "other", "edition"].includes(m.name ?? "")
|
|
6294
|
+
);
|
|
6295
|
+
const arr = Array.isArray(cand) ? cand : cand ? [cand] : [];
|
|
6296
|
+
for (const c of arr) {
|
|
6297
|
+
if (!/^[A-Z][a-z]+$/.test(c.raw ?? "")) continue;
|
|
6298
|
+
const filepart = matches.markers.atMatch(c, (m) => m.name === "path", 0);
|
|
6299
|
+
if (!filepart) continue;
|
|
6300
|
+
if (![...inp.slice(filepart.start, c.start)].every((ch) => seps.includes(ch))) continue;
|
|
6301
|
+
const year = matches.range(c.end, filepart.end, (m) => !m.private && m.name === "year", 0);
|
|
6302
|
+
if (!year) continue;
|
|
6303
|
+
const se = matches.range(c.end, year.start, (m) => !m.private && ["season", "episode", "date"].includes(m.name ?? ""), 0);
|
|
6304
|
+
if (se) continue;
|
|
6305
|
+
if (![...inp.slice(c.end, year.start)].every((ch) => seps.includes(ch))) continue;
|
|
6306
|
+
out.push(c);
|
|
6307
|
+
}
|
|
6308
|
+
return out.length ? out : false;
|
|
6309
|
+
}
|
|
6310
|
+
};
|
|
6311
|
+
_CountryAtTitlePosition.priority = 64;
|
|
6312
|
+
let CountryAtTitlePosition = _CountryAtTitlePosition;
|
|
6313
|
+
const _PropertyAtTitlePositionAsTitle = class _PropertyAtTitlePositionAsTitle extends Rule {
|
|
6314
|
+
constructor() {
|
|
6315
|
+
super(...arguments);
|
|
6316
|
+
this.consequence = RemoveMatch;
|
|
6317
|
+
}
|
|
6318
|
+
when(matches, _context) {
|
|
6319
|
+
const inp = matches.inputString || "";
|
|
6320
|
+
const out = [];
|
|
6321
|
+
for (const filepart of matches.markers.named("path")) {
|
|
6322
|
+
if (matches.range(filepart.start, filepart.end, (m) => m.name === "title", 0)) continue;
|
|
6323
|
+
const anchor = matches.range(
|
|
6324
|
+
filepart.start,
|
|
6325
|
+
filepart.end,
|
|
6326
|
+
(m) => !m.private && ["year", "season", "episode", "date"].includes(m.name ?? ""),
|
|
6327
|
+
0
|
|
6328
|
+
);
|
|
6329
|
+
if (!anchor) continue;
|
|
6330
|
+
const lead = matches.range(filepart.start, filepart.end, (m) => !m.private && !!m.value, 0);
|
|
6331
|
+
if (!lead || !["other", "country", "edition"].includes(lead.name ?? "")) continue;
|
|
6332
|
+
if (lead.start >= anchor.start) continue;
|
|
6333
|
+
if (![...inp.slice(filepart.start, lead.start)].every((c) => seps.includes(c))) continue;
|
|
6334
|
+
out.push(lead);
|
|
6335
|
+
}
|
|
6336
|
+
return out.length ? out : false;
|
|
6337
|
+
}
|
|
6338
|
+
then(matches, whenResponse, _context) {
|
|
6339
|
+
const inp = matches.inputString || "";
|
|
6340
|
+
for (const lead of whenResponse) {
|
|
6341
|
+
matches.remove(lead);
|
|
6342
|
+
const t = new Match(lead.start, lead.end, {
|
|
6343
|
+
name: "title",
|
|
6344
|
+
value: cleanup(inp.slice(lead.start, lead.end)),
|
|
6345
|
+
inputString: inp
|
|
6346
|
+
});
|
|
6347
|
+
matches.append(t);
|
|
6348
|
+
}
|
|
6349
|
+
}
|
|
6350
|
+
};
|
|
6351
|
+
_PropertyAtTitlePositionAsTitle.priority = -48;
|
|
6352
|
+
let PropertyAtTitlePositionAsTitle = _PropertyAtTitlePositionAsTitle;
|
|
6353
|
+
const _RemoveNumericAlternativeTitle = class _RemoveNumericAlternativeTitle extends Rule {
|
|
6354
|
+
constructor() {
|
|
6355
|
+
super(...arguments);
|
|
6356
|
+
this.consequence = RemoveMatch;
|
|
6357
|
+
}
|
|
6358
|
+
when(matches, _context) {
|
|
6359
|
+
const alts = matches.named("alternative_title");
|
|
6360
|
+
const altArr = Array.isArray(alts) ? alts : alts ? [alts] : [];
|
|
6361
|
+
if (!altArr.length) return false;
|
|
6362
|
+
const out = [];
|
|
6363
|
+
for (const alt of altArr) {
|
|
6364
|
+
const raw = String(alt.raw ?? alt.value ?? "");
|
|
6365
|
+
if (!/^[\d\s.~_-]+$/.test(raw) || !/\d/.test(raw)) continue;
|
|
6366
|
+
const filepart = matches.markers.atMatch(alt, (m) => m.name === "path", 0);
|
|
6367
|
+
if (!filepart) continue;
|
|
6368
|
+
const hasEpisode = matches.range(
|
|
6369
|
+
filepart.start,
|
|
6370
|
+
filepart.end,
|
|
6371
|
+
(m) => m.name === "episode" || m.name === "absolute_episode",
|
|
6372
|
+
0
|
|
6373
|
+
);
|
|
6374
|
+
if (hasEpisode) out.push(alt);
|
|
6375
|
+
}
|
|
6376
|
+
return out.length ? out : false;
|
|
6377
|
+
}
|
|
6378
|
+
};
|
|
6379
|
+
_RemoveNumericAlternativeTitle.priority = -64;
|
|
6380
|
+
let RemoveNumericAlternativeTitle = _RemoveNumericAlternativeTitle;
|
|
6381
|
+
const _RemoveTailAlternativeTitle = class _RemoveTailAlternativeTitle extends Rule {
|
|
6382
|
+
constructor() {
|
|
6383
|
+
super(...arguments);
|
|
6384
|
+
this.consequence = RemoveMatch;
|
|
6385
|
+
}
|
|
6386
|
+
when(matches, _context) {
|
|
6387
|
+
const alts = matches.named("alternative_title");
|
|
6388
|
+
const altArr = Array.isArray(alts) ? alts : alts ? [alts] : [];
|
|
6389
|
+
if (!altArr.length) return false;
|
|
6390
|
+
const titleish = /* @__PURE__ */ new Set(["year", "title", "alternative_title", "episode_title", "type"]);
|
|
6391
|
+
const out = [];
|
|
6392
|
+
for (const alt of altArr) {
|
|
6393
|
+
const filepart = matches.markers.atMatch(alt, (m) => m.name === "path", 0);
|
|
6394
|
+
if (!filepart) continue;
|
|
6395
|
+
const years = matches.range(filepart.start, filepart.end, (m) => m.name === "year");
|
|
6396
|
+
const yearArr = Array.isArray(years) ? years : years ? [years] : [];
|
|
6397
|
+
if (!yearArr.length) continue;
|
|
6398
|
+
const yMax = Math.max(...yearArr.map((y) => y.end));
|
|
6399
|
+
if (alt.start < yMax) continue;
|
|
6400
|
+
const between = matches.range(
|
|
6401
|
+
yMax,
|
|
6402
|
+
alt.start,
|
|
6403
|
+
(m) => !m.private && !!m.value && !titleish.has(m.name ?? ""),
|
|
6404
|
+
0
|
|
6405
|
+
);
|
|
6406
|
+
if (between) out.push(alt);
|
|
6407
|
+
}
|
|
6408
|
+
return out.length ? out : false;
|
|
6409
|
+
}
|
|
6410
|
+
};
|
|
6411
|
+
_RemoveTailAlternativeTitle.priority = POST_PROCESS;
|
|
6412
|
+
_RemoveTailAlternativeTitle.dependency = ["RenameEpisodeTitleWhenMovieType"];
|
|
6413
|
+
let RemoveTailAlternativeTitle = _RemoveTailAlternativeTitle;
|
|
6414
|
+
const _RemoveTailTitle = class _RemoveTailTitle extends Rule {
|
|
6415
|
+
constructor() {
|
|
6416
|
+
super(...arguments);
|
|
6417
|
+
this.consequence = RemoveMatch;
|
|
6418
|
+
}
|
|
6419
|
+
when(matches, _context) {
|
|
6420
|
+
const titleish = /* @__PURE__ */ new Set(["year", "title", "alternative_title", "episode_title", "type"]);
|
|
6421
|
+
const out = [];
|
|
6422
|
+
for (const filepart of matches.markers.named("path")) {
|
|
6423
|
+
const titles = matches.range(
|
|
6424
|
+
filepart.start,
|
|
6425
|
+
filepart.end,
|
|
6426
|
+
(m) => m.name === "title"
|
|
6427
|
+
);
|
|
6428
|
+
const titleArr = (Array.isArray(titles) ? titles : titles ? [titles] : []).slice().sort((a, b) => a.start - b.start);
|
|
6429
|
+
if (titleArr.length < 2) continue;
|
|
6430
|
+
const primary = titleArr[0];
|
|
6431
|
+
const head = String(primary.value ?? "").trim().toLowerCase();
|
|
6432
|
+
if (!head) continue;
|
|
6433
|
+
if (TITLE_STOP_WORDS.has(head)) {
|
|
6434
|
+
if (titleArr.slice(1).some((t) => !TITLE_STOP_WORDS.has(String(t.value ?? "").trim().toLowerCase()))) {
|
|
6435
|
+
out.push(primary);
|
|
6436
|
+
}
|
|
6437
|
+
continue;
|
|
6438
|
+
}
|
|
6439
|
+
for (const t of titleArr.slice(1)) {
|
|
6440
|
+
const between = matches.range(
|
|
6441
|
+
primary.end,
|
|
6442
|
+
t.start,
|
|
6443
|
+
(m) => !m.private && !!m.value && !titleish.has(m.name ?? ""),
|
|
6444
|
+
0
|
|
6445
|
+
);
|
|
6446
|
+
if (between) out.push(t);
|
|
6447
|
+
}
|
|
6448
|
+
}
|
|
6449
|
+
return out.length ? out : false;
|
|
6450
|
+
}
|
|
6451
|
+
};
|
|
6452
|
+
_RemoveTailTitle.priority = POST_PROCESS;
|
|
6453
|
+
_RemoveTailTitle.dependency = ["RenameEpisodeTitleWhenMovieType"];
|
|
6454
|
+
let RemoveTailTitle = _RemoveTailTitle;
|
|
5136
6455
|
function title(config) {
|
|
5137
6456
|
const rebulk = new Rebulk({
|
|
5138
6457
|
disabled: (context) => isDisabled(context, "title")
|
|
5139
6458
|
});
|
|
5140
|
-
rebulk.rules(TitleFromPosition, PreferTitleWithYear);
|
|
6459
|
+
rebulk.rules(CountryAtTitlePosition, TitleFromPosition, PreferTitleWithYear, ExtendLoneArticleTitle, PropertyAtTitlePositionAsTitle, RemoveNumericAlternativeTitle, RemoveTailAlternativeTitle, RemoveTailTitle);
|
|
5141
6460
|
const expectedTitle = buildExpectedFunction("expected_title");
|
|
5142
6461
|
rebulk.functional(expectedTitle, {
|
|
5143
6462
|
name: "title",
|
|
@@ -5169,87 +6488,356 @@ function episodeTitle(config) {
|
|
|
5169
6488
|
TrimLanguageFromEpisodeTitle,
|
|
5170
6489
|
Filepart3EpisodeTitle,
|
|
5171
6490
|
Filepart2EpisodeTitle,
|
|
6491
|
+
NumericEpisodeTitleToEpisode,
|
|
6492
|
+
RemoveEpisodeTitleInReleaseGroup,
|
|
6493
|
+
RemoveEpisodeMarkerWordTitle,
|
|
6494
|
+
RemoveEpisodeTitleCoveredByDetailsInGroup,
|
|
6495
|
+
RemoveFansubCreditEpisodeTitle,
|
|
6496
|
+
RemoveSubtitleDescriptorEpisodeTitle,
|
|
6497
|
+
RemoveHashFilepartJunk,
|
|
6498
|
+
RemoveTailEpisodeTitle,
|
|
5172
6499
|
RenameEpisodeTitleWhenMovieType
|
|
5173
6500
|
);
|
|
5174
6501
|
return rebulk;
|
|
5175
6502
|
}
|
|
5176
|
-
const
|
|
6503
|
+
const EPISODE_MARKER_WORDS = /* @__PURE__ */ new Set([
|
|
6504
|
+
"ep",
|
|
6505
|
+
"eps",
|
|
6506
|
+
"episode",
|
|
6507
|
+
"episodes",
|
|
6508
|
+
"episodio",
|
|
6509
|
+
"episodios",
|
|
6510
|
+
"cap",
|
|
6511
|
+
"capitulo",
|
|
6512
|
+
"capitulos",
|
|
6513
|
+
"folge",
|
|
6514
|
+
"e"
|
|
6515
|
+
]);
|
|
6516
|
+
const _RemoveEpisodeMarkerWordTitle = class _RemoveEpisodeMarkerWordTitle extends Rule {
|
|
5177
6517
|
constructor() {
|
|
5178
6518
|
super(...arguments);
|
|
5179
6519
|
this.consequence = RemoveMatch;
|
|
5180
|
-
this.previousNames = ["episode", "episode_count", "season", "season_count", "date", "title", "year"];
|
|
5181
|
-
this.nextNames = ["streaming_service", "screen_size", "source", "video_codec", "audio_codec", "other", "container"];
|
|
5182
|
-
this.affectedIfHolesAfter = ["part"];
|
|
5183
|
-
this.affectedNames = ["part", "year"];
|
|
5184
6520
|
}
|
|
5185
6521
|
when(matches, _context) {
|
|
5186
|
-
const
|
|
5187
|
-
const
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
6522
|
+
const ets = matches.named("episode_title");
|
|
6523
|
+
const etArr = Array.isArray(ets) ? ets : ets ? [ets] : [];
|
|
6524
|
+
if (!etArr.length) return false;
|
|
6525
|
+
const out = [];
|
|
6526
|
+
for (const et of etArr) {
|
|
6527
|
+
if (!EPISODE_MARKER_WORDS.has(String(et.value ?? "").trim().toLowerCase())) continue;
|
|
6528
|
+
const next = matches.range(
|
|
6529
|
+
et.end,
|
|
6530
|
+
matches.inputString?.length ?? et.end + 100,
|
|
6531
|
+
(m) => !m.private && !!m.value,
|
|
6532
|
+
0
|
|
5193
6533
|
);
|
|
5194
|
-
|
|
5195
|
-
const before = matches.range(
|
|
5196
|
-
filepart.start,
|
|
5197
|
-
match.start,
|
|
5198
|
-
(m) => !m.private,
|
|
5199
|
-
-1
|
|
5200
|
-
);
|
|
5201
|
-
if (!before || !this.previousNames.includes(before.name ?? "")) {
|
|
5202
|
-
continue;
|
|
5203
|
-
}
|
|
5204
|
-
if (before.tags?.includes("weak-episode") || before.tags?.includes("weak-duplicate")) {
|
|
5205
|
-
continue;
|
|
5206
|
-
}
|
|
5207
|
-
if (match.name === "year") {
|
|
5208
|
-
const yearGroup = matches.markers.atMatch(
|
|
5209
|
-
match,
|
|
5210
|
-
(m) => m.name === "group",
|
|
5211
|
-
0
|
|
5212
|
-
);
|
|
5213
|
-
if (yearGroup) continue;
|
|
5214
|
-
}
|
|
5215
|
-
const after = matches.range(
|
|
5216
|
-
match.end,
|
|
5217
|
-
filepart.end,
|
|
5218
|
-
(m) => !m.private,
|
|
5219
|
-
0
|
|
5220
|
-
);
|
|
5221
|
-
if (!after || !this.nextNames.includes(after.name ?? "")) {
|
|
5222
|
-
continue;
|
|
5223
|
-
}
|
|
5224
|
-
const group = matches.markers.atMatch(
|
|
5225
|
-
match,
|
|
5226
|
-
(m) => m.name === "group",
|
|
5227
|
-
0
|
|
5228
|
-
);
|
|
5229
|
-
const hasValueInSameGroup = (m) => !!(m.value && String(m.value).replace(new RegExp(`[${sepsPattern}]`, "g"), "")) && group === matches.markers.atMatch(m, (mm) => mm.name === "group", 0);
|
|
5230
|
-
const holesBefore = matches.holes(before.end, match.start, { predicate: hasValueInSameGroup });
|
|
5231
|
-
const holesAfter = matches.holes(match.end, after.start, { predicate: hasValueInSameGroup });
|
|
5232
|
-
const hasHolesBefore = hasmatch(holesBefore);
|
|
5233
|
-
const hasHolesAfter = hasmatch(holesAfter);
|
|
5234
|
-
if (!hasHolesBefore && !hasHolesAfter) {
|
|
5235
|
-
continue;
|
|
5236
|
-
}
|
|
5237
|
-
if (this.affectedIfHolesAfter.includes(match.name ?? "") && !hasHolesAfter) {
|
|
5238
|
-
continue;
|
|
5239
|
-
}
|
|
5240
|
-
toRemove.push(match);
|
|
5241
|
-
if (match.parent) {
|
|
5242
|
-
toRemove.push(match.parent);
|
|
5243
|
-
}
|
|
5244
|
-
}
|
|
6534
|
+
if (next && next.name === "episode") out.push(et);
|
|
5245
6535
|
}
|
|
5246
|
-
return
|
|
6536
|
+
return out.length ? out : false;
|
|
5247
6537
|
}
|
|
5248
6538
|
};
|
|
5249
|
-
|
|
5250
|
-
let
|
|
5251
|
-
const
|
|
5252
|
-
|
|
6539
|
+
_RemoveEpisodeMarkerWordTitle.priority = POST_PROCESS;
|
|
6540
|
+
let RemoveEpisodeMarkerWordTitle = _RemoveEpisodeMarkerWordTitle;
|
|
6541
|
+
const _RemoveHashFilepartJunk = class _RemoveHashFilepartJunk extends Rule {
|
|
6542
|
+
constructor() {
|
|
6543
|
+
super(...arguments);
|
|
6544
|
+
this.consequence = RemoveMatch;
|
|
6545
|
+
}
|
|
6546
|
+
static isHash(token) {
|
|
6547
|
+
if (/[\s._\-]/.test(token)) return false;
|
|
6548
|
+
if (/^[0-9a-f]{16,}$/i.test(token)) return true;
|
|
6549
|
+
return token.length >= 24 && /[a-z]/.test(token) && /[A-Z]/.test(token) && /\d/.test(token);
|
|
6550
|
+
}
|
|
6551
|
+
when(matches, _context) {
|
|
6552
|
+
const inp = matches.inputString ?? "";
|
|
6553
|
+
const strip2 = /* @__PURE__ */ new Set(["episode_title", "version", "episode_details", "alternative_title"]);
|
|
6554
|
+
const out = [];
|
|
6555
|
+
for (const fp of matches.markers.named("path")) {
|
|
6556
|
+
let text = inp.slice(fp.start, fp.end);
|
|
6557
|
+
const cont = matches.range(fp.start, fp.end, (m) => m.name === "container", 0);
|
|
6558
|
+
if (cont) text = inp.slice(fp.start, cont.start);
|
|
6559
|
+
if (!_RemoveHashFilepartJunk.isHash(text.replace(/[.\s]+$/, ""))) continue;
|
|
6560
|
+
for (const m of matches.range(fp.start, fp.end, (m2) => strip2.has(m2.name ?? ""))) {
|
|
6561
|
+
out.push(m);
|
|
6562
|
+
}
|
|
6563
|
+
}
|
|
6564
|
+
return out.length ? out : false;
|
|
6565
|
+
}
|
|
6566
|
+
};
|
|
6567
|
+
_RemoveHashFilepartJunk.priority = POST_PROCESS;
|
|
6568
|
+
let RemoveHashFilepartJunk = _RemoveHashFilepartJunk;
|
|
6569
|
+
const _RemoveEpisodeTitleCoveredByDetailsInGroup = class _RemoveEpisodeTitleCoveredByDetailsInGroup extends Rule {
|
|
6570
|
+
constructor() {
|
|
6571
|
+
super(...arguments);
|
|
6572
|
+
this.consequence = RemoveMatch;
|
|
6573
|
+
}
|
|
6574
|
+
when(matches, _context) {
|
|
6575
|
+
const ets = matches.named("episode_title");
|
|
6576
|
+
const etArr = Array.isArray(ets) ? ets : ets ? [ets] : [];
|
|
6577
|
+
const out = [];
|
|
6578
|
+
for (const et of etArr) {
|
|
6579
|
+
if (!matches.markers.atMatch(et, (m) => m.name === "group", 0)) continue;
|
|
6580
|
+
const covered = matches.range(
|
|
6581
|
+
et.start,
|
|
6582
|
+
et.end,
|
|
6583
|
+
(m) => m.name === "episode_details" && m.start <= et.start && m.end >= et.end,
|
|
6584
|
+
0
|
|
6585
|
+
);
|
|
6586
|
+
if (covered) out.push(et);
|
|
6587
|
+
}
|
|
6588
|
+
return out.length ? out : false;
|
|
6589
|
+
}
|
|
6590
|
+
};
|
|
6591
|
+
_RemoveEpisodeTitleCoveredByDetailsInGroup.priority = POST_PROCESS;
|
|
6592
|
+
let RemoveEpisodeTitleCoveredByDetailsInGroup = _RemoveEpisodeTitleCoveredByDetailsInGroup;
|
|
6593
|
+
const _RemoveFansubCreditEpisodeTitle = class _RemoveFansubCreditEpisodeTitle extends Rule {
|
|
6594
|
+
constructor() {
|
|
6595
|
+
super(...arguments);
|
|
6596
|
+
this.consequence = RemoveMatch;
|
|
6597
|
+
}
|
|
6598
|
+
when(matches, _context) {
|
|
6599
|
+
const ets = matches.named("episode_title");
|
|
6600
|
+
const etArr = Array.isArray(ets) ? ets : ets ? [ets] : [];
|
|
6601
|
+
const out = etArr.filter((et) => /\bfansub/i.test(String(et.value ?? "")));
|
|
6602
|
+
return out.length ? out : false;
|
|
6603
|
+
}
|
|
6604
|
+
};
|
|
6605
|
+
_RemoveFansubCreditEpisodeTitle.priority = POST_PROCESS;
|
|
6606
|
+
let RemoveFansubCreditEpisodeTitle = _RemoveFansubCreditEpisodeTitle;
|
|
6607
|
+
const _RemoveSubtitleDescriptorEpisodeTitle = class _RemoveSubtitleDescriptorEpisodeTitle extends Rule {
|
|
6608
|
+
constructor() {
|
|
6609
|
+
super(...arguments);
|
|
6610
|
+
this.consequence = RemoveMatch;
|
|
6611
|
+
}
|
|
6612
|
+
when(matches, _context) {
|
|
6613
|
+
const inp = matches.inputString ?? "";
|
|
6614
|
+
const ets = matches.named("episode_title");
|
|
6615
|
+
const etArr = Array.isArray(ets) ? ets : ets ? [ets] : [];
|
|
6616
|
+
const out = [];
|
|
6617
|
+
for (const et of etArr) {
|
|
6618
|
+
if (/[\s.]/.test(String(et.value ?? "").trim())) continue;
|
|
6619
|
+
const after = inp.slice(et.end).replace(/^[\s._-]+/, "");
|
|
6620
|
+
if (/^subtitl(e|es)\b|^subs?\b/i.test(after)) out.push(et);
|
|
6621
|
+
}
|
|
6622
|
+
return out.length ? out : false;
|
|
6623
|
+
}
|
|
6624
|
+
};
|
|
6625
|
+
_RemoveSubtitleDescriptorEpisodeTitle.priority = POST_PROCESS;
|
|
6626
|
+
let RemoveSubtitleDescriptorEpisodeTitle = _RemoveSubtitleDescriptorEpisodeTitle;
|
|
6627
|
+
const ET_STOP_WORDS = /* @__PURE__ */ new Set([
|
|
6628
|
+
"the",
|
|
6629
|
+
"a",
|
|
6630
|
+
"an",
|
|
6631
|
+
"and",
|
|
6632
|
+
"or",
|
|
6633
|
+
"of",
|
|
6634
|
+
"to",
|
|
6635
|
+
"in",
|
|
6636
|
+
"on",
|
|
6637
|
+
"at",
|
|
6638
|
+
"for",
|
|
6639
|
+
"from",
|
|
6640
|
+
"by",
|
|
6641
|
+
"with",
|
|
6642
|
+
"le",
|
|
6643
|
+
"la",
|
|
6644
|
+
"les",
|
|
6645
|
+
"de",
|
|
6646
|
+
"du",
|
|
6647
|
+
"des",
|
|
6648
|
+
"el"
|
|
6649
|
+
]);
|
|
6650
|
+
const _RemoveTailEpisodeTitle = class _RemoveTailEpisodeTitle extends Rule {
|
|
6651
|
+
constructor() {
|
|
6652
|
+
super(...arguments);
|
|
6653
|
+
this.consequence = RemoveMatch;
|
|
6654
|
+
}
|
|
6655
|
+
when(matches, _context) {
|
|
6656
|
+
const out = [];
|
|
6657
|
+
for (const fp of matches.markers.named("path")) {
|
|
6658
|
+
const ets = matches.range(fp.start, fp.end, (m) => m.name === "episode_title");
|
|
6659
|
+
const etArr = (Array.isArray(ets) ? ets : ets ? [ets] : []).slice().sort((a, b) => a.start - b.start);
|
|
6660
|
+
if (etArr.length < 2) continue;
|
|
6661
|
+
const primary = etArr[0];
|
|
6662
|
+
const head = String(primary.value ?? "").trim().toLowerCase();
|
|
6663
|
+
if (!head || ET_STOP_WORDS.has(head)) continue;
|
|
6664
|
+
for (const et of etArr.slice(1)) {
|
|
6665
|
+
const between = matches.range(
|
|
6666
|
+
primary.end,
|
|
6667
|
+
et.start,
|
|
6668
|
+
(m) => !m.private && !!m.value && !_RemoveTailEpisodeTitle.TITLEISH.has(m.name ?? ""),
|
|
6669
|
+
0
|
|
6670
|
+
);
|
|
6671
|
+
if (between) out.push(et);
|
|
6672
|
+
}
|
|
6673
|
+
}
|
|
6674
|
+
return out.length ? out : false;
|
|
6675
|
+
}
|
|
6676
|
+
};
|
|
6677
|
+
_RemoveTailEpisodeTitle.priority = POST_PROCESS;
|
|
6678
|
+
_RemoveTailEpisodeTitle.TITLEISH = /* @__PURE__ */ new Set([
|
|
6679
|
+
"year",
|
|
6680
|
+
"title",
|
|
6681
|
+
"alternative_title",
|
|
6682
|
+
"episode_title",
|
|
6683
|
+
"type",
|
|
6684
|
+
"episode",
|
|
6685
|
+
"season"
|
|
6686
|
+
]);
|
|
6687
|
+
let RemoveTailEpisodeTitle = _RemoveTailEpisodeTitle;
|
|
6688
|
+
const _RemoveEpisodeTitleInReleaseGroup = class _RemoveEpisodeTitleInReleaseGroup extends Rule {
|
|
6689
|
+
constructor() {
|
|
6690
|
+
super(...arguments);
|
|
6691
|
+
this.consequence = RemoveMatch;
|
|
6692
|
+
}
|
|
6693
|
+
when(matches, _context) {
|
|
6694
|
+
const ets = matches.named("episode_title");
|
|
6695
|
+
const etArr = Array.isArray(ets) ? ets : ets ? [ets] : [];
|
|
6696
|
+
if (!etArr.length) return false;
|
|
6697
|
+
const out = [];
|
|
6698
|
+
const inp = matches.inputString ?? "";
|
|
6699
|
+
const hasReleaseIn = (s, e) => !!matches.range(s, e, (m) => _RemoveEpisodeTitleInReleaseGroup.RELEASE_PROPS.has(m.name ?? ""), 0);
|
|
6700
|
+
const onlySeps = (s, e) => e <= s || [...inp.slice(s, e)].every((c) => "[](){} .-_".includes(c));
|
|
6701
|
+
for (const et of etArr) {
|
|
6702
|
+
const group = matches.markers.atMatch(et, (m) => m.name === "group", 0);
|
|
6703
|
+
if (!group) continue;
|
|
6704
|
+
let tag = hasReleaseIn(group.start, group.end);
|
|
6705
|
+
if (!tag) {
|
|
6706
|
+
for (const other2 of matches.markers.named("group")) {
|
|
6707
|
+
if (other2.span?.[0] === group.span?.[0]) continue;
|
|
6708
|
+
const adjacent = other2.start >= group.end && onlySeps(group.end, other2.start) || other2.end <= group.start && onlySeps(other2.end, group.start);
|
|
6709
|
+
if (adjacent && hasReleaseIn(other2.start, other2.end)) {
|
|
6710
|
+
tag = true;
|
|
6711
|
+
break;
|
|
6712
|
+
}
|
|
6713
|
+
}
|
|
6714
|
+
}
|
|
6715
|
+
if (tag) out.push(et);
|
|
6716
|
+
}
|
|
6717
|
+
return out.length ? out : false;
|
|
6718
|
+
}
|
|
6719
|
+
};
|
|
6720
|
+
_RemoveEpisodeTitleInReleaseGroup.priority = POST_PROCESS;
|
|
6721
|
+
_RemoveEpisodeTitleInReleaseGroup.RELEASE_PROPS = /* @__PURE__ */ new Set([
|
|
6722
|
+
"screen_size",
|
|
6723
|
+
"video_codec",
|
|
6724
|
+
"audio_codec",
|
|
6725
|
+
"audio_channels",
|
|
6726
|
+
"source",
|
|
6727
|
+
"color_depth",
|
|
6728
|
+
"video_profile",
|
|
6729
|
+
"audio_profile",
|
|
6730
|
+
"streaming_service",
|
|
6731
|
+
"video_bit_rate",
|
|
6732
|
+
"audio_bit_rate",
|
|
6733
|
+
"container"
|
|
6734
|
+
]);
|
|
6735
|
+
let RemoveEpisodeTitleInReleaseGroup = _RemoveEpisodeTitleInReleaseGroup;
|
|
6736
|
+
const _NumericEpisodeTitleToEpisode = class _NumericEpisodeTitleToEpisode extends Rule {
|
|
6737
|
+
constructor() {
|
|
6738
|
+
super(...arguments);
|
|
6739
|
+
this.consequence = RemoveMatch;
|
|
6740
|
+
}
|
|
6741
|
+
when(matches, _context) {
|
|
6742
|
+
const out = [];
|
|
6743
|
+
for (const fp of matches.markers.named("path")) {
|
|
6744
|
+
if (matches.range(fp.start, fp.end, (m) => m.name === "episode" && !m.private, 0)) continue;
|
|
6745
|
+
if (!matches.range(fp.start, fp.end, (m) => m.name === "season" && !m.private, 0)) continue;
|
|
6746
|
+
const ets = matches.range(fp.start, fp.end, (m) => m.name === "episode_title");
|
|
6747
|
+
for (const et of Array.isArray(ets) ? ets : ets ? [ets] : []) {
|
|
6748
|
+
if (/^\d{1,3}$/.test(String(et.value ?? "").trim())) out.push(et);
|
|
6749
|
+
}
|
|
6750
|
+
}
|
|
6751
|
+
return out.length ? out : false;
|
|
6752
|
+
}
|
|
6753
|
+
then(matches, whenResponse, _context) {
|
|
6754
|
+
for (const et of whenResponse) {
|
|
6755
|
+
matches.remove(et);
|
|
6756
|
+
et.name = "episode";
|
|
6757
|
+
et.value = parseInt(String(et.value).trim(), 10);
|
|
6758
|
+
matches.append(et);
|
|
6759
|
+
}
|
|
6760
|
+
}
|
|
6761
|
+
};
|
|
6762
|
+
_NumericEpisodeTitleToEpisode.priority = POST_PROCESS;
|
|
6763
|
+
let NumericEpisodeTitleToEpisode = _NumericEpisodeTitleToEpisode;
|
|
6764
|
+
const _RemoveConflictsWithEpisodeTitle = class _RemoveConflictsWithEpisodeTitle extends Rule {
|
|
6765
|
+
constructor() {
|
|
6766
|
+
super(...arguments);
|
|
6767
|
+
this.consequence = RemoveMatch;
|
|
6768
|
+
this.previousNames = ["episode", "episode_count", "season", "season_count", "date", "title", "year"];
|
|
6769
|
+
this.nextNames = ["streaming_service", "screen_size", "source", "video_codec", "audio_codec", "other", "container"];
|
|
6770
|
+
this.affectedIfHolesAfter = ["part"];
|
|
6771
|
+
this.affectedNames = ["part", "year"];
|
|
6772
|
+
}
|
|
6773
|
+
when(matches, _context) {
|
|
6774
|
+
const toRemove = [];
|
|
6775
|
+
const fileparts = matches.markers.named("path");
|
|
6776
|
+
for (const filepart of fileparts) {
|
|
6777
|
+
const affectedMatches = matches.range(
|
|
6778
|
+
filepart.start,
|
|
6779
|
+
filepart.end,
|
|
6780
|
+
(m) => this.affectedNames.includes(m.name ?? "")
|
|
6781
|
+
);
|
|
6782
|
+
for (const match of affectedMatches) {
|
|
6783
|
+
const before = matches.range(
|
|
6784
|
+
filepart.start,
|
|
6785
|
+
match.start,
|
|
6786
|
+
(m) => !m.private,
|
|
6787
|
+
-1
|
|
6788
|
+
);
|
|
6789
|
+
if (!before || !this.previousNames.includes(before.name ?? "")) {
|
|
6790
|
+
continue;
|
|
6791
|
+
}
|
|
6792
|
+
if (before.tags?.includes("weak-episode") || before.tags?.includes("weak-duplicate")) {
|
|
6793
|
+
continue;
|
|
6794
|
+
}
|
|
6795
|
+
if (match.name === "year") {
|
|
6796
|
+
const yearGroup = matches.markers.atMatch(
|
|
6797
|
+
match,
|
|
6798
|
+
(m) => m.name === "group",
|
|
6799
|
+
0
|
|
6800
|
+
);
|
|
6801
|
+
if (yearGroup) continue;
|
|
6802
|
+
}
|
|
6803
|
+
const after = matches.range(
|
|
6804
|
+
match.end,
|
|
6805
|
+
filepart.end,
|
|
6806
|
+
(m) => !m.private,
|
|
6807
|
+
0
|
|
6808
|
+
);
|
|
6809
|
+
if (!after || !this.nextNames.includes(after.name ?? "")) {
|
|
6810
|
+
continue;
|
|
6811
|
+
}
|
|
6812
|
+
const group = matches.markers.atMatch(
|
|
6813
|
+
match,
|
|
6814
|
+
(m) => m.name === "group",
|
|
6815
|
+
0
|
|
6816
|
+
);
|
|
6817
|
+
const hasValueInSameGroup = (m) => !!(m.value && String(m.value).replace(new RegExp(`[${sepsPattern}]`, "g"), "")) && group === matches.markers.atMatch(m, (mm) => mm.name === "group", 0);
|
|
6818
|
+
const holesBefore = matches.holes(before.end, match.start, { predicate: hasValueInSameGroup });
|
|
6819
|
+
const holesAfter = matches.holes(match.end, after.start, { predicate: hasValueInSameGroup });
|
|
6820
|
+
const hasHolesBefore = hasmatch(holesBefore);
|
|
6821
|
+
const hasHolesAfter = hasmatch(holesAfter);
|
|
6822
|
+
if (!hasHolesBefore && !hasHolesAfter) {
|
|
6823
|
+
continue;
|
|
6824
|
+
}
|
|
6825
|
+
if (this.affectedIfHolesAfter.includes(match.name ?? "") && !hasHolesAfter) {
|
|
6826
|
+
continue;
|
|
6827
|
+
}
|
|
6828
|
+
toRemove.push(match);
|
|
6829
|
+
if (match.parent) {
|
|
6830
|
+
toRemove.push(match.parent);
|
|
6831
|
+
}
|
|
6832
|
+
}
|
|
6833
|
+
}
|
|
6834
|
+
return toRemove;
|
|
6835
|
+
}
|
|
6836
|
+
};
|
|
6837
|
+
_RemoveConflictsWithEpisodeTitle.priority = 64;
|
|
6838
|
+
let RemoveConflictsWithEpisodeTitle = _RemoveConflictsWithEpisodeTitle;
|
|
6839
|
+
const _TitleToEpisodeTitle = class _TitleToEpisodeTitle extends Rule {
|
|
6840
|
+
when(matches, _context) {
|
|
5253
6841
|
const titles = matches.named("title");
|
|
5254
6842
|
const titleGroups = {};
|
|
5255
6843
|
for (const title2 of titles) {
|
|
@@ -5345,7 +6933,14 @@ const _EpisodeTitleFromPosition = class _EpisodeTitleFromPosition extends Rule {
|
|
|
5345
6933
|
this.previousNames = ["episode", "episode_count", "season", "season_count", "date", "title", "year"];
|
|
5346
6934
|
}
|
|
5347
6935
|
isIgnored(match) {
|
|
5348
|
-
|
|
6936
|
+
if (!(match.name === "language" || match.name === "country" || match.name === "episode_details")) {
|
|
6937
|
+
return false;
|
|
6938
|
+
}
|
|
6939
|
+
const raw = match.raw ?? "";
|
|
6940
|
+
if (match.end - match.start > 3 && raw !== "" && raw === raw.toUpperCase() && raw !== raw.toLowerCase()) {
|
|
6941
|
+
return false;
|
|
6942
|
+
}
|
|
6943
|
+
return true;
|
|
5349
6944
|
}
|
|
5350
6945
|
when(matches, _context) {
|
|
5351
6946
|
const toAppend = [];
|
|
@@ -5377,7 +6972,44 @@ const _EpisodeTitleFromPosition = class _EpisodeTitleFromPosition extends Rule {
|
|
|
5377
6972
|
predicate: (m) => !!m.value
|
|
5378
6973
|
});
|
|
5379
6974
|
const holeArray = Array.isArray(holesResult) ? holesResult : holesResult ? [holesResult] : [];
|
|
6975
|
+
const inp = matches.inputString || "";
|
|
5380
6976
|
for (const hole of holeArray) {
|
|
6977
|
+
const groupMarker = matches.markers?.atMatch?.(hole, (m) => m.name === "group", 0);
|
|
6978
|
+
if (groupMarker) {
|
|
6979
|
+
const yearInGroup = matches.range(
|
|
6980
|
+
groupMarker.start,
|
|
6981
|
+
groupMarker.end,
|
|
6982
|
+
(m) => (m.name === "year" || m.name === "date") && !m.private,
|
|
6983
|
+
0
|
|
6984
|
+
);
|
|
6985
|
+
if (yearInGroup) continue;
|
|
6986
|
+
}
|
|
6987
|
+
const cropName = (m) => m.name === "language" || m.name === "country";
|
|
6988
|
+
const fpLangsRaw = matches.range(filepart.start, filepart.end, (m) => cropName(m));
|
|
6989
|
+
const langArr = Array.isArray(fpLangsRaw) ? fpLangsRaw : fpLangsRaw ? [fpLangsRaw] : [];
|
|
6990
|
+
let guard = 0;
|
|
6991
|
+
while (guard++ < 64) {
|
|
6992
|
+
let e = hole.end;
|
|
6993
|
+
while (e > hole.start && seps.includes(inp[e - 1])) e--;
|
|
6994
|
+
if (e <= hole.start) break;
|
|
6995
|
+
const cover = langArr.find((m) => m.start <= e - 1 && m.end >= e);
|
|
6996
|
+
if (cover && cover.start < hole.end) {
|
|
6997
|
+
hole.end = Math.min(hole.end, cover.start);
|
|
6998
|
+
} else break;
|
|
6999
|
+
}
|
|
7000
|
+
guard = 0;
|
|
7001
|
+
while (guard++ < 64) {
|
|
7002
|
+
let s = hole.start;
|
|
7003
|
+
while (s < hole.end && seps.includes(inp[s])) s++;
|
|
7004
|
+
if (s >= hole.end) break;
|
|
7005
|
+
const cover = langArr.find((m) => m.start <= s && m.end >= s + 1);
|
|
7006
|
+
if (cover && cover.end > hole.start) {
|
|
7007
|
+
hole.start = Math.max(hole.start, cover.end);
|
|
7008
|
+
} else break;
|
|
7009
|
+
}
|
|
7010
|
+
while (hole.start < hole.end && seps.includes(inp[hole.start])) hole.start++;
|
|
7011
|
+
while (hole.end > hole.start && seps.includes(inp[hole.end - 1])) hole.end--;
|
|
7012
|
+
if (hole.end <= hole.start || !hole.value) continue;
|
|
5381
7013
|
const prevPred = (m) => !m.private && this.previousNames.includes(m.name ?? "");
|
|
5382
7014
|
const prevMatches = matches.range(filepart.start, hole.start, prevPred);
|
|
5383
7015
|
const prevArr = Array.isArray(prevMatches) ? prevMatches : prevMatches ? [prevMatches] : [];
|
|
@@ -5682,7 +7314,7 @@ const LANGUAGES = [
|
|
|
5682
7314
|
{ alpha3: "fin", alpha2: "fi", name: "Finnish", opensubtitles: "fin" },
|
|
5683
7315
|
{ alpha3: "hun", alpha2: "hu", name: "Hungarian", opensubtitles: "hun" },
|
|
5684
7316
|
{ alpha3: "ces", alpha2: "cs", name: "Czech", opensubtitles: "cze" },
|
|
5685
|
-
{ alpha3: "
|
|
7317
|
+
{ alpha3: "ron", alpha2: "ro", name: "Romanian", opensubtitles: "rum" },
|
|
5686
7318
|
{ alpha3: "ukr", alpha2: "uk", name: "Ukrainian", opensubtitles: "ukr" },
|
|
5687
7319
|
{ alpha3: "heb", alpha2: "he", name: "Hebrew", opensubtitles: "heb" },
|
|
5688
7320
|
{ alpha3: "cat", alpha2: "ca", name: "Catalan", opensubtitles: "cat" },
|
|
@@ -6029,23 +7661,33 @@ class LanguageFinder {
|
|
|
6029
7661
|
regularLangMap.get(key).add(match);
|
|
6030
7662
|
}
|
|
6031
7663
|
}
|
|
7664
|
+
const emitted = /* @__PURE__ */ new Set();
|
|
7665
|
+
const emit = (m) => {
|
|
7666
|
+
const key = `${m.propertyName}:${m.word.start}-${m.word.end}:${m.lang.alpha3}`;
|
|
7667
|
+
if (emitted.has(key)) return void 0;
|
|
7668
|
+
emitted.add(key);
|
|
7669
|
+
return this.toRebulkMatch(m);
|
|
7670
|
+
};
|
|
6032
7671
|
for (const [key, values] of multiMap) {
|
|
6033
7672
|
if (regularLangMap.has(key) || !undeterminedMap.has(key)) {
|
|
6034
7673
|
for (const value of values) {
|
|
6035
|
-
|
|
7674
|
+
const r = emit(value);
|
|
7675
|
+
if (r) yield r;
|
|
6036
7676
|
}
|
|
6037
7677
|
}
|
|
6038
7678
|
}
|
|
6039
7679
|
for (const [key, values] of undeterminedMap) {
|
|
6040
7680
|
if (!regularLangMap.has(key)) {
|
|
6041
7681
|
for (const value of values) {
|
|
6042
|
-
|
|
7682
|
+
const r = emit(value);
|
|
7683
|
+
if (r) yield r;
|
|
6043
7684
|
}
|
|
6044
7685
|
}
|
|
6045
7686
|
}
|
|
6046
7687
|
for (const values of regularLangMap.values()) {
|
|
6047
7688
|
for (const value of values) {
|
|
6048
|
-
|
|
7689
|
+
const r = emit(value);
|
|
7690
|
+
if (r) yield r;
|
|
6049
7691
|
}
|
|
6050
7692
|
}
|
|
6051
7693
|
}
|
|
@@ -6167,7 +7809,13 @@ class LanguageFinder {
|
|
|
6167
7809
|
let matchEnd = currentWord.end;
|
|
6168
7810
|
if (currentWord !== word) {
|
|
6169
7811
|
const trimmedValue = value.trim();
|
|
6170
|
-
if (trimmedValue &&
|
|
7812
|
+
if (trimmedValue && word && word.value.toLowerCase() === trimmedValue) {
|
|
7813
|
+
matchStart = word.start;
|
|
7814
|
+
matchEnd = word.end;
|
|
7815
|
+
} else if (trimmedValue && word && word.nextWord && word.nextWord.value.toLowerCase() === trimmedValue) {
|
|
7816
|
+
matchStart = word.nextWord.start;
|
|
7817
|
+
matchEnd = word.nextWord.end;
|
|
7818
|
+
} else if (trimmedValue && fallbackWord) {
|
|
6171
7819
|
matchStart = fallbackWord.start;
|
|
6172
7820
|
matchEnd = fallbackWord.end;
|
|
6173
7821
|
}
|
|
@@ -6410,40 +8058,41 @@ const _SubtitleExtensionRule = class _SubtitleExtensionRule extends Rule {
|
|
|
6410
8058
|
};
|
|
6411
8059
|
_SubtitleExtensionRule.SUBTITLE_EXTENSIONS = /* @__PURE__ */ new Set(["srt", "sub", "smi", "ssa", "ass", "vtt", "idx", "sup"]);
|
|
6412
8060
|
let SubtitleExtensionRule = _SubtitleExtensionRule;
|
|
6413
|
-
class
|
|
8061
|
+
const _RemoveCommonWordsLanguageRule = class _RemoveCommonWordsLanguageRule extends Rule {
|
|
6414
8062
|
constructor() {
|
|
6415
8063
|
super(...arguments);
|
|
6416
8064
|
this.consequence = RemoveMatch;
|
|
6417
8065
|
this.priority = 32;
|
|
6418
8066
|
}
|
|
6419
|
-
when(matches,
|
|
8067
|
+
when(matches, _context) {
|
|
6420
8068
|
const toRemove = [];
|
|
6421
|
-
const
|
|
6422
|
-
const
|
|
6423
|
-
for (const
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
toRemove.push(...commonOutsideGroups);
|
|
6441
|
-
}
|
|
8069
|
+
const all = matches.range?.(0, matches.inputString?.length ?? 0, (m) => m.name === "language" || m.name === "subtitle_language") || [];
|
|
8070
|
+
const allArr = Array.isArray(all) ? all : all ? [all] : [];
|
|
8071
|
+
for (const match of allArr) {
|
|
8072
|
+
if (!match.tags?.includes("common")) continue;
|
|
8073
|
+
const group = matches.markers?.atMatch?.(match, (m) => m.name === "group", 0);
|
|
8074
|
+
if (group) {
|
|
8075
|
+
const nonLang = matches.range?.(
|
|
8076
|
+
group.start,
|
|
8077
|
+
group.end,
|
|
8078
|
+
(m) => m.name !== "language" && m.name !== "subtitle_language"
|
|
8079
|
+
);
|
|
8080
|
+
const hasNonLang = Array.isArray(nonLang) ? nonLang.length > 0 : !!nonLang;
|
|
8081
|
+
const holesRes = matches.holes?.(
|
|
8082
|
+
group.start,
|
|
8083
|
+
group.end,
|
|
8084
|
+
{ predicate: (m) => m.value && [...String(m.value)].some((c) => !seps.includes(c)) }
|
|
8085
|
+
);
|
|
8086
|
+
const hasContentHoles = Array.isArray(holesRes) ? holesRes.length > 0 : !!holesRes;
|
|
8087
|
+
if (!hasNonLang && !hasContentHoles) continue;
|
|
6442
8088
|
}
|
|
8089
|
+
toRemove.push(match);
|
|
6443
8090
|
}
|
|
6444
8091
|
return toRemove.length > 0 ? toRemove : false;
|
|
6445
8092
|
}
|
|
6446
|
-
}
|
|
8093
|
+
};
|
|
8094
|
+
_RemoveCommonWordsLanguageRule.priority = 32;
|
|
8095
|
+
let RemoveCommonWordsLanguageRule = _RemoveCommonWordsLanguageRule;
|
|
6447
8096
|
class RemoveLanguageRule extends Rule {
|
|
6448
8097
|
constructor() {
|
|
6449
8098
|
super(...arguments);
|
|
@@ -6456,7 +8105,7 @@ class RemoveLanguageRule extends Rule {
|
|
|
6456
8105
|
return matches.named("language") || false;
|
|
6457
8106
|
}
|
|
6458
8107
|
}
|
|
6459
|
-
class
|
|
8108
|
+
const _RemoveUndeterminedLanguagesRule = class _RemoveUndeterminedLanguagesRule extends Rule {
|
|
6460
8109
|
constructor() {
|
|
6461
8110
|
super(...arguments);
|
|
6462
8111
|
this.consequence = RemoveMatch;
|
|
@@ -6477,6 +8126,36 @@ class RemoveUndeterminedLanguagesRule2 extends Rule {
|
|
|
6477
8126
|
}
|
|
6478
8127
|
return toRemove.length > 0 ? toRemove : false;
|
|
6479
8128
|
}
|
|
8129
|
+
};
|
|
8130
|
+
_RemoveUndeterminedLanguagesRule.priority = 32;
|
|
8131
|
+
let RemoveUndeterminedLanguagesRule = _RemoveUndeterminedLanguagesRule;
|
|
8132
|
+
class DedupLanguageRule extends Rule {
|
|
8133
|
+
constructor() {
|
|
8134
|
+
super(...arguments);
|
|
8135
|
+
this.consequence = RemoveMatch;
|
|
8136
|
+
this.dependency = [SubtitlePrefixLanguageRule, SubtitleSuffixLanguageRule, SubtitleExtensionRule];
|
|
8137
|
+
}
|
|
8138
|
+
identity(match) {
|
|
8139
|
+
const v = match.value;
|
|
8140
|
+
if (v instanceof Language) {
|
|
8141
|
+
const country2 = v.country;
|
|
8142
|
+
return `${v.alpha3}:${country2 ? String(country2) : ""}`;
|
|
8143
|
+
}
|
|
8144
|
+
return String(v);
|
|
8145
|
+
}
|
|
8146
|
+
when(matches) {
|
|
8147
|
+
const toRemove = [];
|
|
8148
|
+
for (const name of ["language", "subtitle_language"]) {
|
|
8149
|
+
const list = [...matches.named(name) || []].sort((a, b) => a.start - b.start || a.end - b.end);
|
|
8150
|
+
const seen = /* @__PURE__ */ new Set();
|
|
8151
|
+
for (const m of list) {
|
|
8152
|
+
const key = `${m.start}-${m.end}:${this.identity(m)}`;
|
|
8153
|
+
if (seen.has(key)) toRemove.push(m);
|
|
8154
|
+
else seen.add(key);
|
|
8155
|
+
}
|
|
8156
|
+
}
|
|
8157
|
+
return toRemove.length > 0 ? toRemove : false;
|
|
8158
|
+
}
|
|
6480
8159
|
}
|
|
6481
8160
|
function language(config, commonWords) {
|
|
6482
8161
|
const subtitleBoth = config.subtitle_affixes;
|
|
@@ -6543,7 +8222,7 @@ function language(config, commonWords) {
|
|
|
6543
8222
|
},
|
|
6544
8223
|
{
|
|
6545
8224
|
properties: { language: [null] },
|
|
6546
|
-
disabled: (context) => isDisabled(context, "language")
|
|
8225
|
+
disabled: (context) => isDisabled(context, "language") && isDisabled(context, "subtitle_language")
|
|
6547
8226
|
}
|
|
6548
8227
|
);
|
|
6549
8228
|
rebulk.rules(
|
|
@@ -6552,10 +8231,38 @@ function language(config, commonWords) {
|
|
|
6552
8231
|
SubtitleExtensionRule,
|
|
6553
8232
|
RemoveCommonWordsLanguageRule,
|
|
6554
8233
|
RemoveLanguageRule,
|
|
6555
|
-
|
|
8234
|
+
RemoveUndeterminedLanguagesRule,
|
|
8235
|
+
DedupLanguageRule,
|
|
8236
|
+
RemoveLanguageInsideTitle
|
|
6556
8237
|
);
|
|
6557
8238
|
return rebulk;
|
|
6558
8239
|
}
|
|
8240
|
+
const _RemoveLanguageInsideTitle = class _RemoveLanguageInsideTitle extends Rule {
|
|
8241
|
+
constructor() {
|
|
8242
|
+
super(...arguments);
|
|
8243
|
+
this.consequence = RemoveMatch;
|
|
8244
|
+
}
|
|
8245
|
+
when(matches) {
|
|
8246
|
+
const titleNames = /* @__PURE__ */ new Set(["title", "episode_title", "alternative_title"]);
|
|
8247
|
+
const titles = matches.range(
|
|
8248
|
+
0,
|
|
8249
|
+
(matches.inputString ?? "").length,
|
|
8250
|
+
(m) => titleNames.has(m.name ?? "")
|
|
8251
|
+
);
|
|
8252
|
+
if (!titles.length) return false;
|
|
8253
|
+
const out = [];
|
|
8254
|
+
for (const name of ["language", "subtitle_language"]) {
|
|
8255
|
+
for (const lang of matches.named(name)) {
|
|
8256
|
+
const rawLen = String(lang.raw ?? "").trim().length;
|
|
8257
|
+
if (rawLen > 3) continue;
|
|
8258
|
+
if (titles.some((t) => t.start <= lang.start && t.end >= lang.end)) out.push(lang);
|
|
8259
|
+
}
|
|
8260
|
+
}
|
|
8261
|
+
return out.length ? out : false;
|
|
8262
|
+
}
|
|
8263
|
+
};
|
|
8264
|
+
_RemoveLanguageInsideTitle.priority = POST_PROCESS;
|
|
8265
|
+
let RemoveLanguageInsideTitle = _RemoveLanguageInsideTitle;
|
|
6559
8266
|
const COUNTRY_MAP = {
|
|
6560
8267
|
"us": "US",
|
|
6561
8268
|
"usa": "US",
|
|
@@ -6695,9 +8402,24 @@ function releaseGroup(config) {
|
|
|
6695
8402
|
return rebulk.rules(
|
|
6696
8403
|
new DashSeparatedReleaseGroup(cleanGroupname),
|
|
6697
8404
|
new SceneReleaseGroup(cleanGroupname),
|
|
6698
|
-
AnimeReleaseGroup
|
|
8405
|
+
AnimeReleaseGroup,
|
|
8406
|
+
new TrailingTokenAfterEpisodeAsReleaseGroup(cleanGroupname),
|
|
8407
|
+
RemoveSeasonPackReleaseGroup
|
|
6699
8408
|
);
|
|
6700
8409
|
}
|
|
8410
|
+
const _RemoveSeasonPackReleaseGroup = class _RemoveSeasonPackReleaseGroup extends Rule {
|
|
8411
|
+
constructor() {
|
|
8412
|
+
super(...arguments);
|
|
8413
|
+
this.consequence = RemoveMatch;
|
|
8414
|
+
}
|
|
8415
|
+
when(matches) {
|
|
8416
|
+
const rgs = matches.named("release_group");
|
|
8417
|
+
const out = (Array.isArray(rgs) ? rgs : rgs ? [rgs] : []).filter((m) => /(^|[\s._\-\[(])seasons?[\s._-]*\d/i.test(String(m.value ?? "")));
|
|
8418
|
+
return out.length ? out : false;
|
|
8419
|
+
}
|
|
8420
|
+
};
|
|
8421
|
+
_RemoveSeasonPackReleaseGroup.priority = POST_PROCESS;
|
|
8422
|
+
let RemoveSeasonPackReleaseGroup = _RemoveSeasonPackReleaseGroup;
|
|
6701
8423
|
class DashSeparatedReleaseGroup extends Rule {
|
|
6702
8424
|
constructor(valueFormatter) {
|
|
6703
8425
|
super();
|
|
@@ -6712,6 +8434,17 @@ class DashSeparatedReleaseGroup extends Rule {
|
|
|
6712
8434
|
if (matches.markers.atMatch(candidate, (m) => m.name === "group", 0)) {
|
|
6713
8435
|
return false;
|
|
6714
8436
|
}
|
|
8437
|
+
if (matches.range(candidate.start, candidate.end, (m) => m.name === "episode", 0)) {
|
|
8438
|
+
return false;
|
|
8439
|
+
}
|
|
8440
|
+
if (candidate.start === start && matches.range(
|
|
8441
|
+
candidate.end,
|
|
8442
|
+
end,
|
|
8443
|
+
(m) => ["season", "episode", "date"].includes(m.name ?? "") && !m.private,
|
|
8444
|
+
0
|
|
8445
|
+
)) {
|
|
8446
|
+
return false;
|
|
8447
|
+
}
|
|
6715
8448
|
const firstHole = matches.holes(
|
|
6716
8449
|
candidate.end,
|
|
6717
8450
|
end,
|
|
@@ -6951,7 +8684,11 @@ const _AnimeReleaseGroup = class _AnimeReleaseGroup extends Rule {
|
|
|
6951
8684
|
(mm) => !mm.tags.includes("weak-language")
|
|
6952
8685
|
);
|
|
6953
8686
|
if (innerMatches.length === 0) return true;
|
|
6954
|
-
|
|
8687
|
+
if (innerMatches.every((mm) => mm.name === "other")) return true;
|
|
8688
|
+
if (m.start === filepart.start && innerMatches.every((mm) => mm.name === "container" && mm.tags?.includes("subtitle"))) {
|
|
8689
|
+
return true;
|
|
8690
|
+
}
|
|
8691
|
+
return false;
|
|
6955
8692
|
};
|
|
6956
8693
|
const emptyGroup = matches.markers.range(
|
|
6957
8694
|
filepart.start,
|
|
@@ -6970,7 +8707,7 @@ const _AnimeReleaseGroup = class _AnimeReleaseGroup extends Rule {
|
|
|
6970
8707
|
...matches.range(
|
|
6971
8708
|
emptyGroup.start,
|
|
6972
8709
|
emptyGroup.end,
|
|
6973
|
-
(m) => m.tags.includes("weak-language") || m.name === "other"
|
|
8710
|
+
(m) => m.tags.includes("weak-language") || m.name === "other" || m.name === "container" && m.tags?.includes("subtitle")
|
|
6974
8711
|
)
|
|
6975
8712
|
);
|
|
6976
8713
|
}
|
|
@@ -6985,6 +8722,57 @@ _AnimeReleaseGroup.dependency = ["SceneReleaseGroup", "TitleFromPosition"];
|
|
|
6985
8722
|
_AnimeReleaseGroup.consequence = [RemoveMatch, AppendMatch];
|
|
6986
8723
|
_AnimeReleaseGroup.properties = { release_group: [null] };
|
|
6987
8724
|
let AnimeReleaseGroup = _AnimeReleaseGroup;
|
|
8725
|
+
const _TrailingTokenAfterEpisodeAsReleaseGroup = class _TrailingTokenAfterEpisodeAsReleaseGroup extends Rule {
|
|
8726
|
+
constructor(valueFormatter) {
|
|
8727
|
+
super();
|
|
8728
|
+
this.consequence = [RemoveMatch, AppendMatch];
|
|
8729
|
+
this.valueFormatter = valueFormatter;
|
|
8730
|
+
}
|
|
8731
|
+
when(matches) {
|
|
8732
|
+
if (matches.named("release_group").length > 0) return false;
|
|
8733
|
+
const inp = matches.inputString ?? "";
|
|
8734
|
+
const toRemove = [];
|
|
8735
|
+
const toAppend = [];
|
|
8736
|
+
for (const filepart of matches.markers.named("path")) {
|
|
8737
|
+
const last = matches.range(
|
|
8738
|
+
filepart.start,
|
|
8739
|
+
filepart.end,
|
|
8740
|
+
(m) => !m.private && m.name === "episode_title" && m.value,
|
|
8741
|
+
-1
|
|
8742
|
+
);
|
|
8743
|
+
if (!last) continue;
|
|
8744
|
+
const after = matches.range(
|
|
8745
|
+
last.end,
|
|
8746
|
+
filepart.end,
|
|
8747
|
+
(m) => !m.private && m.span[0] !== m.span[1],
|
|
8748
|
+
0
|
|
8749
|
+
);
|
|
8750
|
+
if (after) continue;
|
|
8751
|
+
const raw = String(last.raw ?? last.value);
|
|
8752
|
+
if (/[\s.]/.test(raw.trim())) continue;
|
|
8753
|
+
if (inp[last.start - 1] !== "-") continue;
|
|
8754
|
+
const prev = matches.range(
|
|
8755
|
+
filepart.start,
|
|
8756
|
+
last.start,
|
|
8757
|
+
(m) => !m.private,
|
|
8758
|
+
-1
|
|
8759
|
+
);
|
|
8760
|
+
if (!prev || !["episode", "absolute_episode"].includes(prev.name ?? "")) continue;
|
|
8761
|
+
const rg = new Match(last.start, last.end, {
|
|
8762
|
+
name: "release_group",
|
|
8763
|
+
inputString: inp
|
|
8764
|
+
});
|
|
8765
|
+
rg.formatter = this.valueFormatter;
|
|
8766
|
+
if (rg.value) {
|
|
8767
|
+
toRemove.push(last);
|
|
8768
|
+
toAppend.push(rg);
|
|
8769
|
+
}
|
|
8770
|
+
}
|
|
8771
|
+
return toRemove.length || toAppend.length ? [toRemove, toAppend] : false;
|
|
8772
|
+
}
|
|
8773
|
+
};
|
|
8774
|
+
_TrailingTokenAfterEpisodeAsReleaseGroup.dependency = ["AnimeReleaseGroup"];
|
|
8775
|
+
let TrailingTokenAfterEpisodeAsReleaseGroup = _TrailingTokenAfterEpisodeAsReleaseGroup;
|
|
6988
8776
|
function streamingService(config) {
|
|
6989
8777
|
const rebulk = new Rebulk({ disabled: (context) => isDisabled(context, "streaming_service") });
|
|
6990
8778
|
rebulk.stringDefaults({ ignoreCase: true }).regexDefaults({ flags: "i", abbreviations: [dash] });
|
|
@@ -6998,7 +8786,17 @@ const _ValidateStreamingService = class _ValidateStreamingService extends Rule {
|
|
|
6998
8786
|
const toRemove = [];
|
|
6999
8787
|
const allServices = matches.named("streaming_service");
|
|
7000
8788
|
if (process.env.DEBUG_SS) console.log(`[VS.when] allServices count=${allServices.length}`);
|
|
8789
|
+
const inp = matches.inputString || "";
|
|
7001
8790
|
for (const service of allServices) {
|
|
8791
|
+
const rawLen = (service.raw ?? "").length;
|
|
8792
|
+
if (rawLen <= 3) {
|
|
8793
|
+
const charAfter = inp[service.end];
|
|
8794
|
+
const charBefore = inp[service.start - 1];
|
|
8795
|
+
if (charAfter && /[a-z0-9]/i.test(charAfter) || charBefore && /[a-z0-9]/i.test(charBefore)) {
|
|
8796
|
+
toRemove.push(service);
|
|
8797
|
+
continue;
|
|
8798
|
+
}
|
|
8799
|
+
}
|
|
7002
8800
|
const suffixPred = (m) => !m.private && m.tags?.includes("streaming_service.suffix");
|
|
7003
8801
|
const prefixPred = (m) => !m.private && m.tags?.includes("streaming_service.prefix");
|
|
7004
8802
|
const suffixMatches = matches.range(service.end, service.end + 30, suffixPred);
|
|
@@ -7066,11 +8864,60 @@ function other(config) {
|
|
|
7066
8864
|
ValidateStreamingServiceNeighbor,
|
|
7067
8865
|
ValidateAtEnd,
|
|
7068
8866
|
ValidateReal,
|
|
8867
|
+
RemoveTitleCaseAmbiguous,
|
|
8868
|
+
ImageArtKeywordToOther,
|
|
7069
8869
|
ProperCountRule,
|
|
7070
8870
|
FixCountRule
|
|
7071
8871
|
);
|
|
7072
8872
|
return rebulk;
|
|
7073
8873
|
}
|
|
8874
|
+
const ART_KEYWORDS = {
|
|
8875
|
+
poster: "Poster",
|
|
8876
|
+
fanart: "Fanart",
|
|
8877
|
+
banner: "Banner",
|
|
8878
|
+
thumb: "Thumbnail",
|
|
8879
|
+
thumbnail: "Thumbnail",
|
|
8880
|
+
landscape: "Landscape",
|
|
8881
|
+
cover: "Cover",
|
|
8882
|
+
clearart: "Clear Art",
|
|
8883
|
+
clearlogo: "Clear Logo",
|
|
8884
|
+
logo: "Logo",
|
|
8885
|
+
discart: "Disc Art"
|
|
8886
|
+
};
|
|
8887
|
+
const _ImageArtKeywordToOther = class _ImageArtKeywordToOther extends Rule {
|
|
8888
|
+
constructor() {
|
|
8889
|
+
super(...arguments);
|
|
8890
|
+
this.consequence = [RemoveMatch, AppendMatch];
|
|
8891
|
+
}
|
|
8892
|
+
when(matches) {
|
|
8893
|
+
const toRemove = [];
|
|
8894
|
+
const toAppend = [];
|
|
8895
|
+
for (const fp of matches.markers.named("path")) {
|
|
8896
|
+
const hasImage = matches.range(
|
|
8897
|
+
fp.start,
|
|
8898
|
+
fp.end,
|
|
8899
|
+
(m) => m.name === "container" && m.tags?.includes("image"),
|
|
8900
|
+
0
|
|
8901
|
+
);
|
|
8902
|
+
if (!hasImage) continue;
|
|
8903
|
+
const cands = matches.range(
|
|
8904
|
+
fp.start,
|
|
8905
|
+
fp.end,
|
|
8906
|
+
(m) => ["title", "alternative_title", "episode_title"].includes(m.name ?? "")
|
|
8907
|
+
);
|
|
8908
|
+
for (const c of cands) {
|
|
8909
|
+
const key = String(c.value ?? "").trim().toLowerCase().replace(/[\s._-]+/g, "");
|
|
8910
|
+
const canon = ART_KEYWORDS[key];
|
|
8911
|
+
if (!canon) continue;
|
|
8912
|
+
toRemove.push(c);
|
|
8913
|
+
toAppend.push(new Match(c.start, c.end, { name: "other", value: canon, inputString: matches.inputString }));
|
|
8914
|
+
}
|
|
8915
|
+
}
|
|
8916
|
+
return toRemove.length ? [toRemove, toAppend] : false;
|
|
8917
|
+
}
|
|
8918
|
+
};
|
|
8919
|
+
_ImageArtKeywordToOther.priority = POST_PROCESS;
|
|
8920
|
+
let ImageArtKeywordToOther = _ImageArtKeywordToOther;
|
|
7074
8921
|
function completeWords(rebulk, seasonWords, completeArticleWords) {
|
|
7075
8922
|
const seasonWordsPattern = buildOrPattern(seasonWords);
|
|
7076
8923
|
const completeArticleWordsPattern = buildOrPattern(completeArticleWords);
|
|
@@ -7136,7 +8983,7 @@ let ProperCountRule = _ProperCountRule;
|
|
|
7136
8983
|
const _FixCountRule = class _FixCountRule extends Rule {
|
|
7137
8984
|
when(matches) {
|
|
7138
8985
|
const fixes = matches.named("other", (m2) => m2.value === "Fix").filter((m2) => {
|
|
7139
|
-
const raw = rawCleanup(m2.raw).toLowerCase();
|
|
8986
|
+
const raw = rawCleanup(m2.raw ?? "").toLowerCase();
|
|
7140
8987
|
return raw === "fix" || raw === "fixed";
|
|
7141
8988
|
});
|
|
7142
8989
|
if (!fixes || fixes.length === 0) return;
|
|
@@ -7379,6 +9226,23 @@ const _ValidateAtEnd = class _ValidateAtEnd extends Rule {
|
|
|
7379
9226
|
_ValidateAtEnd.priority = 32;
|
|
7380
9227
|
_ValidateAtEnd.consequence = RemoveMatch;
|
|
7381
9228
|
let ValidateAtEnd = _ValidateAtEnd;
|
|
9229
|
+
const _RemoveTitleCaseAmbiguous = class _RemoveTitleCaseAmbiguous extends Rule {
|
|
9230
|
+
// Exact Title-Case spellings of words that double as common title words. The
|
|
9231
|
+
// canonical tag spellings ("PROPER", "REAL.PROPER", "CAM", "CONVERT") and
|
|
9232
|
+
// lowercase scene spellings are unaffected; only the Title-Case word is removed.
|
|
9233
|
+
when(matches) {
|
|
9234
|
+
const TITLE_WORDS = /* @__PURE__ */ new Set(["Real", "Cam", "Convert"]);
|
|
9235
|
+
const ret = [];
|
|
9236
|
+
for (const m of matches.range(0, matches.inputString?.length ?? 0)) {
|
|
9237
|
+
if (m.name !== "other" && m.name !== "source") continue;
|
|
9238
|
+
if (TITLE_WORDS.has(m.raw ?? "")) ret.push(m);
|
|
9239
|
+
}
|
|
9240
|
+
return ret.length ? ret : false;
|
|
9241
|
+
}
|
|
9242
|
+
};
|
|
9243
|
+
_RemoveTitleCaseAmbiguous.consequence = RemoveMatch;
|
|
9244
|
+
_RemoveTitleCaseAmbiguous.priority = 64;
|
|
9245
|
+
let RemoveTitleCaseAmbiguous = _RemoveTitleCaseAmbiguous;
|
|
7382
9246
|
const _ValidateReal = class _ValidateReal extends Rule {
|
|
7383
9247
|
when(matches) {
|
|
7384
9248
|
const ret = [];
|
|
@@ -7495,9 +9359,35 @@ function bonus(config) {
|
|
|
7495
9359
|
const rebulk = new Rebulk({ disabled: (context) => isDisabled(context, "bonus") });
|
|
7496
9360
|
rebulk.regexDefaults({ name: "bonus", flags: "i" });
|
|
7497
9361
|
loadConfigPatterns(rebulk, config["bonus"]);
|
|
7498
|
-
rebulk.rules(BonusToEpisodeRule, BonusTitleRule);
|
|
9362
|
+
rebulk.rules(BonusAtFilepartStartRule, BonusToEpisodeRule, BonusTitleRule);
|
|
7499
9363
|
return rebulk;
|
|
7500
9364
|
}
|
|
9365
|
+
const _BonusAtFilepartStartRule = class _BonusAtFilepartStartRule extends Rule {
|
|
9366
|
+
when(matches) {
|
|
9367
|
+
const inputString = matches.inputString || "";
|
|
9368
|
+
const bonuses = matches.named("bonus")?.filter((m) => !m.private) ?? [];
|
|
9369
|
+
const toRemove = [];
|
|
9370
|
+
for (const bonus2 of bonuses) {
|
|
9371
|
+
const filepart = matches.markers.atMatch(bonus2, (m) => m.name === "path", 0);
|
|
9372
|
+
if (!filepart) continue;
|
|
9373
|
+
const parent = bonus2.parent;
|
|
9374
|
+
const xStart = parent ? parent.start : bonus2.start - 1;
|
|
9375
|
+
const before = inputString.slice(filepart.start, xStart);
|
|
9376
|
+
if ([...before].every((c) => seps.includes(c))) {
|
|
9377
|
+
toRemove.push(bonus2);
|
|
9378
|
+
if (parent) toRemove.push(parent);
|
|
9379
|
+
}
|
|
9380
|
+
}
|
|
9381
|
+
return toRemove;
|
|
9382
|
+
}
|
|
9383
|
+
then(matches, whenResponse) {
|
|
9384
|
+
for (const m of whenResponse) {
|
|
9385
|
+
matches.remove(m);
|
|
9386
|
+
}
|
|
9387
|
+
}
|
|
9388
|
+
};
|
|
9389
|
+
_BonusAtFilepartStartRule.priority = 128;
|
|
9390
|
+
let BonusAtFilepartStartRule = _BonusAtFilepartStartRule;
|
|
7501
9391
|
const _BonusToEpisodeRule = class _BonusToEpisodeRule extends Rule {
|
|
7502
9392
|
when(matches) {
|
|
7503
9393
|
const bonuses = matches.named("bonus")?.filter((m) => !m.private) ?? [];
|
|
@@ -7824,7 +9714,7 @@ function crc(_config) {
|
|
|
7824
9714
|
});
|
|
7825
9715
|
rebulk.regex("[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", {
|
|
7826
9716
|
name: "uuid",
|
|
7827
|
-
validator:
|
|
9717
|
+
validator: void 0,
|
|
7828
9718
|
conflictSolver: (_match, other2) => ["episode", "season", "crc32"].includes(other2.name ?? "") ? other2 : "__default__"
|
|
7829
9719
|
});
|
|
7830
9720
|
rebulk.functional(guessIdnumber, {
|
|
@@ -7833,6 +9723,38 @@ function crc(_config) {
|
|
|
7833
9723
|
});
|
|
7834
9724
|
return rebulk;
|
|
7835
9725
|
}
|
|
9726
|
+
function imdb(_config) {
|
|
9727
|
+
const rebulk = new Rebulk({ disabled: (context) => isDisabled(context, "imdb_id") });
|
|
9728
|
+
rebulk.regexDefaults({ flags: "i" });
|
|
9729
|
+
rebulk.defaults({ validator: sepsSurround });
|
|
9730
|
+
rebulk.regex("tt\\d{7,8}", {
|
|
9731
|
+
name: "imdb_id",
|
|
9732
|
+
formatter: (value) => value.toLowerCase()
|
|
9733
|
+
});
|
|
9734
|
+
rebulk.regex("tmdb(?:id)?[-=]?(?<tmdb_id>\\d{1,9})", {
|
|
9735
|
+
name: "tmdb_id",
|
|
9736
|
+
private_parent: true,
|
|
9737
|
+
children: true,
|
|
9738
|
+
formatter: (value) => parseInt(value, 10)
|
|
9739
|
+
});
|
|
9740
|
+
rebulk.regex("tvdb(?:id)?[-=]?(?<tvdb_id>\\d{1,9})", {
|
|
9741
|
+
name: "tvdb_id",
|
|
9742
|
+
private_parent: true,
|
|
9743
|
+
children: true,
|
|
9744
|
+
formatter: (value) => parseInt(value, 10)
|
|
9745
|
+
});
|
|
9746
|
+
return rebulk;
|
|
9747
|
+
}
|
|
9748
|
+
function volume(_config) {
|
|
9749
|
+
const rebulk = new Rebulk({ disabled: (context) => isDisabled(context, "volume") });
|
|
9750
|
+
rebulk.regexDefaults({ flags: "i" });
|
|
9751
|
+
rebulk.regex("vol(?:\\d{1,3}|(?:ume)?[-. ]\\d{1,3})", {
|
|
9752
|
+
name: "volume",
|
|
9753
|
+
validator: sepsSurround,
|
|
9754
|
+
formatter: (value) => parseInt(value.replace(/\D/g, ""), 10)
|
|
9755
|
+
});
|
|
9756
|
+
return rebulk;
|
|
9757
|
+
}
|
|
7836
9758
|
const MIMETYPE_MAP = {
|
|
7837
9759
|
"mkv": "video/x-matroska",
|
|
7838
9760
|
"mp4": "video/mp4",
|
|
@@ -7850,9 +9772,19 @@ const MIMETYPE_MAP = {
|
|
|
7850
9772
|
"jpeg": "image/jpeg",
|
|
7851
9773
|
"png": "image/png",
|
|
7852
9774
|
"gif": "image/gif",
|
|
9775
|
+
"svg": "image/svg+xml",
|
|
7853
9776
|
"zip": "application/zip",
|
|
7854
9777
|
"rar": "application/x-rar-compressed",
|
|
7855
|
-
"pdf": "application/pdf"
|
|
9778
|
+
"pdf": "application/pdf",
|
|
9779
|
+
// .srt subtitles are plain text (matches Python's text/plain).
|
|
9780
|
+
"srt": "text/plain",
|
|
9781
|
+
// MPEG transport stream (Blu-ray/DVD/broadcast). video/mp2t is the correct
|
|
9782
|
+
// IANA type — Python's mimetypes returns a bogus "text/vnd.trolltech.linguist"
|
|
9783
|
+
// for .ts, so here we intentionally diverge to the *correct* value.
|
|
9784
|
+
"ts": "video/mp2t",
|
|
9785
|
+
// Disc image and torrent — both correct and match Python.
|
|
9786
|
+
"iso": "application/x-iso9660-image",
|
|
9787
|
+
"torrent": "application/x-bittorrent"
|
|
7856
9788
|
};
|
|
7857
9789
|
function mimetype(_config) {
|
|
7858
9790
|
const rebulk = new Rebulk({ disabled: (context) => isDisabled(context, "mimetype") });
|
|
@@ -8343,6 +10275,8 @@ function rebulkBuilder(config) {
|
|
|
8343
10275
|
rebulk.rebulk(film(cfg("film")));
|
|
8344
10276
|
rebulk.rebulk(part(cfg("part")));
|
|
8345
10277
|
rebulk.rebulk(crc(cfg("crc")));
|
|
10278
|
+
rebulk.rebulk(imdb(cfg("imdb")));
|
|
10279
|
+
rebulk.rebulk(volume(cfg("volume")));
|
|
8346
10280
|
rebulk.rebulk(processors(cfg("processors")));
|
|
8347
10281
|
rebulk.rebulk(mimetype(cfg("mimetype")));
|
|
8348
10282
|
rebulk.rebulk(type_(cfg("type")));
|
|
@@ -8612,7 +10546,7 @@ const advanced_config = {
|
|
|
8612
10546
|
},
|
|
8613
10547
|
cd: {
|
|
8614
10548
|
_cd_of_cd_count: {
|
|
8615
|
-
regex: "cd-?(?P<cd>\\d+)(?:-?of-?(?P<cd_count>\\d+))?",
|
|
10549
|
+
regex: "(?<!\\d)(?<![^\\W\\d_])cd-?(?P<cd>\\d+)(?:-?of-?(?P<cd_count>\\d+))?",
|
|
8616
10550
|
validator: {
|
|
8617
10551
|
cd: "lambda match: 0 < match.value < 100",
|
|
8618
10552
|
cd_count: "lambda match: 0 < match.value < 100"
|
|
@@ -8703,6 +10637,29 @@ const advanced_config = {
|
|
|
8703
10637
|
],
|
|
8704
10638
|
nzb: [
|
|
8705
10639
|
"nzb"
|
|
10640
|
+
],
|
|
10641
|
+
archives: [
|
|
10642
|
+
"rar",
|
|
10643
|
+
"zip",
|
|
10644
|
+
"7z",
|
|
10645
|
+
"tar",
|
|
10646
|
+
"gz",
|
|
10647
|
+
"bz2",
|
|
10648
|
+
"tgz",
|
|
10649
|
+
"ace",
|
|
10650
|
+
"arj",
|
|
10651
|
+
"cbr",
|
|
10652
|
+
"cbz",
|
|
10653
|
+
"cb7"
|
|
10654
|
+
],
|
|
10655
|
+
images: [
|
|
10656
|
+
"jpg",
|
|
10657
|
+
"jpeg",
|
|
10658
|
+
"png",
|
|
10659
|
+
"gif",
|
|
10660
|
+
"bmp",
|
|
10661
|
+
"tbn",
|
|
10662
|
+
"webp"
|
|
8706
10663
|
]
|
|
8707
10664
|
},
|
|
8708
10665
|
country: {
|
|
@@ -8917,7 +10874,8 @@ const advanced_config = {
|
|
|
8917
10874
|
"s"
|
|
8918
10875
|
],
|
|
8919
10876
|
season_ep_markers: [
|
|
8920
|
-
"x"
|
|
10877
|
+
"x",
|
|
10878
|
+
"×"
|
|
8921
10879
|
],
|
|
8922
10880
|
disc_markers: [
|
|
8923
10881
|
"d"
|
|
@@ -8927,7 +10885,8 @@ const advanced_config = {
|
|
|
8927
10885
|
"ex",
|
|
8928
10886
|
"ep",
|
|
8929
10887
|
"e",
|
|
8930
|
-
"x"
|
|
10888
|
+
"x",
|
|
10889
|
+
"×"
|
|
8931
10890
|
],
|
|
8932
10891
|
range_separators: [
|
|
8933
10892
|
"-",
|
|
@@ -9274,6 +11233,57 @@ const advanced_config = {
|
|
|
9274
11233
|
string: "3D",
|
|
9275
11234
|
tags: "has-neighbor"
|
|
9276
11235
|
},
|
|
11236
|
+
"Virtual Reality": {
|
|
11237
|
+
string: [
|
|
11238
|
+
"VR"
|
|
11239
|
+
],
|
|
11240
|
+
regex: [
|
|
11241
|
+
"VR180",
|
|
11242
|
+
"VR360"
|
|
11243
|
+
],
|
|
11244
|
+
tags: "has-neighbor"
|
|
11245
|
+
},
|
|
11246
|
+
"Opening Credits": {
|
|
11247
|
+
string: [
|
|
11248
|
+
"NCOP",
|
|
11249
|
+
"OPED"
|
|
11250
|
+
],
|
|
11251
|
+
regex: [
|
|
11252
|
+
"NC-?OP",
|
|
11253
|
+
"creditless-?opening"
|
|
11254
|
+
],
|
|
11255
|
+
tags: "has-neighbor"
|
|
11256
|
+
},
|
|
11257
|
+
"Ending Credits": {
|
|
11258
|
+
string: [
|
|
11259
|
+
"NCED"
|
|
11260
|
+
],
|
|
11261
|
+
regex: [
|
|
11262
|
+
"NC-?ED",
|
|
11263
|
+
"creditless-?ending"
|
|
11264
|
+
],
|
|
11265
|
+
tags: "has-neighbor"
|
|
11266
|
+
},
|
|
11267
|
+
"Half SBS": {
|
|
11268
|
+
string: [
|
|
11269
|
+
"HSBS"
|
|
11270
|
+
],
|
|
11271
|
+
regex: [
|
|
11272
|
+
"Half-?SBS"
|
|
11273
|
+
],
|
|
11274
|
+
tags: "has-neighbor"
|
|
11275
|
+
},
|
|
11276
|
+
"Half OU": {
|
|
11277
|
+
string: [
|
|
11278
|
+
"HOU",
|
|
11279
|
+
"HTAB"
|
|
11280
|
+
],
|
|
11281
|
+
regex: [
|
|
11282
|
+
"Half-?OU",
|
|
11283
|
+
"Half-?TAB"
|
|
11284
|
+
],
|
|
11285
|
+
tags: "has-neighbor"
|
|
11286
|
+
},
|
|
9277
11287
|
"High Quality": {
|
|
9278
11288
|
string: "HQ",
|
|
9279
11289
|
tags: "uhdbluray-neighbor"
|
|
@@ -9281,10 +11291,16 @@ const advanced_config = {
|
|
|
9281
11291
|
"High Resolution": "HR",
|
|
9282
11292
|
"Line Dubbed": "LD",
|
|
9283
11293
|
"Mic Dubbed": "MD",
|
|
9284
|
-
"Micro HD":
|
|
9285
|
-
|
|
9286
|
-
|
|
9287
|
-
|
|
11294
|
+
"Micro HD": {
|
|
11295
|
+
string: [
|
|
11296
|
+
"mHD",
|
|
11297
|
+
"HDLight"
|
|
11298
|
+
],
|
|
11299
|
+
regex: [
|
|
11300
|
+
"micro-?hd",
|
|
11301
|
+
"hd-?lite"
|
|
11302
|
+
]
|
|
11303
|
+
},
|
|
9288
11304
|
"Low Definition": "LDTV",
|
|
9289
11305
|
"High Frame Rate": "HFR",
|
|
9290
11306
|
"Variable Frame Rate": "VFR",
|
|
@@ -9907,6 +11923,1035 @@ function mergeOptionValue(option, value, merged) {
|
|
|
9907
11923
|
function deepCopy(obj) {
|
|
9908
11924
|
return JSON.parse(JSON.stringify(obj));
|
|
9909
11925
|
}
|
|
11926
|
+
const GUESSIT_SCHEMA = {
|
|
11927
|
+
"absolute_episode": {
|
|
11928
|
+
"type": [
|
|
11929
|
+
"number"
|
|
11930
|
+
],
|
|
11931
|
+
"array": true,
|
|
11932
|
+
"scalar": true
|
|
11933
|
+
},
|
|
11934
|
+
"alternative_title": {
|
|
11935
|
+
"type": [
|
|
11936
|
+
"string"
|
|
11937
|
+
],
|
|
11938
|
+
"array": true,
|
|
11939
|
+
"scalar": true
|
|
11940
|
+
},
|
|
11941
|
+
"another": {
|
|
11942
|
+
"type": [
|
|
11943
|
+
"string"
|
|
11944
|
+
],
|
|
11945
|
+
"array": false,
|
|
11946
|
+
"scalar": false
|
|
11947
|
+
},
|
|
11948
|
+
"aspect_ratio": {
|
|
11949
|
+
"type": [
|
|
11950
|
+
"number"
|
|
11951
|
+
],
|
|
11952
|
+
"array": false,
|
|
11953
|
+
"scalar": true
|
|
11954
|
+
},
|
|
11955
|
+
"audio_bit_rate": {
|
|
11956
|
+
"type": [
|
|
11957
|
+
"string"
|
|
11958
|
+
],
|
|
11959
|
+
"array": false,
|
|
11960
|
+
"scalar": true
|
|
11961
|
+
},
|
|
11962
|
+
"audio_channels": {
|
|
11963
|
+
"type": [
|
|
11964
|
+
"string"
|
|
11965
|
+
],
|
|
11966
|
+
"array": true,
|
|
11967
|
+
"scalar": true,
|
|
11968
|
+
"enum": [
|
|
11969
|
+
"1.0",
|
|
11970
|
+
"1ch",
|
|
11971
|
+
"2.0",
|
|
11972
|
+
"20",
|
|
11973
|
+
"2ch",
|
|
11974
|
+
"5.1",
|
|
11975
|
+
"5ch",
|
|
11976
|
+
"6ch",
|
|
11977
|
+
"7.1",
|
|
11978
|
+
"7ch",
|
|
11979
|
+
"8ch",
|
|
11980
|
+
"mono",
|
|
11981
|
+
"stereo"
|
|
11982
|
+
]
|
|
11983
|
+
},
|
|
11984
|
+
"audio_codec": {
|
|
11985
|
+
"type": [
|
|
11986
|
+
"string"
|
|
11987
|
+
],
|
|
11988
|
+
"array": true,
|
|
11989
|
+
"scalar": true,
|
|
11990
|
+
"enum": [
|
|
11991
|
+
"AAC",
|
|
11992
|
+
"Atmos",
|
|
11993
|
+
"DD+",
|
|
11994
|
+
"DDP",
|
|
11995
|
+
"Dolby",
|
|
11996
|
+
"Dolby Atmos",
|
|
11997
|
+
"Dolby Digital",
|
|
11998
|
+
"Dolby Digital Plus",
|
|
11999
|
+
"Dolby TrueHD",
|
|
12000
|
+
"DolbyDigital",
|
|
12001
|
+
"DTS",
|
|
12002
|
+
"DTS-HD",
|
|
12003
|
+
"DTS-X",
|
|
12004
|
+
"DTS:X",
|
|
12005
|
+
"DTSX",
|
|
12006
|
+
"Flac",
|
|
12007
|
+
"FLAC",
|
|
12008
|
+
"LAME",
|
|
12009
|
+
"LPCM",
|
|
12010
|
+
"MP2",
|
|
12011
|
+
"MP3",
|
|
12012
|
+
"Opus",
|
|
12013
|
+
"PCM",
|
|
12014
|
+
"Vorbis"
|
|
12015
|
+
]
|
|
12016
|
+
},
|
|
12017
|
+
"audio_profile": {
|
|
12018
|
+
"type": [
|
|
12019
|
+
"string"
|
|
12020
|
+
],
|
|
12021
|
+
"array": true,
|
|
12022
|
+
"scalar": true,
|
|
12023
|
+
"enum": [
|
|
12024
|
+
"ES",
|
|
12025
|
+
"EX",
|
|
12026
|
+
"Extended Surround",
|
|
12027
|
+
"HE",
|
|
12028
|
+
"High Efficiency",
|
|
12029
|
+
"High Quality",
|
|
12030
|
+
"High Resolution Audio",
|
|
12031
|
+
"HQ",
|
|
12032
|
+
"HR",
|
|
12033
|
+
"HRA",
|
|
12034
|
+
"LC",
|
|
12035
|
+
"Low Complexity",
|
|
12036
|
+
"MA",
|
|
12037
|
+
"Master Audio"
|
|
12038
|
+
]
|
|
12039
|
+
},
|
|
12040
|
+
"bonus": {
|
|
12041
|
+
"type": [
|
|
12042
|
+
"number"
|
|
12043
|
+
],
|
|
12044
|
+
"array": false,
|
|
12045
|
+
"scalar": true
|
|
12046
|
+
},
|
|
12047
|
+
"bonus_title": {
|
|
12048
|
+
"type": [
|
|
12049
|
+
"string"
|
|
12050
|
+
],
|
|
12051
|
+
"array": false,
|
|
12052
|
+
"scalar": true
|
|
12053
|
+
},
|
|
12054
|
+
"cd": {
|
|
12055
|
+
"type": [
|
|
12056
|
+
"number"
|
|
12057
|
+
],
|
|
12058
|
+
"array": false,
|
|
12059
|
+
"scalar": true
|
|
12060
|
+
},
|
|
12061
|
+
"cd_count": {
|
|
12062
|
+
"type": [
|
|
12063
|
+
"number"
|
|
12064
|
+
],
|
|
12065
|
+
"array": false,
|
|
12066
|
+
"scalar": true
|
|
12067
|
+
},
|
|
12068
|
+
"color_depth": {
|
|
12069
|
+
"type": [
|
|
12070
|
+
"string"
|
|
12071
|
+
],
|
|
12072
|
+
"array": false,
|
|
12073
|
+
"scalar": true,
|
|
12074
|
+
"enum": [
|
|
12075
|
+
"10-bit",
|
|
12076
|
+
"12-bit",
|
|
12077
|
+
"8-bit"
|
|
12078
|
+
]
|
|
12079
|
+
},
|
|
12080
|
+
"container": {
|
|
12081
|
+
"type": [
|
|
12082
|
+
"string"
|
|
12083
|
+
],
|
|
12084
|
+
"array": true,
|
|
12085
|
+
"scalar": true,
|
|
12086
|
+
"enum": [
|
|
12087
|
+
"3g2",
|
|
12088
|
+
"3gp",
|
|
12089
|
+
"3gp2",
|
|
12090
|
+
"7z",
|
|
12091
|
+
"ace",
|
|
12092
|
+
"arj",
|
|
12093
|
+
"asf",
|
|
12094
|
+
"avi",
|
|
12095
|
+
"bmp",
|
|
12096
|
+
"bz2",
|
|
12097
|
+
"cb7",
|
|
12098
|
+
"cbr",
|
|
12099
|
+
"cbz",
|
|
12100
|
+
"divx",
|
|
12101
|
+
"flv",
|
|
12102
|
+
"gif",
|
|
12103
|
+
"gz",
|
|
12104
|
+
"idx",
|
|
12105
|
+
"iso",
|
|
12106
|
+
"jpeg",
|
|
12107
|
+
"jpg",
|
|
12108
|
+
"m2ts",
|
|
12109
|
+
"m4v",
|
|
12110
|
+
"mk2",
|
|
12111
|
+
"mk3d",
|
|
12112
|
+
"mka",
|
|
12113
|
+
"mkv",
|
|
12114
|
+
"MKV",
|
|
12115
|
+
"mov",
|
|
12116
|
+
"mp4",
|
|
12117
|
+
"mp4a",
|
|
12118
|
+
"mpeg",
|
|
12119
|
+
"mpg",
|
|
12120
|
+
"nfo",
|
|
12121
|
+
"nzb",
|
|
12122
|
+
"ogg",
|
|
12123
|
+
"ogm",
|
|
12124
|
+
"ogv",
|
|
12125
|
+
"png",
|
|
12126
|
+
"qt",
|
|
12127
|
+
"r00",
|
|
12128
|
+
"ra",
|
|
12129
|
+
"ram",
|
|
12130
|
+
"rar",
|
|
12131
|
+
"rm",
|
|
12132
|
+
"srt",
|
|
12133
|
+
"ssa",
|
|
12134
|
+
"tar",
|
|
12135
|
+
"tbn",
|
|
12136
|
+
"tgz",
|
|
12137
|
+
"torrent",
|
|
12138
|
+
"ts",
|
|
12139
|
+
"vob",
|
|
12140
|
+
"wav",
|
|
12141
|
+
"webm",
|
|
12142
|
+
"webp",
|
|
12143
|
+
"wma",
|
|
12144
|
+
"wmv",
|
|
12145
|
+
"zip"
|
|
12146
|
+
]
|
|
12147
|
+
},
|
|
12148
|
+
"country": {
|
|
12149
|
+
"type": [
|
|
12150
|
+
"Language"
|
|
12151
|
+
],
|
|
12152
|
+
"array": false,
|
|
12153
|
+
"scalar": true
|
|
12154
|
+
},
|
|
12155
|
+
"crc32": {
|
|
12156
|
+
"type": [
|
|
12157
|
+
"string"
|
|
12158
|
+
],
|
|
12159
|
+
"array": false,
|
|
12160
|
+
"scalar": true
|
|
12161
|
+
},
|
|
12162
|
+
"date": {
|
|
12163
|
+
"type": [
|
|
12164
|
+
"object"
|
|
12165
|
+
],
|
|
12166
|
+
"array": false,
|
|
12167
|
+
"scalar": true
|
|
12168
|
+
},
|
|
12169
|
+
"disc": {
|
|
12170
|
+
"type": [
|
|
12171
|
+
"number"
|
|
12172
|
+
],
|
|
12173
|
+
"array": true,
|
|
12174
|
+
"scalar": true
|
|
12175
|
+
},
|
|
12176
|
+
"edition": {
|
|
12177
|
+
"type": [
|
|
12178
|
+
"string"
|
|
12179
|
+
],
|
|
12180
|
+
"array": true,
|
|
12181
|
+
"scalar": true,
|
|
12182
|
+
"enum": [
|
|
12183
|
+
"Alternative Cut",
|
|
12184
|
+
"CC",
|
|
12185
|
+
"collector",
|
|
12186
|
+
"Collector",
|
|
12187
|
+
"Criterion",
|
|
12188
|
+
"DC",
|
|
12189
|
+
"ddc",
|
|
12190
|
+
"deluxe",
|
|
12191
|
+
"Deluxe",
|
|
12192
|
+
"Director's Cut",
|
|
12193
|
+
"Director's Definitive Cut",
|
|
12194
|
+
"extended",
|
|
12195
|
+
"Extended",
|
|
12196
|
+
"Fan",
|
|
12197
|
+
"Festival",
|
|
12198
|
+
"imax",
|
|
12199
|
+
"IMAX",
|
|
12200
|
+
"limited",
|
|
12201
|
+
"Limited",
|
|
12202
|
+
"Remastered",
|
|
12203
|
+
"Restored",
|
|
12204
|
+
"se",
|
|
12205
|
+
"Special",
|
|
12206
|
+
"theatrical",
|
|
12207
|
+
"Theatrical",
|
|
12208
|
+
"Ultimate",
|
|
12209
|
+
"Uncensored",
|
|
12210
|
+
"Uncut",
|
|
12211
|
+
"Unrated"
|
|
12212
|
+
]
|
|
12213
|
+
},
|
|
12214
|
+
"episode": {
|
|
12215
|
+
"type": [
|
|
12216
|
+
"number"
|
|
12217
|
+
],
|
|
12218
|
+
"array": true,
|
|
12219
|
+
"scalar": true
|
|
12220
|
+
},
|
|
12221
|
+
"episode_count": {
|
|
12222
|
+
"type": [
|
|
12223
|
+
"number"
|
|
12224
|
+
],
|
|
12225
|
+
"array": false,
|
|
12226
|
+
"scalar": true
|
|
12227
|
+
},
|
|
12228
|
+
"episode_details": {
|
|
12229
|
+
"type": [
|
|
12230
|
+
"string"
|
|
12231
|
+
],
|
|
12232
|
+
"array": true,
|
|
12233
|
+
"scalar": true
|
|
12234
|
+
},
|
|
12235
|
+
"episode_format": {
|
|
12236
|
+
"type": [
|
|
12237
|
+
"string"
|
|
12238
|
+
],
|
|
12239
|
+
"array": false,
|
|
12240
|
+
"scalar": true,
|
|
12241
|
+
"enum": [
|
|
12242
|
+
"Minisode"
|
|
12243
|
+
]
|
|
12244
|
+
},
|
|
12245
|
+
"episode_title": {
|
|
12246
|
+
"type": [
|
|
12247
|
+
"string"
|
|
12248
|
+
],
|
|
12249
|
+
"array": true,
|
|
12250
|
+
"scalar": true
|
|
12251
|
+
},
|
|
12252
|
+
"film": {
|
|
12253
|
+
"type": [
|
|
12254
|
+
"number"
|
|
12255
|
+
],
|
|
12256
|
+
"array": false,
|
|
12257
|
+
"scalar": true
|
|
12258
|
+
},
|
|
12259
|
+
"film_title": {
|
|
12260
|
+
"type": [
|
|
12261
|
+
"string"
|
|
12262
|
+
],
|
|
12263
|
+
"array": false,
|
|
12264
|
+
"scalar": true
|
|
12265
|
+
},
|
|
12266
|
+
"frame_rate": {
|
|
12267
|
+
"type": [
|
|
12268
|
+
"string"
|
|
12269
|
+
],
|
|
12270
|
+
"array": false,
|
|
12271
|
+
"scalar": true
|
|
12272
|
+
},
|
|
12273
|
+
"language": {
|
|
12274
|
+
"type": [
|
|
12275
|
+
"Language"
|
|
12276
|
+
],
|
|
12277
|
+
"array": true,
|
|
12278
|
+
"scalar": true
|
|
12279
|
+
},
|
|
12280
|
+
"mimetype": {
|
|
12281
|
+
"type": [
|
|
12282
|
+
"string"
|
|
12283
|
+
],
|
|
12284
|
+
"array": false,
|
|
12285
|
+
"scalar": true,
|
|
12286
|
+
"enum": [
|
|
12287
|
+
"application/x-bittorrent",
|
|
12288
|
+
"application/x-iso9660-image",
|
|
12289
|
+
"application/x-rar-compressed",
|
|
12290
|
+
"application/zip",
|
|
12291
|
+
"image/gif",
|
|
12292
|
+
"image/jpeg",
|
|
12293
|
+
"image/png",
|
|
12294
|
+
"text/plain",
|
|
12295
|
+
"video/mp2t",
|
|
12296
|
+
"video/mp4",
|
|
12297
|
+
"video/webm",
|
|
12298
|
+
"video/x-matroska",
|
|
12299
|
+
"video/x-msvideo"
|
|
12300
|
+
]
|
|
12301
|
+
},
|
|
12302
|
+
"other": {
|
|
12303
|
+
"type": [
|
|
12304
|
+
"string"
|
|
12305
|
+
],
|
|
12306
|
+
"array": true,
|
|
12307
|
+
"scalar": true,
|
|
12308
|
+
"enum": [
|
|
12309
|
+
"2in1",
|
|
12310
|
+
"3D",
|
|
12311
|
+
"asrequested",
|
|
12312
|
+
"Audio Fixed",
|
|
12313
|
+
"Banner",
|
|
12314
|
+
"Bonus",
|
|
12315
|
+
"BT.2020",
|
|
12316
|
+
"Classic",
|
|
12317
|
+
"Clear Art",
|
|
12318
|
+
"Clear Logo",
|
|
12319
|
+
"Colorized",
|
|
12320
|
+
"Complet",
|
|
12321
|
+
"Complete",
|
|
12322
|
+
"CONVERT",
|
|
12323
|
+
"Converted",
|
|
12324
|
+
"Cover",
|
|
12325
|
+
"Dirfix",
|
|
12326
|
+
"Disc Art",
|
|
12327
|
+
"DOCU",
|
|
12328
|
+
"Documentary",
|
|
12329
|
+
"DOKU",
|
|
12330
|
+
"Dolby Vision",
|
|
12331
|
+
"Dual",
|
|
12332
|
+
"Dual Audio",
|
|
12333
|
+
"East Coast Feed",
|
|
12334
|
+
"Ending Credits",
|
|
12335
|
+
"Extras",
|
|
12336
|
+
"Fan Subtitled",
|
|
12337
|
+
"Fanart",
|
|
12338
|
+
"Fansub",
|
|
12339
|
+
"Fast Subtitled",
|
|
12340
|
+
"Fastsub",
|
|
12341
|
+
"FHD",
|
|
12342
|
+
"Fix",
|
|
12343
|
+
"Fixed",
|
|
12344
|
+
"Full HD",
|
|
12345
|
+
"Half OU",
|
|
12346
|
+
"Half SBS",
|
|
12347
|
+
"Hardcoded Subtitles",
|
|
12348
|
+
"HC",
|
|
12349
|
+
"HD",
|
|
12350
|
+
"HDLight",
|
|
12351
|
+
"HDR10",
|
|
12352
|
+
"HFR",
|
|
12353
|
+
"High Frame Rate",
|
|
12354
|
+
"High Quality",
|
|
12355
|
+
"High Resolution",
|
|
12356
|
+
"HQ",
|
|
12357
|
+
"HR",
|
|
12358
|
+
"Hybrid",
|
|
12359
|
+
"Internal",
|
|
12360
|
+
"Landscape",
|
|
12361
|
+
"LD",
|
|
12362
|
+
"LDTV",
|
|
12363
|
+
"LiNE",
|
|
12364
|
+
"Line Audio",
|
|
12365
|
+
"Line Dubbed",
|
|
12366
|
+
"Logo",
|
|
12367
|
+
"Low Definition",
|
|
12368
|
+
"MD",
|
|
12369
|
+
"mHD",
|
|
12370
|
+
"Mic Dubbed",
|
|
12371
|
+
"Micro HD",
|
|
12372
|
+
"Mux",
|
|
12373
|
+
"Nfofix",
|
|
12374
|
+
"NTSC",
|
|
12375
|
+
"Oad",
|
|
12376
|
+
"OAR",
|
|
12377
|
+
"Oav",
|
|
12378
|
+
"Obfuscated",
|
|
12379
|
+
"Ona",
|
|
12380
|
+
"Open Matte",
|
|
12381
|
+
"Opening Credits",
|
|
12382
|
+
"Original Animated Video",
|
|
12383
|
+
"Original Animation DVD",
|
|
12384
|
+
"Original Aspect Ratio",
|
|
12385
|
+
"Original Net Animation",
|
|
12386
|
+
"Original Video",
|
|
12387
|
+
"OV",
|
|
12388
|
+
"Ova",
|
|
12389
|
+
"PAL",
|
|
12390
|
+
"postbot",
|
|
12391
|
+
"Poster",
|
|
12392
|
+
"Preair",
|
|
12393
|
+
"Proof",
|
|
12394
|
+
"Prooffix",
|
|
12395
|
+
"Proper",
|
|
12396
|
+
"PS Vita",
|
|
12397
|
+
"R5",
|
|
12398
|
+
"RC",
|
|
12399
|
+
"Read NFO",
|
|
12400
|
+
"Real",
|
|
12401
|
+
"Reencoded",
|
|
12402
|
+
"Region 5",
|
|
12403
|
+
"Region C",
|
|
12404
|
+
"Remux",
|
|
12405
|
+
"Repost",
|
|
12406
|
+
"Retail",
|
|
12407
|
+
"Rip",
|
|
12408
|
+
"Sample",
|
|
12409
|
+
"Scrambled",
|
|
12410
|
+
"Screener",
|
|
12411
|
+
"SDR",
|
|
12412
|
+
"SECAM",
|
|
12413
|
+
"Standard Dynamic Range",
|
|
12414
|
+
"Straight to Video",
|
|
12415
|
+
"STV",
|
|
12416
|
+
"Sync Fixed",
|
|
12417
|
+
"Thumbnail",
|
|
12418
|
+
"Trailer",
|
|
12419
|
+
"UHD",
|
|
12420
|
+
"Ultra HD",
|
|
12421
|
+
"Upscaled",
|
|
12422
|
+
"Variable Frame Rate",
|
|
12423
|
+
"VFR",
|
|
12424
|
+
"Virtual Reality",
|
|
12425
|
+
"Vita",
|
|
12426
|
+
"VO",
|
|
12427
|
+
"vost",
|
|
12428
|
+
"West Coast Feed",
|
|
12429
|
+
"Widescreen",
|
|
12430
|
+
"ws",
|
|
12431
|
+
"xpost",
|
|
12432
|
+
"XXX"
|
|
12433
|
+
]
|
|
12434
|
+
},
|
|
12435
|
+
"part": {
|
|
12436
|
+
"type": [
|
|
12437
|
+
"number"
|
|
12438
|
+
],
|
|
12439
|
+
"array": true,
|
|
12440
|
+
"scalar": true
|
|
12441
|
+
},
|
|
12442
|
+
"proper_count": {
|
|
12443
|
+
"type": [
|
|
12444
|
+
"number"
|
|
12445
|
+
],
|
|
12446
|
+
"array": false,
|
|
12447
|
+
"scalar": true
|
|
12448
|
+
},
|
|
12449
|
+
"release_group": {
|
|
12450
|
+
"type": [
|
|
12451
|
+
"string"
|
|
12452
|
+
],
|
|
12453
|
+
"array": false,
|
|
12454
|
+
"scalar": true
|
|
12455
|
+
},
|
|
12456
|
+
"screen_size": {
|
|
12457
|
+
"type": [
|
|
12458
|
+
"string"
|
|
12459
|
+
],
|
|
12460
|
+
"array": false,
|
|
12461
|
+
"scalar": true,
|
|
12462
|
+
"enum": [
|
|
12463
|
+
"1080i",
|
|
12464
|
+
"1080p",
|
|
12465
|
+
"1440p",
|
|
12466
|
+
"1444x866",
|
|
12467
|
+
"2160p",
|
|
12468
|
+
"360p",
|
|
12469
|
+
"368p",
|
|
12470
|
+
"480p",
|
|
12471
|
+
"4k",
|
|
12472
|
+
"540p",
|
|
12473
|
+
"576p",
|
|
12474
|
+
"720p",
|
|
12475
|
+
"720x432",
|
|
12476
|
+
"960x544"
|
|
12477
|
+
]
|
|
12478
|
+
},
|
|
12479
|
+
"season": {
|
|
12480
|
+
"type": [
|
|
12481
|
+
"number"
|
|
12482
|
+
],
|
|
12483
|
+
"array": true,
|
|
12484
|
+
"scalar": true
|
|
12485
|
+
},
|
|
12486
|
+
"season_count": {
|
|
12487
|
+
"type": [
|
|
12488
|
+
"number"
|
|
12489
|
+
],
|
|
12490
|
+
"array": false,
|
|
12491
|
+
"scalar": true
|
|
12492
|
+
},
|
|
12493
|
+
"size": {
|
|
12494
|
+
"type": [
|
|
12495
|
+
"string"
|
|
12496
|
+
],
|
|
12497
|
+
"array": false,
|
|
12498
|
+
"scalar": true
|
|
12499
|
+
},
|
|
12500
|
+
"source": {
|
|
12501
|
+
"type": [
|
|
12502
|
+
"string"
|
|
12503
|
+
],
|
|
12504
|
+
"array": false,
|
|
12505
|
+
"scalar": true,
|
|
12506
|
+
"enum": [
|
|
12507
|
+
"Analog HDTV",
|
|
12508
|
+
"Blu-ray",
|
|
12509
|
+
"Camera",
|
|
12510
|
+
"Digital Master",
|
|
12511
|
+
"Digital TV",
|
|
12512
|
+
"DVD",
|
|
12513
|
+
"HD Camera",
|
|
12514
|
+
"HD Telecine",
|
|
12515
|
+
"HD Telesync",
|
|
12516
|
+
"HD-DVD",
|
|
12517
|
+
"HDTV",
|
|
12518
|
+
"Pay-per-view",
|
|
12519
|
+
"Satellite",
|
|
12520
|
+
"Telecine",
|
|
12521
|
+
"Telesync",
|
|
12522
|
+
"TV",
|
|
12523
|
+
"Ultra HD Blu-ray",
|
|
12524
|
+
"Ultra HDTV",
|
|
12525
|
+
"VHS",
|
|
12526
|
+
"Video on Demand",
|
|
12527
|
+
"Web",
|
|
12528
|
+
"Workprint"
|
|
12529
|
+
]
|
|
12530
|
+
},
|
|
12531
|
+
"streaming_service": {
|
|
12532
|
+
"type": [
|
|
12533
|
+
"string"
|
|
12534
|
+
],
|
|
12535
|
+
"array": false,
|
|
12536
|
+
"scalar": true,
|
|
12537
|
+
"enum": [
|
|
12538
|
+
"4OD",
|
|
12539
|
+
"9Now",
|
|
12540
|
+
"9NOW",
|
|
12541
|
+
"A&E",
|
|
12542
|
+
"ABC",
|
|
12543
|
+
"ABC Australia",
|
|
12544
|
+
"Adult Swim",
|
|
12545
|
+
"AE",
|
|
12546
|
+
"AJAZ",
|
|
12547
|
+
"Al Jazeera English",
|
|
12548
|
+
"ALL4",
|
|
12549
|
+
"Amazon",
|
|
12550
|
+
"Amazon Prime",
|
|
12551
|
+
"AMBC",
|
|
12552
|
+
"AMC",
|
|
12553
|
+
"America's Test Kitchen",
|
|
12554
|
+
"AMZN",
|
|
12555
|
+
"AMZN-CBR",
|
|
12556
|
+
"Animal Planet",
|
|
12557
|
+
"AnimeLab",
|
|
12558
|
+
"ANLB",
|
|
12559
|
+
"ANPL",
|
|
12560
|
+
"AOL",
|
|
12561
|
+
"AppleTV",
|
|
12562
|
+
"APTV",
|
|
12563
|
+
"ARD",
|
|
12564
|
+
"AS",
|
|
12565
|
+
"ATK",
|
|
12566
|
+
"ATV+",
|
|
12567
|
+
"ATVP",
|
|
12568
|
+
"AUBC",
|
|
12569
|
+
"BBC iPlayer",
|
|
12570
|
+
"Binge",
|
|
12571
|
+
"BKPL",
|
|
12572
|
+
"Blackpills",
|
|
12573
|
+
"BLU",
|
|
12574
|
+
"BluTV",
|
|
12575
|
+
"BNGE",
|
|
12576
|
+
"BOOM",
|
|
12577
|
+
"Boomerang",
|
|
12578
|
+
"BRAV",
|
|
12579
|
+
"BravoTV",
|
|
12580
|
+
"Canal+",
|
|
12581
|
+
"Cartoon Network",
|
|
12582
|
+
"CBC",
|
|
12583
|
+
"CBS",
|
|
12584
|
+
"CC",
|
|
12585
|
+
"CCGC",
|
|
12586
|
+
"Channel 4",
|
|
12587
|
+
"CHGD",
|
|
12588
|
+
"CHRGD",
|
|
12589
|
+
"Cinemax",
|
|
12590
|
+
"CMAX",
|
|
12591
|
+
"CMT",
|
|
12592
|
+
"CN",
|
|
12593
|
+
"CNBC",
|
|
12594
|
+
"CNLP",
|
|
12595
|
+
"Comedians in Cars Getting Coffee",
|
|
12596
|
+
"Comedy Central",
|
|
12597
|
+
"Country Music Television",
|
|
12598
|
+
"CR",
|
|
12599
|
+
"Crackle",
|
|
12600
|
+
"CRAV",
|
|
12601
|
+
"Crave",
|
|
12602
|
+
"CRKL",
|
|
12603
|
+
"Crunchy Roll",
|
|
12604
|
+
"CSpan",
|
|
12605
|
+
"CSPN",
|
|
12606
|
+
"CTV",
|
|
12607
|
+
"CUR",
|
|
12608
|
+
"CuriosityStream",
|
|
12609
|
+
"CW",
|
|
12610
|
+
"CWS",
|
|
12611
|
+
"CWSeed",
|
|
12612
|
+
"Daisuki",
|
|
12613
|
+
"DC Universe",
|
|
12614
|
+
"DCU",
|
|
12615
|
+
"DDY",
|
|
12616
|
+
"Deadhouse Films",
|
|
12617
|
+
"DF",
|
|
12618
|
+
"DHF",
|
|
12619
|
+
"Digiturk Diledigin Yerde",
|
|
12620
|
+
"DISC",
|
|
12621
|
+
"Discovery",
|
|
12622
|
+
"Discovery Plus",
|
|
12623
|
+
"Disney",
|
|
12624
|
+
"Disney+",
|
|
12625
|
+
"DIY",
|
|
12626
|
+
"DIY Network",
|
|
12627
|
+
"Doc Club",
|
|
12628
|
+
"DOCC",
|
|
12629
|
+
"DPlay",
|
|
12630
|
+
"DPLY",
|
|
12631
|
+
"DramaFever",
|
|
12632
|
+
"DSCP",
|
|
12633
|
+
"DSKI",
|
|
12634
|
+
"DSNP",
|
|
12635
|
+
"DSNY",
|
|
12636
|
+
"E!",
|
|
12637
|
+
"El Trece",
|
|
12638
|
+
"ePix",
|
|
12639
|
+
"EPIX",
|
|
12640
|
+
"ESPN",
|
|
12641
|
+
"ESQ",
|
|
12642
|
+
"Esquire",
|
|
12643
|
+
"ETTV",
|
|
12644
|
+
"ETV",
|
|
12645
|
+
"Facebook Watch",
|
|
12646
|
+
"FAM",
|
|
12647
|
+
"Family",
|
|
12648
|
+
"Family Jr",
|
|
12649
|
+
"Fandor",
|
|
12650
|
+
"FANDOR",
|
|
12651
|
+
"FBWatch",
|
|
12652
|
+
"FJR",
|
|
12653
|
+
"FOOD",
|
|
12654
|
+
"Food Network",
|
|
12655
|
+
"Fox",
|
|
12656
|
+
"FOX",
|
|
12657
|
+
"Fox Premium",
|
|
12658
|
+
"FOXP",
|
|
12659
|
+
"Foxtel",
|
|
12660
|
+
"FP",
|
|
12661
|
+
"FREE",
|
|
12662
|
+
"Freeform",
|
|
12663
|
+
"FXTL",
|
|
12664
|
+
"FYI",
|
|
12665
|
+
"FYI Network",
|
|
12666
|
+
"Gaga",
|
|
12667
|
+
"GagaOOLala",
|
|
12668
|
+
"GC",
|
|
12669
|
+
"GLBL",
|
|
12670
|
+
"GLOB",
|
|
12671
|
+
"Global",
|
|
12672
|
+
"GloboSat Play",
|
|
12673
|
+
"Hallmark",
|
|
12674
|
+
"HBO",
|
|
12675
|
+
"HBO Go",
|
|
12676
|
+
"HBO Max",
|
|
12677
|
+
"HGTV",
|
|
12678
|
+
"HIST",
|
|
12679
|
+
"History",
|
|
12680
|
+
"HLMK",
|
|
12681
|
+
"HMAX",
|
|
12682
|
+
"hoichoi",
|
|
12683
|
+
"HoiChoi",
|
|
12684
|
+
"Hulu",
|
|
12685
|
+
"HULU",
|
|
12686
|
+
"ID",
|
|
12687
|
+
"IFC",
|
|
12688
|
+
"iflix",
|
|
12689
|
+
"IFX",
|
|
12690
|
+
"INA",
|
|
12691
|
+
"Investigation Discovery",
|
|
12692
|
+
"iP",
|
|
12693
|
+
"iQIYI",
|
|
12694
|
+
"iT",
|
|
12695
|
+
"iTunes",
|
|
12696
|
+
"ITV",
|
|
12697
|
+
"KNOW",
|
|
12698
|
+
"Knowledge Network",
|
|
12699
|
+
"LIFE",
|
|
12700
|
+
"Lifetime",
|
|
12701
|
+
"MBC",
|
|
12702
|
+
"MBCVOD",
|
|
12703
|
+
"MNBC",
|
|
12704
|
+
"Motor Trend OnDemand",
|
|
12705
|
+
"MSNBC",
|
|
12706
|
+
"MTOD",
|
|
12707
|
+
"MTV",
|
|
12708
|
+
"MUBI",
|
|
12709
|
+
"NATG",
|
|
12710
|
+
"National Audiovisual Institute",
|
|
12711
|
+
"National Film Board",
|
|
12712
|
+
"National Geographic",
|
|
12713
|
+
"NBA",
|
|
12714
|
+
"NBA TV",
|
|
12715
|
+
"NBC",
|
|
12716
|
+
"Netflix",
|
|
12717
|
+
"NF",
|
|
12718
|
+
"NFB",
|
|
12719
|
+
"NFL",
|
|
12720
|
+
"NFL Now",
|
|
12721
|
+
"NFLN",
|
|
12722
|
+
"NHL GameCenter",
|
|
12723
|
+
"NICK",
|
|
12724
|
+
"NICKAPP",
|
|
12725
|
+
"Nickelodeon",
|
|
12726
|
+
"Norsk Rikskringkasting",
|
|
12727
|
+
"NRK",
|
|
12728
|
+
"ODK",
|
|
12729
|
+
"OnDemandKorea",
|
|
12730
|
+
"Oprah Winfrey Network",
|
|
12731
|
+
"Opto",
|
|
12732
|
+
"OPTO",
|
|
12733
|
+
"OWN",
|
|
12734
|
+
"Paramount+",
|
|
12735
|
+
"ParamountPlus",
|
|
12736
|
+
"PBS",
|
|
12737
|
+
"PBS Kids",
|
|
12738
|
+
"PBSK",
|
|
12739
|
+
"PCOK",
|
|
12740
|
+
"Peacock",
|
|
12741
|
+
"Playstation Network",
|
|
12742
|
+
"PLUZ",
|
|
12743
|
+
"Pluzz",
|
|
12744
|
+
"PMNP",
|
|
12745
|
+
"PMT+",
|
|
12746
|
+
"PMTP",
|
|
12747
|
+
"POGO",
|
|
12748
|
+
"PokerGO",
|
|
12749
|
+
"PSN",
|
|
12750
|
+
"Rakuten TV",
|
|
12751
|
+
"RED",
|
|
12752
|
+
"RKTN",
|
|
12753
|
+
"ROKU",
|
|
12754
|
+
"RTE",
|
|
12755
|
+
"RTE One",
|
|
12756
|
+
"RUUTU",
|
|
12757
|
+
"SBS",
|
|
12758
|
+
"SCI",
|
|
12759
|
+
"Science Channel",
|
|
12760
|
+
"SeeSo",
|
|
12761
|
+
"SESO",
|
|
12762
|
+
"SHMI",
|
|
12763
|
+
"SHO",
|
|
12764
|
+
"Shomi",
|
|
12765
|
+
"Showtime",
|
|
12766
|
+
"SNET",
|
|
12767
|
+
"Sony",
|
|
12768
|
+
"SONY",
|
|
12769
|
+
"SPIK",
|
|
12770
|
+
"Spike",
|
|
12771
|
+
"Spike TV",
|
|
12772
|
+
"SPKE",
|
|
12773
|
+
"Sportsnet",
|
|
12774
|
+
"Sprout",
|
|
12775
|
+
"SPRT",
|
|
12776
|
+
"Stan",
|
|
12777
|
+
"STAN",
|
|
12778
|
+
"Starz",
|
|
12779
|
+
"STZ",
|
|
12780
|
+
"Sveriges Television",
|
|
12781
|
+
"SVT",
|
|
12782
|
+
"SwearNet",
|
|
12783
|
+
"SWER",
|
|
12784
|
+
"Syfy",
|
|
12785
|
+
"SYFY",
|
|
12786
|
+
"TBS",
|
|
12787
|
+
"TFou",
|
|
12788
|
+
"TFOU",
|
|
12789
|
+
"The CW",
|
|
12790
|
+
"The Roku Channel",
|
|
12791
|
+
"TLC",
|
|
12792
|
+
"TUBI",
|
|
12793
|
+
"TubiTV",
|
|
12794
|
+
"TV Land",
|
|
12795
|
+
"TV3",
|
|
12796
|
+
"TV3 Ireland",
|
|
12797
|
+
"TV4",
|
|
12798
|
+
"TV4 Sweeden",
|
|
12799
|
+
"TVING",
|
|
12800
|
+
"TVL",
|
|
12801
|
+
"TVNZ",
|
|
12802
|
+
"UFC",
|
|
12803
|
+
"UFC Fight Pass",
|
|
12804
|
+
"UKTV",
|
|
12805
|
+
"UNIV",
|
|
12806
|
+
"Univision",
|
|
12807
|
+
"USA Network",
|
|
12808
|
+
"USAN",
|
|
12809
|
+
"Velocity",
|
|
12810
|
+
"VH1",
|
|
12811
|
+
"VICE",
|
|
12812
|
+
"Viceland",
|
|
12813
|
+
"Viki",
|
|
12814
|
+
"VIKI",
|
|
12815
|
+
"Vimeo",
|
|
12816
|
+
"VLCT",
|
|
12817
|
+
"VMEO",
|
|
12818
|
+
"VRV",
|
|
12819
|
+
"W Network",
|
|
12820
|
+
"WatchMe",
|
|
12821
|
+
"WME",
|
|
12822
|
+
"WNET",
|
|
12823
|
+
"WWE Network",
|
|
12824
|
+
"WWEN",
|
|
12825
|
+
"XBOX",
|
|
12826
|
+
"Xbox Video",
|
|
12827
|
+
"Yahoo",
|
|
12828
|
+
"YHOO",
|
|
12829
|
+
"YouTube Red",
|
|
12830
|
+
"ZDF"
|
|
12831
|
+
]
|
|
12832
|
+
},
|
|
12833
|
+
"subtitle_language": {
|
|
12834
|
+
"type": [
|
|
12835
|
+
"Language"
|
|
12836
|
+
],
|
|
12837
|
+
"array": true,
|
|
12838
|
+
"scalar": true
|
|
12839
|
+
},
|
|
12840
|
+
"title": {
|
|
12841
|
+
"type": [
|
|
12842
|
+
"string"
|
|
12843
|
+
],
|
|
12844
|
+
"array": false,
|
|
12845
|
+
"scalar": true
|
|
12846
|
+
},
|
|
12847
|
+
"type": {
|
|
12848
|
+
"type": [
|
|
12849
|
+
"string"
|
|
12850
|
+
],
|
|
12851
|
+
"array": false,
|
|
12852
|
+
"scalar": true,
|
|
12853
|
+
"enum": [
|
|
12854
|
+
"episode",
|
|
12855
|
+
"movie"
|
|
12856
|
+
]
|
|
12857
|
+
},
|
|
12858
|
+
"uuid": {
|
|
12859
|
+
"type": [
|
|
12860
|
+
"string"
|
|
12861
|
+
],
|
|
12862
|
+
"array": false,
|
|
12863
|
+
"scalar": true
|
|
12864
|
+
},
|
|
12865
|
+
"version": {
|
|
12866
|
+
"type": [
|
|
12867
|
+
"number"
|
|
12868
|
+
],
|
|
12869
|
+
"array": false,
|
|
12870
|
+
"scalar": true
|
|
12871
|
+
},
|
|
12872
|
+
"video_api": {
|
|
12873
|
+
"type": [
|
|
12874
|
+
"string"
|
|
12875
|
+
],
|
|
12876
|
+
"array": false,
|
|
12877
|
+
"scalar": true,
|
|
12878
|
+
"enum": [
|
|
12879
|
+
"DXVA"
|
|
12880
|
+
]
|
|
12881
|
+
},
|
|
12882
|
+
"video_bit_rate": {
|
|
12883
|
+
"type": [
|
|
12884
|
+
"string"
|
|
12885
|
+
],
|
|
12886
|
+
"array": false,
|
|
12887
|
+
"scalar": true
|
|
12888
|
+
},
|
|
12889
|
+
"video_codec": {
|
|
12890
|
+
"type": [
|
|
12891
|
+
"string"
|
|
12892
|
+
],
|
|
12893
|
+
"array": false,
|
|
12894
|
+
"scalar": true,
|
|
12895
|
+
"enum": [
|
|
12896
|
+
"DivX",
|
|
12897
|
+
"DVDivX",
|
|
12898
|
+
"H.263",
|
|
12899
|
+
"H.264",
|
|
12900
|
+
"H.265",
|
|
12901
|
+
"MPEG-2",
|
|
12902
|
+
"RealVideo",
|
|
12903
|
+
"VC-1",
|
|
12904
|
+
"VP7",
|
|
12905
|
+
"VP8",
|
|
12906
|
+
"VP80",
|
|
12907
|
+
"VP9",
|
|
12908
|
+
"Xvid",
|
|
12909
|
+
"XviD"
|
|
12910
|
+
]
|
|
12911
|
+
},
|
|
12912
|
+
"video_profile": {
|
|
12913
|
+
"type": [
|
|
12914
|
+
"string"
|
|
12915
|
+
],
|
|
12916
|
+
"array": true,
|
|
12917
|
+
"scalar": true,
|
|
12918
|
+
"enum": [
|
|
12919
|
+
"Advanced Video Codec High Definition",
|
|
12920
|
+
"Baseline",
|
|
12921
|
+
"BP",
|
|
12922
|
+
"EP",
|
|
12923
|
+
"Extended",
|
|
12924
|
+
"HEVC",
|
|
12925
|
+
"High",
|
|
12926
|
+
"High 10",
|
|
12927
|
+
"High 4:2:2",
|
|
12928
|
+
"High 4:4:4 Predictive",
|
|
12929
|
+
"High Efficiency Video Coding",
|
|
12930
|
+
"HiP",
|
|
12931
|
+
"HP",
|
|
12932
|
+
"Main",
|
|
12933
|
+
"MP",
|
|
12934
|
+
"SC",
|
|
12935
|
+
"Scalable Video Coding",
|
|
12936
|
+
"SVC",
|
|
12937
|
+
"XP"
|
|
12938
|
+
]
|
|
12939
|
+
},
|
|
12940
|
+
"website": {
|
|
12941
|
+
"type": [
|
|
12942
|
+
"string"
|
|
12943
|
+
],
|
|
12944
|
+
"array": false,
|
|
12945
|
+
"scalar": true
|
|
12946
|
+
},
|
|
12947
|
+
"year": {
|
|
12948
|
+
"type": [
|
|
12949
|
+
"number"
|
|
12950
|
+
],
|
|
12951
|
+
"array": false,
|
|
12952
|
+
"scalar": true
|
|
12953
|
+
}
|
|
12954
|
+
};
|
|
9910
12955
|
class GuessItException extends Error {
|
|
9911
12956
|
constructor(string, options, cause) {
|
|
9912
12957
|
const causeMsg = cause instanceof Error ? cause.message : String(cause);
|
|
@@ -9973,6 +13018,18 @@ class GuessItApi {
|
|
|
9973
13018
|
!!mergedOptions["enforceList"] || !!mergedOptions["enforce_list"]
|
|
9974
13019
|
);
|
|
9975
13020
|
const result = Object.fromEntries(matchesDict);
|
|
13021
|
+
for (const key of ["language", "subtitle_language"]) {
|
|
13022
|
+
const v = result[key];
|
|
13023
|
+
if (!Array.isArray(v)) continue;
|
|
13024
|
+
const seen = /* @__PURE__ */ new Set();
|
|
13025
|
+
const deduped = v.filter((lang) => {
|
|
13026
|
+
const id = lang && typeof lang === "object" && "alpha3" in lang ? `${lang.alpha3}:${lang.country ?? ""}` : String(lang);
|
|
13027
|
+
if (seen.has(id)) return false;
|
|
13028
|
+
seen.add(id);
|
|
13029
|
+
return true;
|
|
13030
|
+
});
|
|
13031
|
+
result[key] = deduped.length === 1 ? deduped[0] : deduped;
|
|
13032
|
+
}
|
|
9976
13033
|
if (mergedOptions["outputInputString"] || mergedOptions["output_input_string"]) {
|
|
9977
13034
|
result["input_string"] = matches.inputString;
|
|
9978
13035
|
}
|
|
@@ -10000,13 +13057,22 @@ class GuessItApi {
|
|
|
10000
13057
|
}
|
|
10001
13058
|
}
|
|
10002
13059
|
}
|
|
10003
|
-
|
|
13060
|
+
let ordered = {};
|
|
10004
13061
|
for (const k of Object.keys(props).sort()) {
|
|
10005
13062
|
ordered[k] = [...props[k]].sort((a, b) => String(a).localeCompare(String(b)));
|
|
10006
13063
|
}
|
|
10007
13064
|
const rb = this._rebulk;
|
|
10008
13065
|
if (rb.customizeProperties) {
|
|
10009
|
-
|
|
13066
|
+
ordered = rb.customizeProperties(ordered);
|
|
13067
|
+
}
|
|
13068
|
+
for (const [name, def] of Object.entries(GUESSIT_SCHEMA)) {
|
|
13069
|
+
const cur = Array.isArray(ordered[name]) ? ordered[name] : [];
|
|
13070
|
+
if (def.enum) {
|
|
13071
|
+
const merged = /* @__PURE__ */ new Set([...cur, ...def.enum]);
|
|
13072
|
+
ordered[name] = [...merged].sort((a, b) => String(a).localeCompare(String(b)));
|
|
13073
|
+
} else if (cur.length === 0) {
|
|
13074
|
+
ordered[name] = [null];
|
|
13075
|
+
}
|
|
10010
13076
|
}
|
|
10011
13077
|
return ordered;
|
|
10012
13078
|
}
|
|
@@ -10035,6 +13101,7 @@ function reset() {
|
|
|
10035
13101
|
defaultApi.reset();
|
|
10036
13102
|
}
|
|
10037
13103
|
export {
|
|
13104
|
+
GUESSIT_SCHEMA,
|
|
10038
13105
|
GuessItApi,
|
|
10039
13106
|
GuessItException,
|
|
10040
13107
|
configure,
|