clean up
werrpy werrpy@gmail.com
Thu, 05 Mar 2020 19:46:49 -0500
1 files changed,
8 insertions(+),
16 deletions(-)
jump to
M
read.js
→
read.js
@@ -60,26 +60,25 @@ const path = require('path');
const fs = require('fs'); const yaml = require('js-yaml'); -//joining path of directory +// joining path of directory const directoryPath = path.join(__dirname, 'Jackett/src/Jackett.Common/Definitions'); -//passsing directoryPath and callback function +// passsing directoryPath and callback function let trackers = {}; trackers.trackers = [] fs.readdir(directoryPath, function (err, files) { - //handling error + // handling error if (err) { return console.log('Unable to scan directory: ' + err); } - //listing all files using forEach + // listing all files using forEach files.forEach(function (file) { // Do whatever you want to do with the file - //console.log(file); try { let fileContents = fs.readFileSync(path.join(directoryPath, file), 'utf8'); let data = yaml.safeLoad(fileContents, {skipInvalid: true}); - //console.log(data); + if (data.type == 'private') { let tracker = { name: '',@@ -89,7 +88,7 @@ }
tracker.name = data.name tracker.description = data.description let type = [] - //console.log(data); + if (data.caps && data.caps.categorymappings) { data.caps.categorymappings.forEach(function(category) { type.push(category.cat.split("/")[0])@@ -119,14 +118,13 @@
const indexersPath = path.join(__dirname, 'Jackett/src/Jackett.Common/Indexers'); fs.readdir(indexersPath, function (err, files) { - //handling error + // handling error if (err) { return console.log('Unable to scan directory: ' + err); } - //listing all files using forEach + // listing all files using forEach files.forEach(function (file) { // Do whatever you want to do with the file - //console.log(file); try { const fileContents = fs.readFileSync(path.join(indexersPath, file), 'utf8');@@ -166,7 +164,6 @@ for (const line of fileLines) {
if (line.includes("AddCategoryMapping")) { const category = line.match(/TorznabCatType\.([^,]+),/i) if (category) { - //console.log(category[1]) type.push(category[1]) } }@@ -183,11 +180,6 @@ }
}); trackers.trackers = trackers.trackers.filter((t) => !jackettIgnoreList.includes(t.name)) - - //console.log(trackers_found) - /*for (const t of trackers_found) { - console.log(t) - }*/ let data = JSON.stringify(trackers); fs.writeFileSync('trackers2.json', data);