/
index.html
192 lines (144 loc) · 8.42 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Home - Documentation</title>
<script src="scripts/prettify/prettify.js"></script>
<script src="scripts/prettify/lang-css.js"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
<div class="navicon"></div>
</label>
<label for="nav-trigger" class="overlay"></label>
<nav>
<li class="nav-link nav-home-link"><a href="index.html">Home</a></li><li class="nav-heading">Classes</li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="TorrentLibrary.html">TorrentLibrary</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TorrentLibrary.html#.listVideosExtension">listVideosExtension</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TorrentLibrary.html#addNewPath">addNewPath</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TorrentLibrary.html#hasPathsProvidedByUser">hasPathsProvidedByUser</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TorrentLibrary.html#removeOldFiles">removeOldFiles</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TorrentLibrary.html#scan">scan</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TorrentLibrary.html#toJSON">toJSON</a></span></li><li class="nav-heading">Externals</li><li class="nav-heading"><span class="nav-item-type type-external">E</span><span class="nav-item-name"><a href="external-Promise.html">Promise</a></span></li>
</nav>
<div id="main">
<section class="readme">
<article><h1>torrent-files-library <a href="https://travis-ci.org/jy95/torrent-files-library"><img src="https://img.shields.io/travis/jy95/torrent-files-library.svg" alt="Build Status"></a> <a href="https://coveralls.io/github/jy95/torrent-files-library?branch=master"><img src="https://img.shields.io/coveralls/jy95/torrent-files-library/master.svg" alt="Coveralls branch"></a> <a href="https://david-dm.org/jy95/torrent-files-library"><img src="https://img.shields.io/david/jy95/torrent-files-library.svg" alt="Dependency Status"></a> <a href="https://david-dm.org/jy95/torrent-files-library?type=dev"><img src="https://img.shields.io/david/dev/jy95/torrent-files-library.svg" alt="Dev Dependency Status"></a> <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a> <a href="https://github.com/semantic-release/semantic-release"><img src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg" alt="semantic-release"></a></h1><blockquote>
<p>Enables to get a library of downloaded torrent files (movie or tv show) from directories</p>
</blockquote>
<h1>Table of Contents</h1><ul>
<li><a href="#get-category-for-each-file">Get category for each file</a></li>
<li><a href="#list-found-movies">List found movies</a></li>
<li><a href="#list-each-tv-serie">List each tv serie</a></li>
</ul>
<h3 id="get-category-for-each-file">
Get category for each file
</h3>
<pre class="prettyprint source lang-js"><code>const TorrentLibrary = require("torrent-files-library");
let paths = [
"D:\\DDL\\FILMS", // a path where I can find both movies and tv-series
"D:\\DDL\\SERIES TV\\Le juge et le pilote" // a path where I can find episodes of a tv-serie
];
// create an instance
let libInstance = new TorrentLibrary();
// add these paths inside this lib
libInstance
.addNewPath(...paths)
.then( (message) => {
console.log(message);
return libInstance.scan();
})
.then( (otherMessage) => {
console.log(otherMessage);
setTimeout(function(){
// display the found files and their category
libInstance
.allFilesWithCategory
.forEach(function(value,key){
console.log(key + " : " + value);
});
}, 1000);
})
.catch( (err) => {
console.log(err.message);
});</code></pre><p><img src="https://raw.githubusercontent.com/jy95/torrent-files-library/master/demo/fileMapping.png" alt="fileMappingDemo"></p>
<h3 id="list-found-movies">
List found movies
</h3>
<pre class="prettyprint source lang-js"><code>const TorrentLibrary = require("torrent-files-library");
let paths = [
"D:\\DDL\\FILMS", // a path where I can find both movies and tv-series
"D:\\DDL\\SERIES TV\\Le juge et le pilote" // a path where I can find episodes of a tv-serie
];
// create an instance
let libInstance = new TorrentLibrary();
// add these paths inside this lib
libInstance
.addNewPath(...paths)
.then( (message) => {
console.log(message);
return libInstance.scan();
})
.then( (otherMessage) => {
console.log(otherMessage);
console.log("I found these movie(s) : ");
setTimeout(function(){
// display the found movie(s)
for (let movie of libInstance.allMovies) {
console.log(movie.title + ((movie.year) ? " - " + movie.year : "") + " at " + movie.filePath );
}
}, 1000);
})
.catch( (err) => {
console.log(err.message);
});</code></pre><p><img src="https://raw.githubusercontent.com/jy95/torrent-files-library/master/demo/foundMovies.png" alt="foundMovies"></p>
<h3 id="list-each-tv-serie">
List each tv serie
</h3>
<pre class="prettyprint source lang-js"><code>const TorrentLibrary = require("torrent-files-library");
let paths = [
"D:/DDL/FILMS", // a path where I can find both movies and tv-series
"D:\\DDL\\SERIES TV\\Le juge et le pilote" // a path where I can find episodes of a tv-serie
];
// create an instance
let libInstance = new TorrentLibrary();
// add these paths inside this lib
libInstance
.addNewPath(...paths)
.then( (message) => {
console.log(message);
return libInstance.scan();
})
.then( (otherMessage) => {
console.log(otherMessage);
console.log("I found these tv-series :");
let mapSeries = libInstance.allTvSeries;
for (let [foundTvShow,episodeSet] of mapSeries.entries() ) {
console.log("\n"+foundTvShow);
console.log("\t Total found episodes : ", episodeSet.size);
let foundSeasons = new Set([...episodeSet].map( episode => episode.season));
console.log("\t Found season(s) count : ", foundSeasons.size);
for (let seasonNumber of foundSeasons){
console.log("\t\t Season %d", seasonNumber);
let seasonEpisodes = [...episodeSet].filter(episode => episode.season === seasonNumber);
console.log("\t\t\t Season count : " + seasonEpisodes.length);
console.log("\t\t\t Files : ");
seasonEpisodes.forEach( episode => console.log("\t\t\t " + episode.filePath));
}
}
})
.catch( (err) => {
console.log(err.message);
});</code></pre><p><img src="https://raw.githubusercontent.com/jy95/torrent-files-library/master/demo/foundTvSeries.png" alt="foundTvSeries"></p>
<p>More example are coming ...</p></article>
</section>
</div>
<br class="clear">
<footer>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.4</a> on Sun Sep 03 2017 22:48:06 GMT+0200 (Romance Daylight Time) using the Minami theme.
</footer>
<script>prettyPrint();</script>
<script src="scripts/linenumber.js"></script>
</body>
</html>