Skip to content

Commit

Permalink
feat: support parsing dolby vision
Browse files Browse the repository at this point in the history
  • Loading branch information
scttcper committed Apr 3, 2022
1 parent 1738e44 commit 613804a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/edition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const hsbs = /\b(Half-?SBS|HSBS)\b/i;
const sbs = /\b((?<!H|HALF-)SBS)\b/i;
const hou = /\b(HOU)\b/i;
const uhd = /\b(UHD)\b/i;
const dolbyVision = /\b(DV(\b(HDR10|HLG|SDR))?)\b/i;

export interface Edition {
internal?: boolean;
Expand All @@ -39,6 +40,7 @@ export interface Edition {
hou?: boolean;
/** most 2160p should be UHD but there might be some that aren't? */
uhd?: boolean;
dolbyVision?: boolean;
}

export function parseEdition(title: string): Edition {
Expand All @@ -61,6 +63,7 @@ export function parseEdition(title: string): Edition {
sbs: sbs.test(withoutTitle) || undefined,
hou: hou.test(withoutTitle) || undefined,
uhd: uhd.test(withoutTitle) || undefined,
dolbyVision: dolbyVision.test(withoutTitle) || undefined,
};

return removeEmpty(result);
Expand Down
5 changes: 5 additions & 0 deletions test/edition.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ const cases: Array<[string, Partial<Edition>]> = [
'Iron.Man.2008.INTERNAL.REMASTERED.2160p.UHD.BluRay.X265-IAMABLE',
{ uhd: true, remastered: true, internal: true },
],
['Long Shot 2019 DV 2160p WEB H265-SLOT', { dolbyVision: true }],
[
'Sicario 2015 Hybrid 2160p UHD BluRay REMUX DV HDR10+ HEVC TrueHD 7.1 Atmos-WiLDCAT',
{ uhd: true, dolbyVision: true },
],
];

for (const [title, result] of cases) {
Expand Down

0 comments on commit 613804a

Please sign in to comment.