<commit_before>const assert = require('assert');
const PlexRepository = require('src/plex/plexRepository');
const plexRepository = new PlexRepository();
const configuration = require('src/config/configuration').getInstance();
const TMDB = require('src/tmdb/tmdb');
const tmdb = new TMDB(configuration.get('tmdb', 'apiKey'));
var Promise = require('bluebird');
var rp = require('request-promise');

const establishedDatabase = require('src/database/database');

const MailTemplate = require('src/plex/mailTemplate')

var pythonShell = require('python-shell');
const nodemailer = require('nodemailer');


class RequestRepository {

	constructor(database) {
		this.database = database || establishedDatabase;
		this.queries = {
			'insertRequest': "INSERT INTO requests VALUES (?, ?, ?, ?, ?, ?, CURRENT_DATE, 'requested', ?)",
			'fetchRequstedItems': "SELECT * FROM requests",
			'updateRequested': "UPDATE stray_eps SET status = '?' WHERE id is '?'",
		}
	}

	searchRequest(query, page, type) {
		// TODO get from cache
		// STRIP METADATA THAT IS NOT ALLOWED

		// Do a search in the tmdb api and return the results of the object
		let getTmdbResults = function() {
			return tmdb.search(query, page, type)
				.then((tmdbSearch) => {
					return tmdbSearch.results;
				})
		}

		// Take inputs and verify them with a list. Now we are for every item in tmdb result<commit_msg>Changed database table name.<commit_after>const assert = require('assert');
const PlexRepository = require('src/plex/plexRepository');
const plexRepository = new PlexRepository();
const configuration = require('src/config/configuration').getInstance();
const TMDB = require('src/tmdb/tmdb');
const tmdb = new TMDB(configuration.get('tmdb', 'apiKey'));
var Promise = require('bluebird');
var rp = require('request-promise');

const establishedDatabase = require('src/database/database');

const MailTemplate = require('src/plex/mailTemplate')

var pythonShell = require('python-shell');
const nodemailer = require('nodemailer');


class RequestRepository {

	constructor(database) {
		this.database = database || establishedDatabase;
		this.queries = {
			'insertRequest': "INSERT INTO requests VALUES (?, ?, ?, ?, ?, ?, CURRENT_DATE, 'requested', ?)",
			'fetchRequstedItems': "SELECT * FROM requests",
			'updateRequested': "UPDATE requests SET status = '?' WHERE id is '?'",
		}
	}

	searchRequest(query, page, type) {
		// TODO get from cache
		// STRIP METADATA THAT IS NOT ALLOWED

		// Do a search in the tmdb api and return the results of the object
		let getTmdbResults = function() {
			return tmdb.search(query, page, type)
				.then((tmdbSearch) => {
					return tmdbSearch.results;
				})
		}

		// Take inputs and verify them with a list. Now we are for every item in tmdb result
{'fraction_non_alphanumeric': 0.13537906137184116, 'fraction_numerical': 0.0, 'mean_word_length': 4.643584521384929, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '921833', 'n_tokens_mistral': 893, 'n_tokens_neox': 811, 'n_words': 240}