@ctrl/video-filename-parser

中文文档
5.12.0发布于 2026/10/05MITTypeScriptES Module零依赖构建来源已验证近 30 天下载 4241

A radarr style release name parser

原始使用文档
文档目录9 节
  1. Installation
  2. Usage
  3. Movies
  4. TV shows
  5. Parameters
  6. Notes
  7. Focused parsers
  8. Revision upgrades
  9. See also

video-filename-parser npm

Parse movie and TV release names into normalized metadata. The parser is heavily inspired by Radarr's movie parsing.

Try the demo

Installation

npm install @ctrl/video-filename-parser

The package is ESM-only and requires Node.js 20 or newer.

Usage

Movies

import { filenameParse } from '@ctrl/video-filename-parser';

const movie = filenameParse('This.is.40.2012.PROPER.UNRATED.720p.BluRay.x264-Felony');
{
  "title": "This is 40",
  "year": "2012",
  "resolution": "720P",
  "sources": ["BLURAY"],
  "videoCodec": "x264",
  "revision": {
    "version": 2,
    "real": 0
  },
  "group": "Felony",
  "edition": {
    "unrated": true
  },
  "languages": ["English"]
}

TV shows

Pass true as the second argument to parse seasons, episodes, air dates, and other TV-specific metadata.

const show = filenameParse('The Office US S09E06 HDTV XviD-AFG', true);

show.title;
// "The Office US"

show.seasons;
// [9]

show.episodeNumbers;
// [6]

Text after the season and episode can be returned as remainder:

const episode = filenameParse('The Expanse - S01E02 - The Big Empty', true);

episode.remainder;
// "The Big Empty"

Parameters

ParameterTypeDefaultDescription
namestring—Release name or filename to parse.
isTvbooleanfalseEnables season, episode, and air-date detection.

filenameParse returns ParsedMovie by default and ParsedShow when TV metadata is found in TV mode. The exported TypeScript types describe the full result. Metadata that is not present or cannot be inferred is generally omitted; year and group may be null.

Notes

Releases without a recognized language marker default to English. multi means the name contains a multi-language marker; it does not guess languages that are not named.

Parsing is heuristic, so ambiguous names may need application-specific handling.

Focused parsers

The package also exports the focused parsers used by filenameParse for consumers that only need one piece of metadata.

import { parseAudioCodec, parseResolution } from '@ctrl/video-filename-parser';

parseResolution('Movie.2026.2160p.WEB-DL').resolution;
// "2160P"

parseAudioCodec('Movie.2026.WEB-DL.DDP5.1').codec;
// "Dolby Digital Plus"

Revision upgrades

isRevisionUpgrade({ current, candidate, isTv }) returns true when the candidate is a newer revision of the same parsed release type.

Release identity includes title, year, resolution, sources, quality modifier, video codec, languages, multi-language status, edition flags, and TV episode or season details. Release group and audio details are ignored. HDR and Dolby Vision releases are therefore kept separate.

import { isRevisionUpgrade } from '@ctrl/video-filename-parser';

isRevisionUpgrade({
  current: 'Movie.Title.2026.HDR.2160P.WEB.H265-GROUP',
  candidate: 'Movie.Title.2026.PROPER.HDR.2160p.WEB.h265-OTHER',
});
// true

See also

版本与发布记录

@ctrl/video-filename-parser 共发布 83 个版本,首次发布于 2019/09/10;过去 12 个月发布了 17 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
5.12.0latest2026/10/051 个月前
5.11.52026/10/051 个月前
5.11.42026/07/143 个月前
5.11.32026/07/143 个月前
5.11.22026/07/143 个月前
5.11.12026/07/064 个月前

关于 @ctrl/video-filename-parser 的常见问题

@ctrl/video-filename-parser 是什么?

A radarr style release name parser

如何安装 @ctrl/video-filename-parser?

在项目目录运行 npm install @ctrl/video-filename-parser,或使用 pnpm add / yarn add / bun add。

@ctrl/video-filename-parser 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@ctrl/video-filename-parser 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@ctrl/video-filename-parser 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@ctrl/video-filename-parser 可以商用吗?

@ctrl/video-filename-parser 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@ctrl/video-filename-parser 的下载量有多少?

根据 npm 官方下载统计,@ctrl/video-filename-parser 在 2026/10/11 – 2026/11/09 这 30 天内被下载 4,241 次,日均约 141 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@ctrl/video-filename-parser 还在维护吗?

最新版本 5.12.0 发布于 2026/10/05(1 个月前);至今共发布 83 个版本,其中过去 12 个月发布了 17 个;首次发布于 2019/09/10。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。