Updated to use sqlite3 instead of sqlite in api
This commit is contained in:
		| @@ -1,5 +1,7 @@ | |||||||
| import React from 'react'; | import React from 'react'; | ||||||
|  |  | ||||||
|  | import '../app.css'; | ||||||
|  |  | ||||||
| class MovieObject { | class MovieObject { | ||||||
| 	constructor(object) { | 	constructor(object) { | ||||||
| 		this.id = object.id; | 		this.id = object.id; | ||||||
| @@ -12,36 +14,35 @@ class MovieObject { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	requestExisting(movie) { | 	requestExisting(movie) { | ||||||
| 		console.log('Exists', movie) | 		console.log('Exists', movie); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	requestMovie(id) { | 	requestMovie(id) { | ||||||
| 		fetch('http://localhost:31459/api/v1/plex/request/' + id, { | 		fetch('http://localhost:31459/api/v1/plex/request/' + id, { | ||||||
| 		  method: 'POST' | 		  method: 'POST' | ||||||
| 		}) | 		}); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	getElement() { | 	getElement() { | ||||||
| 		var returnList = [] | 		var posterPath = 'https://image.tmdb.org/t/p/w154' + this.poster; | ||||||
|  | 		var buttonState; | ||||||
| 		returnList.push(<p>{this.title} ({this.year})</p>) |  | ||||||
| 		 |  | ||||||
| 		var posterPath, buttonState; |  | ||||||
| 		if (this.poster != undefined) { |  | ||||||
| 			posterPath = 'https://image.tmdb.org/t/p/w150' + this.poster; |  | ||||||
| 		} |  | ||||||
| 		returnList.push(<img src={posterPath}></img>); |  | ||||||
|  |  | ||||||
| 		if (this.matchedInPlex) { | 		if (this.matchedInPlex) { | ||||||
| 			returnList.push(<button onClick={() => this.requestExisting(this)}>Request anyway</button>) | 			buttonState = <button onClick={() => {this.requestExisting(this)}}>Request anyway</button>; | ||||||
| 		} else { | 		} else { | ||||||
| 			returnList.push(<button onClick={() => this.requestMovie(this.id)}>Request</button>) | 			buttonState = <button onClick={() => {this.requestMovie(this.id)}}>Request</button>; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		returnList.push(<span>{this.overview}</span>); | 		return ( | ||||||
|  | 		<div key={this.id} className='movie_wrapper'> | ||||||
| 		returnList.push(<br></br>); | 			<img src={posterPath}></img> | ||||||
| 		return returnList; | 			<div className='movie_content'> | ||||||
|  | 				<span className='movie_header'>{this.title} ({this.year})</span> | ||||||
|  | 				<br></br> | ||||||
|  | 				{buttonState} | ||||||
|  | 				<br></br> | ||||||
|  | 				<span>{this.overview}</span> | ||||||
|  | 			</div> | ||||||
|  | 		</div>) | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -94,9 +94,9 @@ class SearchRequest extends React.Component { | |||||||
|           <br></br> |           <br></br> | ||||||
|  |  | ||||||
|           <br></br> |           <br></br> | ||||||
|           <span id='requestMovieList' ref='requestMovieList'> |           <div id='requestMovieList' ref='requestMovieList'> | ||||||
|             {this.state.responseMovieList}         |             {this.state.responseMovieList}         | ||||||
|           </span> |           </div> | ||||||
|       </div> |       </div> | ||||||
|     ) |     ) | ||||||
|   } |   } | ||||||
|   | |||||||
| @@ -1,11 +0,0 @@ | |||||||
| { |  | ||||||
| 	"database": { |  | ||||||
| 		"host": "shows.db" |  | ||||||
| 	}, |  | ||||||
| 	"webserver": { |  | ||||||
| 		"port": 31459 |  | ||||||
| 	}, |  | ||||||
| 	"tmdb": { |  | ||||||
| 		"apiKey": "9fa154f5355c37a1b9b57ac06e7d6712" |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| @@ -8,13 +8,13 @@ | |||||||
|         "body-parser": "~1.0.1", |         "body-parser": "~1.0.1", | ||||||
|         "cross-env": "^3.1.3", |         "cross-env": "^3.1.3", | ||||||
|         "express": "~4.0.0", |         "express": "~4.0.0", | ||||||
|         "mongoose": "~3.6.13", |         "mongoose": "^3.6.13", | ||||||
|         "moviedb": "^0.2.7", |         "moviedb": "^0.2.7", | ||||||
|         "node-cache": "^4.1.1", |         "node-cache": "^4.1.1", | ||||||
|         "nodemailer": "^4.0.1", |         "nodemailer": "^4.0.1", | ||||||
|         "python-shell": "^0.4.0", |         "python-shell": "^0.4.0", | ||||||
|         "request": "^2.81.0", |         "request": "^2.81.0", | ||||||
|         "request-promise": "^4.2", |         "request-promise": "^4.2", | ||||||
|         "sqlite": "^2.5.0" |         "sqlite3": "^2.5.0" | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,19 +1,19 @@ | |||||||
| const fs = require('fs'); | const fs = require('fs'); | ||||||
| const path = require('path'); | const path = require('path'); | ||||||
| const sqlite = require('sqlite'); | const sqlite3 = require('sqlite3'); | ||||||
|  |  | ||||||
| class SqliteDatabase { | class SqliteDatabase { | ||||||
|  |  | ||||||
| 	constructor(host) { | 	constructor(host) { | ||||||
| 		this.host = host; | 		this.host = host; | ||||||
| 		this.connection = sqlite; | 		this.connection = sqlite3; | ||||||
|  |  | ||||||
| 		// this.schemaDirectory = path.join(__dirname, 'schemas'); | 		// this.schemaDirectory = path.join(__dirname, 'schemas'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	connect() { | 	connect() { | ||||||
| 		return Promise.resolve() | 		return Promise.resolve() | ||||||
| 		.then(() => sqlite.open(this.host)) | 		.then(() => new sqlite3.Database(this.host)) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	all(sql, parameters) { | 	all(sql, parameters) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user