WIP - seedlinux - Torrent indexing tool opensource torrents with share ratio's etc.
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
(DIR) commit 231870fba89f2a4082e2433ca3cb6cbd610db745
(DIR) parent 03b00f371837d317e702ec2a6817ce687f4f5840
(HTM) Author: Jay Scott <jay@jayscott.co.uk>
Date: Thu, 29 Jun 2017 00:13:54 +0100
WIP
Diffstat:
M app.js | 5 +----
M routes/index.js | 2 +-
M routes/parse.js | 21 +++++++++++++++++++--
3 files changed, 21 insertions(+), 7 deletions(-)
---
(DIR) diff --git a/app.js b/app.js
@@ -30,20 +30,17 @@ app.use(function(req,res,next){
app.use('/', index);
app.use('/parse/', parse);
-// catch 404 and forward to error handler
app.use(function(req, res, next) {
var err = new Error('Not Found');
err.status = 404;
next(err);
});
-// error handler
+
app.use(function(err, req, res, next) {
- // set locals, only providing error in development
res.locals.message = err.message;
res.locals.error = req.app.get('env') === 'development' ? err : {};
- // render the error page
res.status(err.status || 500);
res.render('error');
});
(DIR) diff --git a/routes/index.js b/routes/index.js
@@ -5,7 +5,7 @@ const express = require('express');
const router = express.Router();
/* GET home page. */
-router.get('/', (req, res, next) => {
+router.get('/', (req, res) => {
const collection = req.db.get(config.collection);
collection.find({}, {}, (e, docs) => {
(DIR) diff --git a/routes/parse.js b/routes/parse.js
@@ -14,12 +14,12 @@ const router = express.Router();
- Move to commandline tool instead of web route.
- get seeders / leechers on first pass.
*/
-router.get('/', (req, res, next) => {
+router.get('/', (req, res) => {
const collection = req.db.get(config.collection);
const torrentFolder = config.torrent_data;
- fs.readdir(torrentFolder, (err, files, next) => {
+ fs.readdir(torrentFolder, (err, files) => {
files.forEach(file => {
let tFile = fs.readFileSync(torrentFolder + '/' + file);
let tData = parseTorrent(tFile);
@@ -52,4 +52,21 @@ router.get('/', (req, res, next) => {
});
+
+function getFiles() {
+
+}
+
+function getMetadata() {
+
+}
+
+function getMagnetLink() {
+
+}
+
+function updateDB() {
+
+}
+
module.exports = router;