From afef9f743d25f1dd8b6b283152e492de09c3e25a Mon Sep 17 00:00:00 2001 From: jy95 Date: Sun, 3 Sep 2017 21:29:13 +0200 Subject: [PATCH] Docs: updated docs --- docs/TorrentLibrary.html | 238 ++++++++++++++++++++++-------------- docs/TorrentLibrary.js.html | 33 ++++- docs/external-Promise.html | 6 +- docs/index.html | 4 +- src/TorrentLibrary.js | 8 ++ 5 files changed, 183 insertions(+), 106 deletions(-) diff --git a/docs/TorrentLibrary.html b/docs/TorrentLibrary.html index 732155f..80a4120 100644 --- a/docs/TorrentLibrary.html +++ b/docs/TorrentLibrary.html @@ -24,7 +24,7 @@
@@ -103,7 +103,7 @@

new Tor
Source:
@@ -219,7 +219,7 @@

(static)
Source:
@@ -286,7 +286,7 @@

(static) Source:
@@ -353,7 +353,7 @@

a
Source:
@@ -435,7 +435,7 @@

allMoviesSource:
@@ -464,19 +464,7 @@
Type:
Example
-
// an JSON stringified example of this method
-[
- {
-  "year":2012,
-  "source":"dvdrip",
-  "codec":"xvid",
-  "group":"-www.zone-telechargement.ws.avi",
-  "container":"avi",
-  "language":"truefrench",
-  "title":"Bad Ass",
-  "filePath":"D:\\workspaceNodeJs\\torrent-files-library\\test\\folder1\\Bad.Ass.2012.LiMiTED.TRUEFRENCH.DVDRiP.XviD-www.zone-telechargement.ws.avi"
- }
-]
+
// an JSON stringified example of this method
[
 {
  "year":2012,
  "source":"dvdrip",
  "codec":"xvid",
  "group":"-www.zone-telechargement.ws.avi",
  "container":"avi",
  "language":"truefrench",
  "title":"Bad Ass",
  "filePath":"D:\\workspaceNodeJs\\torrent-files-library\\test\\folder1\\Bad.Ass.2012.LiMiTED.TRUEFRENCH.DVDRiP.XviD-www.zone-telechargement.ws.avi"
 }
]

@@ -529,7 +517,7 @@

allTvSerie
Source:
@@ -558,31 +546,7 @@

Type:
Example
-
// an JSON stringified example of this method
-{
-"The Blacklist":[
-   {
-     "season":4,
-     "episode":21,
-     "source":"webrip",
-     "codec":"xvid",
-     "container":"avi",
-     "language":"french",
-     "title":"The Blacklist",
-     "filePath":"D:\\workspaceNodeJs\\torrent-files-library\\test\\folder1\\The.Blacklist.S04E21.FRENCH.WEBRip.XviD.avi"
-  },
-  {
-     "season":4,
-     "episode":14,
-     "source":"webrip",
-     "codec":"xvid",
-     "container":"avi",
-     "language":"french",
-     "title":"The Blacklist",
-     "filePath":"D:\\workspaceNodeJs\\torrent-files-library\\test\\folder2\\The.Blacklist.S04E14.FRENCH.WEBRip.XviD.avi"
-  }
-]
-}
+
// an JSON stringified example of this method
{
"The Blacklist":[
   {
     "season":4,
     "episode":21,
     "source":"webrip",
     "codec":"xvid",
     "container":"avi",
     "language":"french",
     "title":"The Blacklist",
     "filePath":"D:\\workspaceNodeJs\\torrent-files-library\\test\\folder1\\The.Blacklist.S04E21.FRENCH.WEBRip.XviD.avi"
  },
  {
     "season":4,
     "episode":14,
     "source":"webrip",
     "codec":"xvid",
     "container":"avi",
     "language":"french",
     "title":"The Blacklist",
     "filePath":"D:\\workspaceNodeJs\\torrent-files-library\\test\\folder2\\The.Blacklist.S04E14.FRENCH.WEBRip.XviD.avi"
  }
]
}
@@ -632,7 +596,7 @@

catego
Source:
@@ -716,7 +680,7 @@

defaultPat
Source:
@@ -795,7 +759,7 @@

pathsSource:
@@ -824,8 +788,7 @@
Type:
Example
-
// after have added some paths ...
-[ "D:\somePath", "D:\anotherPath" ]
+
// after have added some paths ...
[ "D:\somePath", "D:\anotherPath" ]
@@ -875,7 +838,7 @@

storesSource:
@@ -962,7 +925,7 @@

(static)
Source:
@@ -1023,8 +986,7 @@
Returns:
Example
-
// Returns [..., 'webm', 'wmv']
-TorrentLibrary.listVideosExtension()
+
// Returns [..., 'webm', 'wmv']
TorrentLibrary.listVideosExtension()
@@ -1081,7 +1043,7 @@

addNewPath<
Source:
@@ -1208,8 +1170,7 @@

Returns:
Example
-
// return resolved Promise "All paths were added!"
-TorrentLibraryInstance.addNewPath("C:\Users\jy95\Desktop\New folder","C:\Users\jy95\Desktop\New folder2");
+
// return resolved Promise "All paths were added!"
TorrentLibraryInstance.addNewPath("C:\Users\jy95\Desktop\New folder","C:\Users\jy95\Desktop\New folder2");
@@ -1266,7 +1227,7 @@

Source:
@@ -1327,8 +1288,7 @@

Returns:
Example
-
TorrentLibraryInstance.addNewPath("C:\Users\jy95\Desktop\New folder","C:\Users\jy95\Desktop\New folder2");
-TorrentLibraryInstance.hasPathsProvidedByUser() // TRUE
+
TorrentLibraryInstance.addNewPath("C:\Users\jy95\Desktop\New folder","C:\Users\jy95\Desktop\New folder2");
TorrentLibraryInstance.hasPathsProvidedByUser() // TRUE
@@ -1385,7 +1345,7 @@

removeO
Source:
@@ -1512,11 +1472,7 @@

Returns:
Example
-
// with multiples files
-TorrentLibraryInstance.removeOldFiles(
-   "D:\somePath\Captain Russia The Summer Soldier (2014) 1080p BrRip x264.MKV",
-   "D:\\workspaceNodeJs\\torrent-files-library\\test\\folder1\\The.Blacklist.S04E21.FRENCH.WEBRip.XviD.avi"
-)
+
// with multiples files
TorrentLibraryInstance.removeOldFiles(
   "D:\somePath\Captain Russia The Summer Soldier (2014) 1080p BrRip x264.MKV",
   "D:\\workspaceNodeJs\\torrent-files-library\\test\\folder1\\The.Blacklist.S04E21.FRENCH.WEBRip.XviD.avi"
)
@@ -1573,7 +1529,7 @@

scanSource:
@@ -1632,6 +1588,124 @@
Returns:
+ + + +
+ + + +

toJSON() → {string}

+ + + + + +
+

Returns an JSON stringified of the current state

+
+ + + + + +
+ + + + +
Since:
+
  • 1.0.3
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + +
See:
+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +string + + +
+
+ + +
+

json - the JSON stringified

+
+ + +
+ + +
@@ -1713,33 +1787,7 @@
Type:
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"
-             }
-         ]
-     ]
-]
+
// 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"
             }
         ]
     ]
]
@@ -2555,7 +2603,7 @@
Type:

- Generated by JSDoc 3.5.4 on Sun Sep 03 2017 17:36:37 GMT+0200 (Romance Daylight Time) using the Minami theme. + Generated by JSDoc 3.5.4 on Sun Sep 03 2017 21:28:15 GMT+0200 (Romance Daylight Time) using the Minami theme.
diff --git a/docs/TorrentLibrary.js.html b/docs/TorrentLibrary.js.html index 6a63c28..bd7551d 100644 --- a/docs/TorrentLibrary.js.html +++ b/docs/TorrentLibrary.js.html @@ -24,7 +24,7 @@
@@ -135,8 +135,9 @@

TorrentLibrary.js

* @see {@link https://lodash.com/docs/4.17.4#uniq} * @see {@link https://lodash.com/docs/4.17.4#difference} * @see {@link https://lodash.com/docs/4.17.4#partition} + * @see {@link https://lodash.com/docs/4.17.4#cloneDeep} */ -import { uniq, difference, partition } from 'lodash'; +import { uniq, difference, partition, cloneDeep } from 'lodash'; /** * A promise object provided by the bluebird promise library. @@ -520,7 +521,7 @@

TorrentLibrary.js

* ] */ get allMovies() { - return this.stores.get(TorrentLibrary.MOVIES_TYPE); + return cloneDeep(this.stores.get(TorrentLibrary.MOVIES_TYPE)); } /** @@ -557,7 +558,7 @@

TorrentLibrary.js

* } */ get allTvSeries() { - return this.stores.get(TorrentLibrary.TV_SERIES_TYPE); + return cloneDeep(this.stores.get(TorrentLibrary.TV_SERIES_TYPE)); } /** @@ -570,7 +571,27 @@

TorrentLibrary.js

* { "D:\somePath\Captain Russia The Summer Soldier (2014) 1080p BrRip x264.MKV" => TorrentLibrary.MOVIES_TYPE } */ get allFilesWithCategory() { - return this.categoryForFile; + return cloneDeep(this.categoryForFile); + } + + /** + * Returns an JSON stringified of the current state + * @since 1.0.3 + * @instance + * @memberOf TorrentLibrary + * @see {@link https://github.com/jy95/torrent-files-library/tree/master/test/example.json} + * @return {string} json - the JSON stringified + */ + toJSON() { + const tvSeries = this.allTvSeries; + return `{ + "paths":${JSON.stringify([...this.paths])}, + "allFilesWithCategory":${JSON.stringify([...this.allFilesWithCategory])}, + "movies":${JSON.stringify([...this.allMovies])}, + "tv-series":${JSON.stringify([...tvSeries].map(serie => + // serie[0] contains the title and [1] the wrong JSON ; let fix it + [serie[0], [...tvSeries.get(serie[0])]]))} + }`; } } @@ -587,7 +608,7 @@

TorrentLibrary.js


- Generated by JSDoc 3.5.4 on Sun Sep 03 2017 17:36:37 GMT+0200 (Romance Daylight Time) using the Minami theme. + Generated by JSDoc 3.5.4 on Sun Sep 03 2017 21:28:15 GMT+0200 (Romance Daylight Time) using the Minami theme.
diff --git a/docs/external-Promise.html b/docs/external-Promise.html index 73bfee7..80accff 100644 --- a/docs/external-Promise.html +++ b/docs/external-Promise.html @@ -24,7 +24,7 @@
@@ -87,7 +87,7 @@

Source:
@@ -139,7 +139,7 @@


- Generated by JSDoc 3.5.4 on Sun Sep 03 2017 17:36:37 GMT+0200 (Romance Daylight Time) using the Minami theme. + Generated by JSDoc 3.5.4 on Sun Sep 03 2017 21:28:15 GMT+0200 (Romance Daylight Time) using the Minami theme.
diff --git a/docs/index.html b/docs/index.html index 255ca98..9aeacc9 100644 --- a/docs/index.html +++ b/docs/index.html @@ -24,7 +24,7 @@
@@ -183,7 +183,7 @@


- Generated by JSDoc 3.5.4 on Sun Sep 03 2017 17:36:37 GMT+0200 (Romance Daylight Time) using the Minami theme. + Generated by JSDoc 3.5.4 on Sun Sep 03 2017 21:28:15 GMT+0200 (Romance Daylight Time) using the Minami theme.
diff --git a/src/TorrentLibrary.js b/src/TorrentLibrary.js index a4730ac..6b6faba 100644 --- a/src/TorrentLibrary.js +++ b/src/TorrentLibrary.js @@ -533,6 +533,14 @@ class TorrentLibrary extends EventEmitter { return cloneDeep(this.categoryForFile); } + /** + * Returns an JSON stringified of the current state + * @since 1.0.3 + * @instance + * @memberOf TorrentLibrary + * @see {@link https://github.com/jy95/torrent-files-library/tree/master/test/example.json} + * @return {string} json - the JSON stringified + */ toJSON() { const tvSeries = this.allTvSeries; return `{