episode-parser
v2.0.2
Published
Parse file names of tv show episodes.
Downloads
104
Maintainers
Readme
episode-parser
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 from720p
or1080p
. In this case720
.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 for examples of what file name formats are supported.
Usage
Simply require the module and you get a parsing function that you invoke with the file name to parse:
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
npm install episode-parser
Versioning
This package uses semver.
Contributing
If you feel something is missing, which is highly probable since I made this for my personal needs, please create a pull request, with tests covering your case. If you feel somewhat lazy, create an issue instead and I might look into it.
Thank you
Building good software and tools takes time. Please do support a future for this project if you are using it. Thank you!