# episode-parser

> Parse file names of tv show episodes.

Latest version **2.0.2** (published 2021-04-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install episode-parser
pnpm add episode-parser
yarn add episode-parser
bun add episode-parser
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.2 |
| Published | 2021-04-22 |
| First published | 2015-07-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 24.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 29 |
| Author | Glenn Jorde |
| Maintainers | tregusti |
| Keywords | episode, filename, parse, parser, show, tv |

## Links

- npm: https://www.npmjs.com/package/episode-parser
- Repository: https://github.com/tregusti/episode-parser
- Homepage: https://github.com/tregusti/episode-parser#readme
- Issues: https://github.com/tregusti/episode-parser/issues
- npm.io page: https://npm.io/package/episode-parser

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 2.0.2 (latest) — 2021-04-22
- 2.0.1 — 2021-04-22
- 2.0.0 — 2020-07-15
- 1.5.1 — 2020-07-15
- 1.5.0 — 2020-01-04
- 1.4.0 — 2019-07-15
- 1.3.0 — 2019-07-15
- 1.2.0 — 2016-01-18
- 1.1.0 — 2015-10-12
- 1.0.0 — 2015-07-20

## README

# episode-parser

[![CircleCI](https://img.shields.io/circleci/project/tregusti/episode-parser/master.svg)][circleci]
[![NPM release](https://img.shields.io/npm/v/episode-parser.svg)][npm-module]
[![License](https://img.shields.io/npm/l/episode-parser.svg)][license]

  [circleci]: https://circleci.com/gh/tregusti/episode-parser
  [npm-module]: https://www.npmjs.com/package/episode-parser
  [license]: http://tregusti.mit-license.org/

A javascript utility for parsing file names in a format that sometimes is used
for tv shows.

It parses a file name like this `Fake.Blood.2013.S07E06.Karma.Sucks.PROPER.720p.HDTV.x264-STALKERS.srt`
into an object with the following possible properties:

  - `show`, string: The name of the show, `'Fake Blood'`.
  - `year`, integer: The release year, `2013`.
  - `season`, integer: The season number, `7`.
  - `episode`, integer: The episode number, `6`.
  - `episodeCount`, integer: The count of episodes this file name includes, `1`.
  - `name`, string: The name of the episode, `'Karma Sucks'`.
  - `quality`, integer: The quality taken from `720p` or `1080p`. In this case `720`.
  - `source`, string: Available values are `'hdtv'`, `'webdl'`, In this case `'hdtv'`.
  - `codec`, string: Codec used, `'x264'`.
  - `group`, string: Release group, `'STALKERS'`.
  - `ext`, string: File extension, `'srt'`.

## Supported formats

Take a look in [the tests][examples] for examples of what file name formats are
supported.

  [examples]: https://github.com/tregusti/episode-parser/blob/master/test/parser.test.js

## Usage

Simply require the module and you get a parsing function that you invoke with
the file name to parse:

```js
var parser = require('episode-parser')
var filename = 'Fake Blood 2x06 I Need Blood.srt'
var result = parser(filename)
console.log(result.show) //= 'Fake Blood'
console.log(result.year) //= undefined
console.log(result.season) //= 2
console.log(result.codec) //= undefined
```

If the parser can't parse the file name, `null` will be returned. If the parser
can't parse out a specific details, the property for that detail will be missing
from the result.

## Installation

```sh
npm install episode-parser
```

## Versioning

This package uses [semver](http://semver.org/spec/v2.0.0.html).

## Contributing

If you feel something is missing, which is highly probable since I made this for
my personal needs, please create a [pull request][pr-help], with tests covering
your case. If you feel somewhat lazy, create an issue instead and I might look
into it.

  [pr-help]: https://help.github.com/articles/using-pull-requests/

## Thank you

[![Flattr](http://img.shields.io/badge/flattr-donate-brightgreen.svg)](https://flattr.com/profile/tregusti)

Building good software and tools takes time. Please do support a future for this project if you are
using it. Thank you!

---
_Source: https://npm.io/package/episode-parser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
