From 67ddc9919446a134d5e59dcba1cd98fecb937ed0 Mon Sep 17 00:00:00 2001 From: TheBeastLT Date: Sat, 28 Oct 2023 13:11:45 +0300 Subject: [PATCH] do not detect code from episode number --- src/handlers.js | 2 +- test/codec.js | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/handlers.js b/src/handlers.js index 7073e34..5cd07c6 100644 --- a/src/handlers.js +++ b/src/handlers.js @@ -108,7 +108,7 @@ exports.addDefaults = /** @type Parser */ parser => { parser.addHandler("hdr", /\bHDR(?:10)?\b/i, uniqConcat(value("HDR")), { remove: true, skipIfAlreadyFound: false }); // Codec - parser.addHandler("codec", /[xh][-. ]?26[45]/i, lowercase, { remove: true }); + parser.addHandler("codec", /\b[xh][-. ]?26[45]/i, lowercase, { remove: true }); parser.addHandler("codec", /\bhevc(?:\s?10)?\b/i, value("hevc"), { remove: true, skipIfAlreadyFound: false }); parser.addHandler("codec", /\b(?:dvix|mpeg2|divx|xvid|avc)\b/i, lowercase, { remove: true, skipIfAlreadyFound: false }); parser.addHandler("codec", ({ result }) => { diff --git a/test/codec.js b/test/codec.js index 798531e..8391cf1 100644 --- a/test/codec.js +++ b/test/codec.js @@ -43,4 +43,16 @@ describe("Parsing codec", () => { expect(parse(releaseName)).to.deep.include({ codec: "hevc", bitDepth: "10bit" }); }); + + it("should not detect 264 codec from episode number", () => { + const releaseName = "[DB]_Bleach_264_[012073FE].avi"; + + expect(parse(releaseName)).to.not.have.property("codec"); + }); + + it("should not detect 265 codec from episode number", () => { + const releaseName = "[DB]_Bleach_265_[B4A04EC9].avi"; + + expect(parse(releaseName)).to.not.have.property("codec"); + }); });