Linted all pirate, git, tmdb and searchHistory scripts.
This commit is contained in:
@@ -1,54 +1,53 @@
|
||||
const assert = require('assert');
|
||||
var PythonShell = require('python-shell');
|
||||
var async = require('async');
|
||||
const PythonShell = require('python-shell');
|
||||
|
||||
async function find(searchterm, callback) {
|
||||
const options = {
|
||||
pythonPath: '/usr/bin/python3',
|
||||
// pythonPath: '/Library/Frameworks/Python.framework/Versions/3.6/bin/python3',
|
||||
args: [searchterm, '-s', 'piratebay', '--print'],
|
||||
};
|
||||
|
||||
var options = {
|
||||
pythonPath: '/usr/bin/python3',
|
||||
// pythonPath: '/Library/Frameworks/Python.framework/Versions/3.6/bin/python3',
|
||||
args: [searchterm, '-s', 'piratebay', '--print']
|
||||
}
|
||||
|
||||
PythonShell.run('../app/torrent_search/torrentSearch/search.py', options, callback);
|
||||
// PythonShell does not support return
|
||||
};
|
||||
PythonShell.run('../app/torrent_search/torrentSearch/search.py', options, callback);
|
||||
// PythonShell does not support return
|
||||
}
|
||||
|
||||
|
||||
async function callPythonAddMagnet(magnet, callback) {
|
||||
var options = {
|
||||
pythonPath: '/usr/bin/python',
|
||||
// pythonPath: '/Library/Frameworks/Python.framework/Versions/3.6/bin/python3',
|
||||
args: [magnet]
|
||||
}
|
||||
const options = {
|
||||
pythonPath: '/usr/bin/python',
|
||||
// pythonPath: '/Library/Frameworks/Python.framework/Versions/3.6/bin/python3',
|
||||
args: [magnet],
|
||||
};
|
||||
|
||||
PythonShell.run('../app/magnet.py', options, callback);
|
||||
PythonShell.run('../app/magnet.py', options, callback);
|
||||
}
|
||||
|
||||
async function SearchPiratebay(query) {
|
||||
return await new Promise((resolve, reject) => {
|
||||
return find(query, function(err, results) {
|
||||
if (err) {
|
||||
console.log('THERE WAS A FUCKING ERROR!')
|
||||
reject(Error('There was a error when searching for torrents'))
|
||||
}
|
||||
if (results) {
|
||||
console.log('result', results);
|
||||
resolve(JSON.parse(results, null, '\t'));
|
||||
}
|
||||
})
|
||||
})
|
||||
return await new Promise((resolve, reject) => find(query, (err, results) => {
|
||||
if (err) {
|
||||
/* eslint-disable no-console */
|
||||
console.log('THERE WAS A FUCKING ERROR!');
|
||||
reject(Error('There was a error when searching for torrents'));
|
||||
}
|
||||
if (results) {
|
||||
/* eslint-disable no-console */
|
||||
console.log('result', results);
|
||||
resolve(JSON.parse(results, null, '\t'));
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
async function AddMagnet(magnet) {
|
||||
return await new Promise((resolve) => {
|
||||
return callPythonAddMagnet(magnet, function(err, results) {
|
||||
if (err) {
|
||||
console.log(err)
|
||||
}
|
||||
resolve({ success: true })
|
||||
})
|
||||
})
|
||||
return await new Promise(resolve => callPythonAddMagnet(magnet, (err, results) => {
|
||||
if (err) {
|
||||
/* eslint-disable no-console */
|
||||
console.log(err);
|
||||
}
|
||||
/* eslint-disable no-console */
|
||||
console.log(results);
|
||||
resolve({ success: true });
|
||||
}));
|
||||
}
|
||||
|
||||
module.exports = { SearchPiratebay, AddMagnet }
|
||||
module.exports = { SearchPiratebay, AddMagnet };
|
||||
|
||||
Reference in New Issue
Block a user