cleaning up - seedlinux - Torrent indexing tool opensource torrents with share ratio's etc.
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
       ---
 (DIR) commit 086df62b53d4813f617dfa4d30775ed3aab43cf5
 (DIR) parent 132f57349a4c49f29c509ecb84112ac5bd7ac7f0
 (HTM) Author: Jay Scott <me@jay.scot>
       Date:   Tue, 27 Jun 2017 15:30:24 +0100
       
       cleaning up
       
       Diffstat:
         M README.md                           |      13 ++++++++++++-
         M package.json                        |       4 +---
         M routes/parse.js                     |      27 ++-------------------------
       
       3 files changed, 15 insertions(+), 29 deletions(-)
       ---
 (DIR) diff --git a/README.md b/README.md
       @@ -6,7 +6,6 @@ Seedlinux is a WIP application to list open source torrents that need help with 
        
        If you are using MongoDB directly installed on your local machine or else where then skip the docker commands and go straight for the the import command. 
        
       -
        Pull the latest MongoDB docker image. 
        
        ```bash
       @@ -23,6 +22,18 @@ Seed the data using mongo-import tool.
        mongoimport --db seedlinux --collection torrents --drop --file ./data/dataset.json
        ```
        
       +```json
       +{
       +        "name" : "",
       +        "info_hash" : "",
       +        "magnetic_link" : "",
       +        "seeders" : ,
       +        "leechers" : ,
       +        "comment" : "",
       +        "added" : ""
       +}
       +```
       +
        ### Stuff used to make this:
        
          * [Docker](https://hub.docker.com/_/mongo/) image for MongoDB.
 (DIR) diff --git a/package.json b/package.json
       @@ -7,16 +7,14 @@
          },
          "dependencies": {
            "app-root-path": "^2.0.1",
       -    "bittorrent-tracker": "^9.2.3",
            "body-parser": "~1.17.1",
            "cookie-parser": "~1.4.3",
            "debug": "~2.6.3",
            "express": "~4.15.2",
       -    "magnet-link": "^1.1.1",
       -    "magnet-uri": "^5.1.7",
            "mongodb": "^2.2.29",
            "monk": "^6.0.1",
            "morgan": "~1.8.1",
       +    "parse-torrent": "^5.8.3",
            "pug": "~2.0.0-beta11",
            "serve-favicon": "~2.4.2"
          }
 (DIR) diff --git a/routes/parse.js b/routes/parse.js
       @@ -3,39 +3,16 @@ var router = express.Router();
        
        router.get('/', function (req, res) {
        
       -  var magnetLink = require('magnet-link');
       +  var parseTorrent = require('parse-torrent')
          var appRoot = require('app-root-path');
       -  var Tracker = require('bittorrent-tracker');
       -  var magnet = require('magnet-uri');
          var fs = require('fs');
        
          const torrentFolder = './data/torrents';
          
          fs.readdir(torrentFolder, (err, files) => {
            files.forEach(file => {
       -
       -      magnetLink(appRoot + '/data/torrents/' + file, function (err, link) {
       -
       -              console.log("Magnetlink for " + file + " is " + link)
       -              var parsedTorrent = magnet(link)
       -
       -               var opts = {
       -                  infoHash: parsedTorrent.infoHash,
       -                  announce: parsedTorrent.announce,
       -                  peerId: new Buffer('01234567890123456789'),
       -                  port: 6881
       -                }
       -
       -                var client = new Tracker(opts)
       -                client.scrape()
       -                client.on('scrape', function (err, data) {
       -                  console.log(err,data)
       -                });
       -
       +        console.log(fs.readFileSync(parseTorrent(file)))
              });
       -
       -    });
       -
          });
          res.send('GET request to the parse.')
        });