Skip to content

Commit

Permalink
feat: add some keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
yjl9903 committed Apr 12, 2023
1 parent 5c4005e commit b6b1eb6
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 6 deletions.
4 changes: 3 additions & 1 deletion packages/anitomy/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ export function resolveOptions(options: Partial<AnitomyOptions>): AnitomyOptions
function resolveResult(result: ParsedResult): AnitomyResult {
const resolved: AnitomyResult = {
title: result['title'],
season: result['season'],
type: result['type'],
season: result['season'],
year: result['year'],
month: undefined,
language: result['language'],
subtitles: result['subtitles'],
episode: {
Expand Down
9 changes: 7 additions & 2 deletions packages/anitomy/src/keyword.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,10 @@ export class KeywordManager {
'TVRIP',
'TV-RIP',
'WEBCAST',
'WEBRIP'
'WEBDL',
'WEB-DL',
'WEBRIP',
'WEB-RIP'
]);

// Language
Expand All @@ -185,7 +188,9 @@ export class KeywordManager {
'JAP',
'PT-BR',
'SPANISH',
'VOSTFR'
'VOSTFR',
'CHT',
'CHS'
]);
add(ElementCategory.Language, optionsUnidentifiable, ['ESP', 'ITA']);

Expand Down
4 changes: 4 additions & 0 deletions packages/anitomy/src/parser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ export function parse(tokens: Token[], options: AnitomyOptions) {
word = word.slice(1);
break;
case ElementCategory.VolumePrefix:
result = mergeResult(
result,
checkExtentKeyword(ElementCategory.VolumeNumber, tokens, i)
);
continue;
}
} else {
Expand Down
6 changes: 5 additions & 1 deletion packages/anitomy/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ export type ParsedResult = Partial<Record<ElementCategory, string>>;
export interface AnitomyResult {
title: string | undefined;

type: string | undefined;

season: string | undefined;

type: string | undefined;
year: string | undefined;

month: string | undefined;

language: string | undefined;

Expand Down
14 changes: 12 additions & 2 deletions packages/anitomy/test/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ exports[`parse > should work 1`] = `
"extension": undefined,
"name": "[Lilith-Raws] 熊熊勇闖異世界 PUNCH! / Kuma Kuma Kuma Bear S02 - 02 [Baha][WEB-DL][1080p][AVC AAC][CHT][MP4]",
},
"language": undefined,
"language": "CHT",
"month": undefined,
"prefix": {
"episode": undefined,
"season": undefined,
Expand All @@ -32,6 +33,7 @@ exports[`parse > should work 1`] = `
"volume": {
"number": undefined,
},
"year": undefined,
}
`;

Expand All @@ -50,7 +52,8 @@ exports[`parse > should work 2`] = `
"extension": undefined,
"name": "[ANi] 機動戰士鋼彈 水星的魔女 Season 2 - 13 [1080P][Baha][WEB-DL][AAC AVC][CHT][MP4]",
},
"language": undefined,
"language": "CHT",
"month": undefined,
"prefix": {
"episode": undefined,
"season": undefined,
Expand All @@ -67,6 +70,7 @@ exports[`parse > should work 2`] = `
"volume": {
"number": undefined,
},
"year": undefined,
}
`;

Expand All @@ -86,6 +90,7 @@ exports[`parse > should work 3`] = `
"name": "[爱恋字幕社][4月新番][魔法使的新娘2][Mahoutsukai no Yome S2][01][1080P][MP4][GB][简中]",
},
"language": undefined,
"month": undefined,
"prefix": {
"episode": undefined,
"season": undefined,
Expand All @@ -102,6 +107,7 @@ exports[`parse > should work 3`] = `
"volume": {
"number": undefined,
},
"year": undefined,
}
`;

Expand All @@ -121,6 +127,7 @@ exports[`parse > should work 4`] = `
"name": "[桜都字幕组] 总之就是非常可爱 S2 / Tonikaku Kawaii S2 [01][1080p][简体内嵌]",
},
"language": undefined,
"month": undefined,
"prefix": {
"episode": undefined,
"season": undefined,
Expand All @@ -137,6 +144,7 @@ exports[`parse > should work 4`] = `
"volume": {
"number": undefined,
},
"year": undefined,
}
`;

Expand All @@ -156,6 +164,7 @@ exports[`parse > should work 5`] = `
"name": "【喵萌奶茶屋】★04月新番★[百合是我的工作!/我的百合乃工作是也!/私の百合はお仕事です!/Watashi no Yuri wa Oshigoto desu!][01][720p][繁日雙語][招募翻譯校對]",
},
"language": undefined,
"month": undefined,
"prefix": {
"episode": undefined,
"season": undefined,
Expand All @@ -172,5 +181,6 @@ exports[`parse > should work 5`] = `
"volume": {
"number": undefined,
},
"year": undefined,
}
`;

0 comments on commit b6b1eb6

Please sign in to comment.