seedlinux

find open source torrents and stats for people wishing to contribute bandwidth.
git clone git://git.beardyjay.co.uk/seedlinux
Log | Files | Refs | README | LICENSE

commit d1fa28468350571c1ba967b2fbf5ece862b823e8
parent 609e8c94730a5c4fcc6017a1234ed5139b2dde31
Author: Jay Scott <jay@jayscott.co.uk>
Date:   Wed, 28 Jun 2017 13:47:56 +0100

parse torrents and populate mongodb

Diffstat:
Mapp.js | 6++----
Mpackage-lock.json | 510+------------------------------------------------------------------------------
Mpackage.json | 2++
Mroutes/index.js | 15+++++++--------
Mroutes/parse.js | 53++++++++++++++++++++++++++++++++++++++++++++---------
Droutes/scrape.js | 9---------
Mviews/index.pug | 4++--
Dviews/scrape.pug | 8--------
8 files changed, 62 insertions(+), 545 deletions(-)

diff --git a/app.js b/app.js @@ -5,13 +5,12 @@ var logger = require('morgan'); var cookieParser = require('cookie-parser'); var bodyParser = require('body-parser'); - -// MongoDB +// mongodb var mongo = require('mongodb'); var monk = require('monk'); var db = monk('localhost:27017/seedlinux'); -var scrape = require('./routes/scrape'); +// routes var parse = require('./routes/parse'); var index = require('./routes/index'); @@ -38,7 +37,6 @@ app.use(function(req,res,next){ }); app.use('/', index); -app.use('/scrape/', scrape); app.use('/parse/', parse); // catch 404 and forward to error handler diff --git a/package-lock.json b/package-lock.json @@ -25,11 +25,6 @@ } } }, - "addr-to-ip-port": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/addr-to-ip-port/-/addr-to-ip-port-1.4.2.tgz", - "integrity": "sha1-fkb/Hya3qfXjP9g51XrvYwO0xpI=" - }, "align-text": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", @@ -40,28 +35,11 @@ "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=" }, - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" - }, "app-root-path": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/app-root-path/-/app-root-path-2.0.1.tgz", "integrity": "sha1-zWLc+OT9WkF+/GZNLlsQZTxlG0Y=" }, - "aproba": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.1.2.tgz", - "integrity": "sha512-ZpYajIfO0j2cOFTO955KUMIKNmj6zhX8kVztMAxFsDaMwz+9Z9SV0uou2pC9HJqcfpffOsjnbrDMvkNy+9RXPw==", - "optional": true - }, - "are-we-there-yet": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.4.tgz", - "integrity": "sha1-u13KOCu5TwXhUZQ3PRb9O6HKEQ0=", - "optional": true - }, "array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", @@ -72,16 +50,6 @@ "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.5.tgz", "integrity": "sha1-UidltQw1EEkOUtfc/ghe+bqWlY8=" }, - "async": { - "version": "0.2.10", - "resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz", - "integrity": "sha1-trvgsGdLnXGXCMo43owjfLUmw9E=" - }, - "aws-sign": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/aws-sign/-/aws-sign-0.2.0.tgz", - "integrity": "sha1-xVAThWyBlOyFSgy+yQqrWgTOOsU=" - }, "basic-auth": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-1.1.0.tgz", @@ -99,38 +67,11 @@ } } }, - "bindings": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz", - "integrity": "sha1-FK1hE4EtLTfXLme0ystLtyZQXxE=", - "optional": true - }, - "bittorrent-peerid": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/bittorrent-peerid/-/bittorrent-peerid-1.2.0.tgz", - "integrity": "sha1-n2dWEvDmr8bvNFDfulH/cjir83E=" - }, - "bittorrent-tracker": { - "version": "9.2.3", - "resolved": "https://registry.npmjs.org/bittorrent-tracker/-/bittorrent-tracker-9.2.3.tgz", - "integrity": "sha512-KW7nE/Lwxlpy6BmEEufvwXXsAnq7961xsoE8qL2PWrwKqKjEWLIX/T3REdq6o+RQT0YYdmy7NnqVRs/w+2LUjg==" - }, - "bl": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.1.tgz", - "integrity": "sha1-ysMo977kVzDUBLaSID/LWQ4XLV4=", - "optional": true - }, "blob-to-buffer": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/blob-to-buffer/-/blob-to-buffer-1.2.6.tgz", "integrity": "sha1-CJrCZMaGtz6tbFOaSEqAA7+7IDM=" }, - "bn.js": { - "version": "4.11.7", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.7.tgz", - "integrity": "sha512-LxFiV5mefv0ley0SzqkOPR1bC4EbpPx8LkOz5vMe/Yi15t5hzwgO/G+tc7wOtL4PZTYjwHu8JnEiSLumuSjSfA==" - }, "body-parser": { "version": "1.17.2", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.17.2.tgz", @@ -143,11 +84,6 @@ } } }, - "boom": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/boom/-/boom-0.3.8.tgz", - "integrity": "sha1-yM2wQUNZEnQWKMBE7Mcy0dF8Ceo=" - }, "bson": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/bson/-/bson-1.0.4.tgz", @@ -158,12 +94,6 @@ "resolved": "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz", "integrity": "sha1-mXjOMXOIxkmth5MCjDR37wRKi1E=" }, - "bufferutil": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-3.0.1.tgz", - "integrity": "sha1-ILLvUVmsSfIORLzjjnw1pqkE7mY=", - "optional": true - }, "bytes": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/bytes/-/bytes-2.4.0.tgz", @@ -184,12 +114,6 @@ "resolved": "https://registry.npmjs.org/character-parser/-/character-parser-2.2.0.tgz", "integrity": "sha1-x84o821LzZdE5f/CxfzeHHMmH8A=" }, - "chownr": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.0.1.tgz", - "integrity": "sha1-4qdQQqlVGQi+vSW4Uj1fl2nXkYE=", - "optional": true - }, "clean-css": { "version": "3.4.27", "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-3.4.27.tgz", @@ -200,36 +124,11 @@ "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=" }, - "code-point-at": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" - }, - "combined-stream": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-0.0.7.tgz", - "integrity": "sha1-ATfmV7qlp1QcV6w3rF/AfXO03B8=" - }, "commander": { "version": "2.8.1", "resolved": "https://registry.npmjs.org/commander/-/commander-2.8.1.tgz", "integrity": "sha1-Br42f+v9oMMwqh4qBy09yXYkJdQ=" }, - "compact2string": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/compact2string/-/compact2string-1.4.0.tgz", - "integrity": "sha1-qZzZbqAAUlaEsmloOuIiLW7qe0k=" - }, - "concat-stream": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.0.tgz", - "integrity": "sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc=" - }, - "console-control-strings": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", - "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" - }, "constantinople": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/constantinople/-/constantinople-3.1.0.tgz", @@ -250,11 +149,6 @@ "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" }, - "cookie-jar": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/cookie-jar/-/cookie-jar-0.2.0.tgz", - "integrity": "sha1-ZOzAasl423leS1KQy+SLo3gUAPo=" - }, "cookie-parser": { "version": "1.4.3", "resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.3.tgz", @@ -270,11 +164,6 @@ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, - "cryptiles": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-0.1.3.tgz", - "integrity": "sha1-GlVnNPBtJLo0hirpy55wmjr7/xw=" - }, "debug": { "version": "2.6.8", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", @@ -285,23 +174,6 @@ "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" }, - "deep-extend": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.4.2.tgz", - "integrity": "sha1-SLaZwn4zS/ifEIkr5DL25MfTSn8=", - "optional": true - }, - "delayed-stream": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-0.0.5.tgz", - "integrity": "sha1-1LH0OpPoKW3+AmlPRoC8N6MTxz8=" - }, - "delegates": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", - "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", - "optional": true - }, "depd": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.0.tgz", @@ -327,11 +199,6 @@ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.1.tgz", "integrity": "sha1-eePVhlU0aQn+bw9Fpd5oEDspTSA=" }, - "end-of-stream": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.0.tgz", - "integrity": "sha1-epDYM+/abPpurA9JSduw+tOmMgY=" - }, "es6-promise": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.2.1.tgz", @@ -347,12 +214,6 @@ "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.0.tgz", "integrity": "sha1-b2Ma7zNtbEY2K1F2QETOIWvjwFE=" }, - "expand-template": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-1.0.3.tgz", - "integrity": "sha1-bDAzIxd6YrGyLAcCefeGEoe2mxo=", - "optional": true - }, "express": { "version": "4.15.3", "resolved": "https://registry.npmjs.org/express/-/express-4.15.3.tgz", @@ -377,28 +238,6 @@ } } }, - "flatten": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/flatten/-/flatten-0.0.1.tgz", - "integrity": "sha1-VURAdm2goNYDmZ9DNFP2wvxqdcE=" - }, - "forever-agent": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.2.0.tgz", - "integrity": "sha1-4cJcetROCcOPIzh2x2/MJP+EOx8=" - }, - "form-data": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-0.0.10.tgz", - "integrity": "sha1-2zRaU3jYau6x7V1VO4aawZLS9e0=", - "dependencies": { - "mime": { - "version": "1.2.11", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.2.11.tgz", - "integrity": "sha1-WCA+7Ybjpe8XrtK32evUfwpg3RA=" - } - } - }, "forwarded": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.0.tgz", @@ -414,28 +253,11 @@ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.0.tgz", "integrity": "sha1-FhdnFMgBeY5Ojyz391KUZ7tKV3E=" }, - "gauge": { - "version": "2.7.4", - "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", - "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", - "optional": true - }, - "get-browser-rtc": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/get-browser-rtc/-/get-browser-rtc-1.0.2.tgz", - "integrity": "sha1-u81AyEUaftTvXDc7gWmkCd0dEdk=" - }, "get-stdin": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-5.0.1.tgz", "integrity": "sha1-Ei4WFZHiH/TFJTAwVpPyDmOTo5g=" }, - "github-from-package": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", - "integrity": "sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4=", - "optional": true - }, "graceful-readlink": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", @@ -446,22 +268,6 @@ "resolved": "https://registry.npmjs.org/has/-/has-1.0.1.tgz", "integrity": "sha1-hGFzP1OLCDfJNh45qauelwTcLyg=" }, - "has-unicode": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", - "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", - "optional": true - }, - "hawk": { - "version": "0.10.2", - "resolved": "https://registry.npmjs.org/hawk/-/hawk-0.10.2.tgz", - "integrity": "sha1-mzYd7pWpMWQObVBOBWCaj8OsRdI=" - }, - "hoek": { - "version": "0.7.6", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-0.7.6.tgz", - "integrity": "sha1-YPvZBFV1Qc0rh5Wr8wihs3cOFVo=" - }, "http-errors": { "version": "1.6.1", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.1.tgz", @@ -477,17 +283,6 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, - "ini": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.4.tgz", - "integrity": "sha1-BTfLedr1m1mhpRff9wbIbsA5Fi4=", - "optional": true - }, - "ip": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", - "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=" - }, "ipaddr.js": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.3.0.tgz", @@ -503,11 +298,6 @@ "resolved": "https://registry.npmjs.org/is-expression/-/is-expression-2.1.0.tgz", "integrity": "sha1-kb6dR968/vB3l36XIr5tz7RGXvA=" }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=" - }, "is-promise": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", @@ -528,11 +318,6 @@ "resolved": "https://registry.npmjs.org/js-stringify/-/js-stringify-1.0.2.tgz", "integrity": "sha1-Fzb939lyTyijaCrcYjCufk6Weds=" }, - "json-stringify-safe": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-3.0.0.tgz", - "integrity": "sha1-nbew5TDH8onF6MhDKvGRwv91pbM=" - }, "jstransformer": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/jstransformer/-/jstransformer-1.0.0.tgz", @@ -548,21 +333,16 @@ "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=" }, + "lint": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/lint/-/lint-1.1.2.tgz", + "integrity": "sha1-Ne0GTzIlR8MxNY2JmGhmSWi6Nx8=" + }, "longest": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=" }, - "lru": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/lru/-/lru-3.1.0.tgz", - "integrity": "sha1-6n+4VG2DczOWoTCR12z+tMBoN9U=" - }, - "magnet-link": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/magnet-link/-/magnet-link-1.1.1.tgz", - "integrity": "sha1-Gh4ChaeNJYo1PqpUyS+f8FjN+Z0=" - }, "magnet-uri": { "version": "5.1.7", "resolved": "https://registry.npmjs.org/magnet-uri/-/magnet-uri-5.1.7.tgz", @@ -598,23 +378,6 @@ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.15.tgz", "integrity": "sha1-pOv1BkCUVpI3uM9wBGd20J/JKu0=" }, - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" - }, - "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dependencies": { - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" - } - } - }, "mongodb": { "version": "2.2.29", "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-2.2.29.tgz", @@ -670,50 +433,11 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, - "nan": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.6.2.tgz", - "integrity": "sha1-5P805slf37WuzAjeZZb0NgWn20U=", - "optional": true - }, "negotiator": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" }, - "node-abi": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.0.3.tgz", - "integrity": "sha1-DKZ+XmZ7jhNDVJyhcVOoFdC7/ao=", - "optional": true - }, - "node-uuid": { - "version": "1.4.8", - "resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.8.tgz", - "integrity": "sha1-sEDrCSOWivq/jTL7HxfxFn/auQc=" - }, - "noop-logger": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/noop-logger/-/noop-logger-0.1.1.tgz", - "integrity": "sha1-lKKxYzxPExdVMAfYlm/Q6EG2pMI=", - "optional": true - }, - "npmlog": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.0.tgz", - "integrity": "sha512-ocolIkZYZt8UveuiDS0yAkkIjid1o7lPG8cYm05yNYzBn8ykQtaiPMEGp8fY9tKdDgm8okpdKzkvu1y9hUYugA==", - "optional": true - }, - "number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" - }, - "oauth-sign": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.2.0.tgz", - "integrity": "sha1-oOahcV2u0GLzIrYit/5a/RA1tuI=" - }, "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -734,12 +458,6 @@ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=" }, - "os-homedir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", - "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", - "optional": true - }, "parse-torrent": { "version": "5.8.3", "resolved": "https://registry.npmjs.org/parse-torrent/-/parse-torrent-5.8.3.tgz", @@ -765,20 +483,6 @@ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" }, - "prebuild-install": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-2.1.2.tgz", - "integrity": "sha1-2a4MqFMw4Dli2TKS+VqLRMLr9QU=", - "optional": true, - "dependencies": { - "simple-get": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-1.4.3.tgz", - "integrity": "sha1-6XVe2kB+ltpAxeUVjJ6jezO+y+s=", - "optional": true - } - } - }, "process-nextick-args": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", @@ -866,33 +570,11 @@ "resolved": "https://registry.npmjs.org/pug-walk/-/pug-walk-1.1.3.tgz", "integrity": "sha1-181bI9s8qHxjbIaglz+c2OAwQ2w=" }, - "pump": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pump/-/pump-1.0.2.tgz", - "integrity": "sha1-Oz7mUS+U8OV1U4wXmV+fFpkKXVE=" - }, "qs": { "version": "6.4.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.4.0.tgz", "integrity": "sha1-E+JtKK1rD/qpExLNO/cI7TUecjM=" }, - "random-iterate": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/random-iterate/-/random-iterate-1.0.1.tgz", - "integrity": "sha1-99l9kt7mZl7F9toIx/ljytSyrJk=" - }, - "randombytes": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.0.5.tgz", - "integrity": "sha512-8T7Zn1AhMsQ/HI1SjcCfT/t4ii3eAqco3yOcSzS4mozsOz69lHLsoMXmF9nZgnFanYscnSlUSgs8uZyKzpE6kg==", - "dependencies": { - "safe-buffer": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" - } - } - }, "range-parser": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", @@ -903,51 +585,6 @@ "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.2.0.tgz", "integrity": "sha1-mUl2z2pQlqQRYoQEkvC9xdbn+5Y=" }, - "rc": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.1.tgz", - "integrity": "sha1-LgPo5C7kULjLPc5lvhv4l04d/ZU=", - "optional": true - }, - "read-torrent": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/read-torrent/-/read-torrent-1.3.0.tgz", - "integrity": "sha1-Tg71vqbLJNMYQ+tvqFQ60CMqufQ=", - "dependencies": { - "bencode": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/bencode/-/bencode-0.7.0.tgz", - "integrity": "sha1-gR7WR8ARiUXkG7S7veqaLHihcIM=" - }, - "magnet-uri": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/magnet-uri/-/magnet-uri-2.0.1.tgz", - "integrity": "sha1-0zHT3804NlZa3g/DyjFeOSF7sgk=" - }, - "parse-torrent": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/parse-torrent/-/parse-torrent-4.1.0.tgz", - "integrity": "sha1-qBS9hQXotY6I64/z4tr/XRmnEbc=", - "dependencies": { - "magnet-uri": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/magnet-uri/-/magnet-uri-4.2.3.tgz", - "integrity": "sha1-ecxtZaALtbfvXCWuYOu7XZp2gag=" - } - } - }, - "parse-torrent-file": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/parse-torrent-file/-/parse-torrent-file-2.1.4.tgz", - "integrity": "sha1-MtS2r95jFCDl9BWRmiIrd0tXVwc=" - }, - "thirty-two": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/thirty-two/-/thirty-two-0.0.2.tgz", - "integrity": "sha1-QlPinYywWPBIAmfFaYwOSSflS2o=" - } - } - }, "readable-stream": { "version": "2.2.7", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.2.7.tgz", @@ -958,28 +595,6 @@ "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=" }, - "request": { - "version": "2.16.6", - "resolved": "https://registry.npmjs.org/request/-/request-2.16.6.tgz", - "integrity": "sha1-hy/kRa5y3iZrN4edatfclI+gHK0=", - "dependencies": { - "mime": { - "version": "1.2.11", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.2.11.tgz", - "integrity": "sha1-WCA+7Ybjpe8XrtK32evUfwpg3RA=" - }, - "qs": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/qs/-/qs-0.5.6.tgz", - "integrity": "sha1-MbGtBYVnZRxSaSFQa5qHk5EaA4Q=" - }, - "tunnel-agent": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.2.0.tgz", - "integrity": "sha1-aFPCr7GyEJ5FYp5JK9419Fnqaeg=" - } - } - }, "require_optional": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/require_optional/-/require_optional-1.0.1.tgz", @@ -1000,16 +615,6 @@ "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=" }, - "run-parallel": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.1.6.tgz", - "integrity": "sha1-KQA8miFj4B4tLfyQV18sbB1hoDk=" - }, - "run-series": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/run-series/-/run-series-1.1.4.tgz", - "integrity": "sha1-iac93F51ye+KtjIMChYA1qQRebk=" - }, "rusha": { "version": "0.8.6", "resolved": "https://registry.npmjs.org/rusha/-/rusha-0.8.6.tgz", @@ -1047,23 +652,11 @@ "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.12.3.tgz", "integrity": "sha1-n0uhni8wMMVH+K+ZEHg47DjVseI=" }, - "set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", - "optional": true - }, "setprototypeof": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz", "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ=" }, - "signal-exit": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", - "optional": true - }, "simple-concat": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz", @@ -1081,33 +674,11 @@ } } }, - "simple-peer": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/simple-peer/-/simple-peer-8.1.1.tgz", - "integrity": "sha512-t2zRYgj1HE5lbfkuL2bJ8s8Q60TQfPwOfDj/TA1/N/Qvi8pdj4uEU0bctrZIsHZlzuU7HM+RFR/YBbiLJjHpxQ==" - }, "simple-sha1": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/simple-sha1/-/simple-sha1-2.1.0.tgz", "integrity": "sha1-lCe7lv8SY8wQqEFM7dUaGLkZ6LM=" }, - "simple-websocket": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/simple-websocket/-/simple-websocket-5.0.2.tgz", - "integrity": "sha1-BA2Q3qnkGZqXYTOUzmiTLErvPUQ=", - "dependencies": { - "ws": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/ws/-/ws-2.3.1.tgz", - "integrity": "sha1-a5Sz5EfLajY/eF6vlK9jWejoHIA=" - } - } - }, - "sntp": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-0.1.4.tgz", - "integrity": "sha1-XvSBuVGnspr/30r9fyaDj8ESD4Q=" - }, "source-map": { "version": "0.4.4", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", @@ -1130,39 +701,6 @@ } } }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=" - }, - "string2compact": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/string2compact/-/string2compact-1.2.2.tgz", - "integrity": "sha1-Qgs6nuHEaFSRm0oq6sZcQ/pQWXs=" - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=" - }, - "strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", - "optional": true - }, - "tar-fs": { - "version": "1.15.3", - "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-1.15.3.tgz", - "integrity": "sha1-7M+TXpQUk9gVECjmNuUc5MPKfyA=", - "optional": true - }, - "tar-stream": { - "version": "1.5.4", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.5.4.tgz", - "integrity": "sha1-NlSc8E7RrumyowwBQyUiONr5QBY=", - "optional": true - }, "thirty-two": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/thirty-two/-/thirty-two-1.0.2.tgz", @@ -1173,22 +711,11 @@ "resolved": "https://registry.npmjs.org/token-stream/-/token-stream-0.0.1.tgz", "integrity": "sha1-zu78cXp2xDFvEm0LnbqlXX598Bo=" }, - "tunnel-agent": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz", - "integrity": "sha1-Y3PbdpCf5XDgjXNYM2Xtgop07us=", - "optional": true - }, "type-is": { "version": "1.6.15", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.15.tgz", "integrity": "sha1-yrEPtJCeRByChC6v4a1kbIGARBA=" }, - "typedarray": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" - }, "uglify-js": { "version": "2.8.29", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", @@ -1207,32 +734,16 @@ "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", "optional": true }, - "ultron": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.0.tgz", - "integrity": "sha1-sHoualQagV/Go0zNRTO67DB8qGQ=" - }, "uniq": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/uniq/-/uniq-1.0.1.tgz", "integrity": "sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8=" }, - "unordered-array-remove": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/unordered-array-remove/-/unordered-array-remove-1.0.2.tgz", - "integrity": "sha1-xUbo+I4xegzyZEyX7LV9umbSUO8=" - }, "unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" }, - "unzip-response": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/unzip-response/-/unzip-response-1.0.2.tgz", - "integrity": "sha1-uYTwh3/AqJwsdzzB73tbIytbBv4=", - "optional": true - }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -1253,12 +764,6 @@ "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-2.0.1.tgz", "integrity": "sha1-wGavtYK7HLQSjWDqkjkulNXp2+w=" }, - "wide-align": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.2.tgz", - "integrity": "sha512-ijDLlyQ7s6x1JgCLur53osjm/UXUYD9+0PbYKrBsYisYXzCxN+HC3mYDNy/dWdmf3AwqwU3CXwDCvsNgGK1S0w==", - "optional": true - }, "window-size": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", @@ -1279,11 +784,6 @@ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, - "ws": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-3.0.0.tgz", - "integrity": "sha1-mN2wAFbIOQy3Ued4h4hJf5kQO2w=" - }, "xtend": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", diff --git a/package.json b/package.json @@ -3,6 +3,7 @@ "version": "0.0.1", "private": true, "scripts": { + "lint": "eslint **/*.js", "start": "DEBUG=seedlinux:* node ./bin/www" }, "dependencies": { @@ -11,6 +12,7 @@ "cookie-parser": "~1.4.3", "debug": "~2.6.3", "express": "~4.15.2", + "lint": "^1.1.2", "mongodb": "^2.2.29", "monk": "^6.0.1", "morgan": "~1.8.1", diff --git a/routes/index.js b/routes/index.js @@ -1,16 +1,15 @@ -var express = require('express'); -var router = express.Router(); +let express = require('express'); +let router = express.Router(); /* GET home page. */ router.get('/', function(req, res, next) { + let db = req.db; + let collection = db.get('torrents'); - var db = req.db; - var collection = db.get('torrents'); - - collection.find({},{},function(e,docs){ + collection.find({}, {}, function(e, docs) { res.render('index', { - "torrentlist" : docs, - title: "Index Page" + 'torrentlist': docs, + 'title': 'Index Page', }); }); }); diff --git a/routes/parse.js b/routes/parse.js @@ -1,20 +1,55 @@ -var express = require('express'); +const express = require('express'); +var parseTorrent = require('parse-torrent'); +var appRoot = require('app-root-path'); +var fs = require('fs'); var router = express.Router(); +/** + TODO: + - Refactor. + - Move torrent to config option or cmd parsed option. + - Move to commandline tool instead of web route. + - get seeders / leechers on first pass. + + +*/ router.get('/', function (req, res) { - var parseTorrent = require('parse-torrent') - var appRoot = require('app-root-path'); - var fs = require('fs'); + var db = req.db; + var collection = db.get('torrents'); + var torrentFolder = './data/torrents'; - const torrentFolder = './data/torrents'; - - fs.readdir(torrentFolder, (err, files) => { + fs.readdir(torrentFolder, (err, files, next) => { files.forEach(file => { - console.log(fs.readFileSync(parseTorrent(file))) + tFile = fs.readFileSync(torrentFolder + '/' + file) + tData = parseTorrent(tFile) + + var tMagnet = parseTorrent.toMagnetURI({ + infoHash: tData.infoHash + }) + + collection.update({ + name: tData.name}, + { + "name" : tData.name, + "hash" : tData.infoHash, + "announce" : tData.announce, + "created" : tData.created, + "magneturi" : tMagnet, + "files" : tData.files, + "comment" : tData.comment + }, + {upsert: true, safe: false}, + function (err, doc) { + if (err) { + res.status(500).send("There was a problem adding the torrent information to the database."); + } }); + }); }); - res.send('GET request to the parse.') + + res.send('Torrent folder updated \n'); + }); module.exports = router; diff --git a/routes/scrape.js b/routes/scrape.js @@ -1,9 +0,0 @@ -var express = require('express'); -var router = express.Router(); - -router.get('/', function (req, res) { - - res.send('GET request to the scraper') -}); - -module.exports = router; diff --git a/views/index.pug b/views/index.pug @@ -6,8 +6,8 @@ block content .ui.card .content .header= i.name - .meta= i.added - .description= i.info + .meta= i.created + .description= i.comment .extra.content span.left.floated if i.seeders >= 10 diff --git a/views/scrape.pug b/views/scrape.pug @@ -1,7 +0,0 @@ -doctype html -html(lang="en") - head - title Express Routing - body - h1 Express Routing - p The Definitive Guide- \ No newline at end of file