anipar
Version:
Anime title Parser built for AnimeGarden.
242 lines (238 loc) • 6.15 kB
TypeScript
interface ParseOptions {
fansub?: string;
}
interface ParseResult {
title: string;
titles?: string[];
fansub?: {
name: string;
alias?: string;
collab?: string[];
tags?: string[];
};
season?: SeasonInfo;
seasons?: SeasonInfo[];
seasonsRange?: SeasonsRange;
part?: {
number: number;
};
type?: string;
episode?: EpisodeInfo;
volume?: VolumeInfo;
volumes?: VolumeInfo;
volumesRange?: VolumesRange;
episodes?: EpisodeInfo[];
episodesRange?: EpisodesRange;
version?: number;
subtitle?: SubtitleInfo;
source?: string;
platform?: string;
year?: number;
month?: number;
file?: FileInfo;
tmdbId?: string;
tags?: string[];
variants?: string[];
search?: string[];
}
interface SubtitleInfo {
/**
* Subtitle delivery type or subtitle file format.
*
* @example "外挂字幕"
* @example "内封字幕"
* @example "ASS字幕"
*/
format?: string;
/**
* Subtitle text encoding when the release marks a single encoding.
*
* @example "GB"
* @example "BIG5"
*/
encoding?: string;
/**
* Subtitle text encodings when the release contains multiple encoded subtitle files.
*
* @example ["GB", "BIG5"] // "GB/BIG5"
* @example ["GB", "BIG5"] // "外挂GB/BIG5"
*/
encodings?: string[];
/**
* Subtitle languages normalized to short language markers.
*
* @example ["简", "繁"]
* @example ["简", "日"]
*/
languages?: string[];
}
interface EpisodeInfo {
number: number;
numberSub?: number;
type?: string;
title?: string;
}
interface VolumeInfo {
number: number;
}
interface VolumesRange {
from: number;
to: number;
type?: string;
}
interface EpisodesRange {
from: number;
fromSub?: number;
to: number;
toSub?: number;
type?: string;
}
interface SeasonInfo {
number: number;
title?: string;
}
interface SeasonsRange {
from: number;
to: number;
}
interface FileInfo {
/**
* File extension or container suffix parsed from the title.
*
* @example "mkv"
* @example "MP4"
*/
extension?: string;
/**
* Audio stream metadata.
*
* @example { codec: "AAC" }
* @example { codec: "FLAC", trackCount: 2 }
* @example { codec: "DTS", channels: "5.1" }
* @example { codec: "Opus" }
*/
audio?: {
/**
* Audio channel layout.
*
* @example "2.0"
* @example "5.1"
*/
channels?: string;
/**
* Audio codec or encoding format.
*
* @example "AAC"
* @example "E-AC-3+AAC"
* @example "FLAC"
* @example "Opus"
*/
codec?: string;
/**
* Audio language or language track marker.
*
* @example "dual audio"
*/
language?: string;
/**
* Number of audio tracks implied by compact tags.
*
* @example 2 // "AACx2"
* @example 3 // "FLAC×3"
*/
trackCount?: number;
};
/**
* Video stream metadata.
*
* @example { codec: "HEVC", bitDepth: "10-bit", resolution: "1080p" }
* @example { resolution: "1920x816", fps: "60fps" }
* @example { enhancement: "AI", resolution: "2160p" }
*/
video?: {
/**
* Video codec or encoder family.
*
* @example "AVC"
* @example "HEVC"
* @example "DivX"
*/
codec?: string;
/**
* Video enhancement or processing marker.
*
* @example "AI" // "AI2160p"
*/
enhancement?: string;
/**
* Video container or legacy video format marker.
*
* @example "AVI"
* @example "RMVB"
* @example "WMV"
*/
format?: string;
/**
* Non-numeric frame-rate mode.
*
* @example "高帧率"
*/
frameRateMode?: string;
/**
* Video quality marker.
*
* @example "HDR"
* @example "HQ"
* @example "LQ"
*/
quality?: string;
/**
* Video resolution or frame size.
*
* @example "1080p"
* @example "1920x1080"
* @example "4K"
*/
resolution?: string;
/**
* Video bit depth.
*
* @example "8-bit"
* @example "10-bit"
*/
bitDepth?: string;
/**
* Numeric frame rate marker.
*
* @example "23.976fps"
* @example "60fps"
*/
fps?: string;
};
}
declare function parse(title: string, options?: ParseOptions): ParseResult | undefined;
declare const enum Fansub {
Kirara_Fantasia = "Kirara Fantasia",
ANi = "ANi",
LoliHouse = "LoliHouse",
绿茶字幕组 = "\u7EFF\u8336\u5B57\u5E55\u7EC4",
桜都字幕组 = "\u685C\u90FD\u5B57\u5E55\u7EC4",
Prejudice_Studio = "Prejudice-Studio",
沸班亚马制作组 = "\u6CB8\u73ED\u4E9A\u9A6C\u5236\u4F5C\u7EC4",
喵萌奶茶屋 = "\u55B5\u840C\u5976\u8336\u5C4B",
猎户发布组 = "\u730E\u6237\u53D1\u5E03\u7EC4",
爱恋字幕社 = "\u7231\u604B\u5B57\u5E55\u793E",
拨雪寻春 = "\u62E8\u96EA\u5BFB\u6625",
雪飄工作室 = "\u96EA\u98C4\u5DE5\u4F5C\u5BA4(FLsnow)",
幻樱字幕组 = "\u5E7B\u6A31\u5B57\u5E55\u7EC4",
GMTeam = "GMTeam",
三明治摆烂组 = "\u4E09\u660E\u6CBB\u6446\u70C2\u7EC4",
星空字幕组 = "\u661F\u7A7A\u5B57\u5E55\u7EC4",
北宇治字幕组 = "\u5317\u5B87\u6CBB\u5B57\u5E55\u7EC4",
极影字幕社 = "\u6781\u5F71\u5B57\u5E55\u793E",
MingYSub = "MingYSub",
黑白字幕组 = "\u9ED1\u767D\u5B57\u5E55\u7EC4",
S1百综字幕组 = "S1\u767E\u7EFC\u5B57\u5E55\u7EC4"
}
export { Fansub, parse };
export type { EpisodeInfo, EpisodesRange, FileInfo, ParseOptions, ParseResult, SeasonInfo, SeasonsRange, SubtitleInfo, VolumeInfo, VolumesRange };