A scanner for media files that follows a user-provided naming convention
What to do with this library ?
A lot of things :
- Basic listing purposes :
- Filtering purposes :
- Miscellaneous purposes
Don't hesitate to suggest new features : it is always worthy :)
Which naming convention can I use with this lib ?
ANYTHING. All You have to do is to implement a parser function :
A function that takes a single string argument
fullPathFile (the full path to the file) that returns an object that minimal contains a
title string property.
For example :
const ptt = ;const information = ptt;console; // Game of Thronesconsole; // 1console; // 1console; // 720pconsole; // x264console; // HDTVconsole; // CTU
This lib was tested with these parsers that follows torrent naming conventions (see their readme for more info) :
How the library detects the category of a media file ?
The default implementation determines it is a tv-show if there is
episode attributes can be found in the information provided by the parser.
Here is a example if you want to implement one :
// Default implementation to know which category is this file
Using custom parameters in the lib
Check the constructor for more detail - an illustration :
const MediaScan = ;let libInstance =defaultPath = process // Default path to explore , if paths is emptypaths = // all the paths that will be exploredallFilesWithCategory = // the mapping between file and Categorymovies = // Set<ParserResult> (all the movies)series = // <tvShowName , Set<ParserResult>> (all the tv-series episodes)parser = nameParser // the explained parserwhichCategory = defaultWhichCategoryFunction // the previously explained detection function;
For npm users :
$ npm install --save mediascan
for Yarn :
$ yarn add mediascan
If You want, You can have the types definitions used in this lib :
npm install @types/mediascan
- If you're unsure if a feature would make a good addition, you can always create an issue first.
- We aim for 100% test coverage. Please write tests for any new functionality or changes.
- Any API changes should be fully documented.
- Make sure your code meets our linting standards. Run
npm run lintto check your code.
- Be mindful of others when making suggestions and/or code reviewing.