<commit_before>#!/usr/bin/env node

var FileSystem 	= require('fs');

var program		= require('commander');
var lib 		= require('./lib/identifier.js');
var mover 		= require('./lib/mover.js');
var coercion 	= require('./lib/coercion.js');

program
	.version('0.0.2')
	.option('-K, --kind <n>', 'The kind of torrent', /^(single|multi)$/i, false)
	.option('-D, --directory <n>', 'An valid directory path', coercion.getValidFilesListFromDirectory, false)
	.option('-F, --file <n>', 'An valid file path', coercion.getValidFilesListFromFile, false)
	.parse(process.argv);


if(!program.kind) {
	console.log('Error: We need to know the kind of the downloaded torrent');
	process.exit(1);
}

if (program.kind === 'single') {
	if(!program.file || program.directory.length <= 0) {
		console.log('Error: The file is not valid; neither a video nor a subtitle.');
		process.exit(1);
	}
	var files = program.file;
}

if (program.kind === 'multi') {
	if(!program.directory || program.directory.length <= 0) {
		console.log('Error: The directory is not valid; do not exist or do not contains valid files.');
		process.exit(1);
	}
	var files = program.directory;
}

var wasAtLeastOneFileProcessed = false;
for (var index in files) {
	var filePath = files[index];

	var episode = lib.identifyEpisode(filePath);
<commit_msg>[TECH] group the process of the files returned by the coercion service<commit_after>#!/usr/bin/env node

var FileSystem 	= require('fs');

var program		= require('commander');
var lib 		= require('./lib/identifier.js');
var mover 		= require('./lib/mover.js');
var coercion 	= require('./lib/coercion.js');

program
	.version('0.0.2')
	.option('-K, --kind <n>', 'The kind of torrent', /^(single|multi)$/i, false)
	.option('-D, --directory <n>', 'An valid directory path', coercion.getValidFilesListFromDirectory, false)
	.option('-F, --file <n>', 'An valid file path', coercion.getValidFilesListFromFile, false)
	.parse(process.argv);


if(!program.kind) {
	console.log('Error: We need to know the kind of the downloaded torrent');
	process.exit(1);
}

if (program.kind === 'single') {
	var errorMessage = 'Error: The file is not valid; neither a video nor a subtitle.';
	var files = program.file;
} else if (program.kind === 'multi') {
	var errorMessage = 'Error: The directory is not valid; do not exist or do not contains valid files.';
	var files = program.directory;
}

if(!files || files.length <= 0) {
	console.log(errorMessage);
	process.exit(1);
}

var wasAtLeastOneFileProcessed = false;
for (var index in files) {
	var filePath = files[index];

	var episode = lib.identifyEpisode(filePath);

{'fraction_non_alphanumeric': 0.16724204065976217, 'fraction_numerical': 0.005370157268891446, 'mean_word_length': 4.399585921325052, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1573383', 'n_tokens_mistral': 904, 'n_tokens_neox': 871, 'n_words': 255}