Home Manual Reference Source Test

Typedef

Static Public Summary
public

addNewPath event

public

error_in_function event

public

missing_parameter event

public

removeOldFiles event

public

scan event

public

StorageVar: Set<TPN_Extended>|Map<string, Set<TPN_Extended>

The sub way to store all kind of media files found in paths

public

The master variable where we store all kind of media files found in paths

public

The result of parsing file name

public

The extended TPN object

public

allows user to provide custom filtering stuff

public

A parsing function to be used with this lib

public

Number expression for number filtering

public

The search syntax for number properties : a operator follows by a number

public

search parameters object

Static Public

public Events#addNewPath: Object source

addNewPath event

Properties:

NameTypeAttributeDescription
paths ...string

all the paths that were added

Example:

TorrentLibraryInstance.on('addNewPath',function(callback){
     console.log('The following files were added : ' + callback.paths);
})

public Events#error_in_function: Object source

error_in_function event

Properties:

NameTypeAttributeDescription
functionName string

Indicates the function name when the error occurs.

error string

The error message got by error.message

Example:

TorrentLibraryInstance.on('error_in_function',function(callback){
     console.log('Function ' + callback.functionName + ' has the following error : ' + callback.error);
})

public Events#missing_parameter: Object source

missing_parameter event

Properties:

NameTypeAttributeDescription
functionName string

Indicates the function name when the error occurs.

Example:

TorrentLibraryInstance.on('missing_parameter',function(callback){
     console.log('Parameter is missing in ' + callback.functionName);
})

public Events#removeOldFiles: object source

removeOldFiles event

Properties:

NameTypeAttributeDescription
files ...string

all the files that were found and removed if not yet in lib

Example:

TorrentLibraryInstance.on('removeOldFiles',function(callback){
     console.log('The following files were added : ' + callback.files);
})

public Events#scan: object source

scan event

Properties:

NameTypeAttributeDescription
files ...string

all the files that were found and added if not yet in lib

Example:

TorrentLibraryInstance.on('scan',function(callback){
     console.log('The following files were found : ' + callback.files);
})

public StorageVar: Set<TPN_Extended>|Map<string, Set<TPN_Extended> source

The sub way to store all kind of media files found in paths

public StoreVar: Map<string, StorageVar> source

The master variable where we store all kind of media files found in paths

Example:

// An example of the variable after the scan method
[
     "MOVIES" : [
        {
           "year": 2014,
           "resolution": '1080p',
           "source": 'brrip',
           "codec": 'x264',
           "container": 'mkv',
           "title": 'Captain Russia The Summer Soldier',
           "filePath": "D:\somePath\Captain Russia The Summer Soldier (2014) 1080p BrRip x264.MKV"
        }
     ],
     "TV_SERIES" : [
         "The Blacklist" : [
             {
                 "season": 4,
                 "episode": 21,
                 "source": "webrip",
                 "codec": "xvid",
                 "container": "avi",
                 "language": "french"
                 "filePath" : "D:\somePath\The.Blacklist.S04E21.FRENCH.WEBRip.XviD.avi"
             }
         ]
     ]
]

public TPN: Object source

The result of parsing file name

Properties:

NameTypeAttributeDescription
title string

The file title

season number
  • optional

The season number

episode number
  • optional

The episode number

year number
  • optional

The year

resolution string
  • optional

The resolution

codec string
  • optional

The codec

audio string
  • optional

The audio

group string
  • optional

The group that releases this file

region string
  • optional

The region

container string
  • optional

The container

language string
  • optional

The file language

extended boolean
  • optional

extended ?

unrated boolean
  • optional

unrated ?

proper boolean
  • optional

proper ?

repack boolean
  • optional

repack ?

convert boolean
  • optional

convert ?

hardcoded boolean
  • optional

hardcoded ?

retail boolean
  • optional

retail ?

remastered boolean
  • optional

remastered ?

source string
  • optional

the source

Example:

{
        "container":"avi",
        "source":"webrip",
        "codec":"xvid",
        "season":4,
        "episode":14,
        "language":"french",
        "title":"The Blacklist"
}

See:

  • https://github.com/clement-escolano/parse-torrent-title

public TPN_Extended: TPN source

The extended TPN object

Properties:

NameTypeAttributeDescription
filePath string

additionnal property useful for this library

Example:

{
        "container":"avi",
        "source":"webrip",
        "codec":"xvid",
        "season":4,
        "episode":14,
        "language":"french",
        "title":"The Blacklist",
        "filePath":"D:\\workspaceNodeJs\\torrent-files-library\\test\\folder2\\The.Blacklist.S04E14.FRENCH.WEBRip.XviD.avi"
}

public additionalProperties: Object source

allows user to provide custom filtering stuff

Properties:

NameTypeAttributeDescription
type string

Filter type - Possible values are 'number' , 'string' , 'number'

name string

The requested property

value boolean | string | string[] | number | numberSearchSyntax

The requested value

Example:

{ type: 'number', name: 'AnotherField2', value: '<=25' }
{ type: 'boolean', name: 'AnotherField', value: true }
{ type: 'number', name: 'AnotherField2', value: 25 }
{ type: 'string', name: 'AnotherField', value: ['NothingExists', 'NothingExists'] }

public customParsingFunction(title: string): TPN: Function source

A parsing function to be used with this lib

Return:

TPN

the result

Example:

// default parser used in this lib
const parser = require("parse-torrent-title").parser;
// extended default parser as explained here : https://github.com/clement-escolano/parse-torrent-title#advanced-usage
const ptt = require("parse-torrent-title");
ptt.addHandler("part", /Part[. ]([0-9])/i, { type: "integer" });
const parser = ptt.parse;
// original parser used in this lib : https://github.com/jy95/torrent-name-parser
const parser = require('torrent-name-parser');

public numberExpressionObject: Object source

Number expression for number filtering

Properties:

NameTypeAttributeDescription
operator string

The operator for matching process

number number

The extracted number for matching process

Example:

{ operator: '>=' , number: 5 }

public numberSearchSyntax: string source

The search syntax for number properties : a operator follows by a number

Example:

'<=25'
'=25'

public searchParameters: Object source

search parameters object

Properties:

NameTypeAttributeDescription
extended boolean
  • optional
  • default: undefined

extended ?

unrated boolean
  • optional
  • default: undefined

unrated ?

proper boolean
  • optional
  • default: undefined

proper ?

repack boolean
  • optional
  • default: undefined

repack ?

convert boolean
  • optional
  • default: undefined

convert ?

hardcoded boolean
  • optional
  • default: undefined

hardcoded ?

retail boolean
  • optional
  • default: undefined

retail ?

remastered boolean
  • optional
  • default: undefined

remastered ?

season number | numberSearchSyntax
  • optional
  • default: undefined

the season

episode number | numberSearchSyntax
  • optional
  • default: undefined

the episode

year number | numberSearchSyntax
  • optional
  • default: undefined

the year

title string | string[]
  • optional
  • default: undefined

the title

resolution string | string[]
  • optional
  • default: undefined

the resolution

codec string | string[]
  • optional
  • default: undefined

the codec

audio string | string[]
  • optional
  • default: undefined

the audio

group string | string[]
  • optional
  • default: undefined

the group

region string | string[]
  • optional
  • default: undefined

the region

container string | string[]
  • optional
  • default: undefined

the container

language string | string[]
  • optional
  • default: undefined

the language

source string | string[]
  • optional
  • default: undefined

the source

additionalProperties additionalProperties[]
  • optional
  • default: []

additional Properties