Skip to content

Commit

Permalink
handle 3 digit episode with x separator
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBeastLT committed Oct 20, 2023
1 parent aeae91e commit a09947f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,11 @@ exports.addDefaults = /** @type Parser */ parser => {
parser.addHandler("episodes", /\bEp(?:isode)?\W+\d{1,2}\.(\d{1,3})\b/i, array(integer));
parser.addHandler("episodes", /(?:\b[ée]p?(?:isode)?|[Ээ]пизод|[Сс]ер(?:ии|ия|\.)?|cap(?:itulo)?|epis[oó]dio)[. ]?[-:#№]?[. ]?(\d{1,4})(?:[abc]|v0?[1-4]|\W|$)/i, array(integer));
parser.addHandler("episodes", /\b(\d{1,3})(?:-?я)?[ ._-]*(?:ser(?:i?[iyj]a|\b)|[Сс]ер(?:ии|ия|\.)?)/i, array(integer));
parser.addHandler("episodes", /(?:\D|^)\d{1,2}[. ]?[xх][. ]?(\d{1,2})(?:[abc]|v0?[1-4]|\D|$)/, array(integer));
parser.addHandler("episodes", /(?:\D|^)\d{1,2}[. ]?[xх][. ]?(\d{1,3})(?:[abc]|v0?[1-4]|\D|$)/, array(integer));
parser.addHandler("episodes", /[[(]\d{1,2}\.(\d{1,3})[)\]]/, array(integer));
parser.addHandler("episodes", /\b[Ss]\d{1,2}[ .](\d{1,2})\b/, array(integer));
parser.addHandler("episodes", /-\s?\d{1,2}\.(\d{2,3})\s?-/, array(integer));
parser.addHandler("episodes", /(?<=\D|^)(\d{1,2})[. ]?(?:of|из|iz)[. ]?\d{1,2}(?=\D|$)/i, array(integer));
parser.addHandler("episodes", /(?<=\D|^)(\d{1,3})[. ]?(?:of|из|iz)[. ]?\d{1,3}(?=\D|$)/i, array(integer));
parser.addHandler("episodes", /\b\d{2}[ ._-](\d{2})(?:.F)?\.\w{2,4}$/, array(integer));

// can be both absolute episode and season+episode in format 101
Expand Down
5 changes: 5 additions & 0 deletions test/episode.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ describe("Parsing episode", () => {
expect(parse(releaseName)).to.deep.include({ season: 7, episodes: [23, 24] });
});

it("should detect episode when separated with x and has three digit episode", () => {
const releaseName = "Yu-Gi-Oh 3x089 - Awakening of Evil (Part 4).avi";
expect(parse(releaseName)).to.deep.include({ season: 3, episodes: [89] });
});

it("should detect multiple episodes with hyphen no spaces separator", () => {
const releaseName = "611-612 - Desperate Measures, Means & Ends.mp4";
expect(parse(releaseName)).to.deep.include({ episodes: [611, 612] });
Expand Down

0 comments on commit a09947f

Please sign in to comment.