-
{this.title} ({this.year})
-
- {buttonState}
-
-
{this.overview}
+
+
+
+

+
+
+
{this.title} ({this.year})
+
+
{this.overview}
+
+
+
+
+
+
+
+
+
)
+
}
}
diff --git a/client/app/components/SearchRequest.jsx b/client/app/components/SearchRequest.jsx
index 31cec28..32c3be9 100644
--- a/client/app/components/SearchRequest.jsx
+++ b/client/app/components/SearchRequest.jsx
@@ -10,7 +10,9 @@ class SearchRequest extends React.Component {
// Constructor with states holding the search query and the element of reponse.
this.state = {
searchQuery: '',
- responseMovieList: null
+ responseMovieList: null,
+ movieFilter: true,
+ tvshowFilter: false
}
this.URLs = {
@@ -19,6 +21,7 @@ class SearchRequest extends React.Component {
}
}
+
componentDidMount(){
var that = this;
this.setState({responseMovieList: null})
@@ -34,6 +37,9 @@ class SearchRequest extends React.Component {
fetchQuery() {
let url = this.URLs.request + this.state.searchQuery
+ if (this.state.tvshowFilter) {
+ url = url + '&type=tv'
+ }
fetch(url)
// Check if the response is ok
@@ -80,34 +86,187 @@ class SearchRequest extends React.Component {
return movie.getElement();
}
+ toggleFilter(filterType) {
+ if (filterType == 'movies') {
+ this.setState({
+ movieFilter: !this.state.movieFilter
+ })
+ console.log(this.state.movieFilter);
+ }
+ else if (filterType == 'tvshows') {
+ this.setState({
+ tvshowFilter: !this.state.tvshowFilter
+ })
+ console.log(this.state.tvshowFilter);
+ }
+ }
+
render(){
var body = {
- fontFamily: "'Roboto', 'Open Sans', sans-serif",
- display: 'inline-block'
-
+ fontFamily: "'Open Sans', sans-serif",
+ backgroundColor: '#f7f7f7',
+ margin: 0,
+ padding: 0,
+ minHeight: '100%',
+ position: 'relative'
}
- var requestMovieList = {
+
+ var backgroundHeader = {
+ width: '100%',
+ minHeight: '400px',
+ backgroundColor: '#011c23',
+ zIndex: 1,
+ position: 'absolute'
+ }
+
+
+ var requestWrapper = {
+ top: '300px',
+ width: '90%',
+ maxWidth: '1200px',
+ margin: 'auto',
+ paddingTop: '20px',
+ backgroundColor: 'white',
+ position: 'relative',
+ zIndex: '10',
+ boxShadow: '0 2px 10px grey'
+ }
+
+ var pageTitle = {
display: 'flex',
- flexWrap: 'wrap',
+ alignItems: 'center',
justifyContent: 'center'
}
+ var pageTitleSpan = {
+ color: 'white',
+ fontSize: '3em',
+ marginTop: '4vh',
+ marginBottom: '6vh'
+ }
+
+ var box = {
+ width: '90%',
+ height: '50px',
+ maxWidth: '1200px',
+ margin: '0 auto'
+ }
+
+ var container = {
+ verticalAlign: 'middle',
+ whiteSpace: 'nowrap',
+ position: 'relative',
+ display: 'flex',
+ justifyContent: 'center'
+ }
+
+ var searchIcon = {
+ position: 'absolute',
+ marginLeft: '17px',
+ marginTop: '17px',
+ zIndex: '1',
+ color: '#4f5b66'
+ }
+
+ var searchBar = {
+ width: '60%',
+ minWidth: '120px',
+ height: '50px',
+ background: '#ffffff',
+ border: 'none',
+ fontSize: '10pt',
+ float: 'left',
+ color: '#63717f',
+ paddingLeft: '45px',
+ borderRadius: '5px',
+ marginRight: '15px'
+ }
+
+ var searchFilter = {
+ color: 'white',
+ fontSize: '1em',
+ paddingTop: '12px',
+ marginBottom: '12px',
+ marginLeft: '10px',
+ cursor: 'pointer'
+ }
+
+ var hvrUnderlineFromCenter = {
+ color: 'white',
+ fontSize: '1em',
+ paddingTop: '12px',
+ marginBottom: '12px',
+ marginLeft: '10px',
+ cursor: 'pointer',
+ display: 'inline-block',
+ verticalAlign: 'middle',
+ WebkitTransform: 'perspective(1px) translateZ(0)',
+ transform: 'perspective(1px) translateZ(0)',
+ boxShadow: '0 0 1px transparent',
+ position: 'relative',
+ overflow: 'hidden',
+ ':before': {
+ content: "",
+ position: 'absolute',
+ zIndex: '-1',
+ left: '50%',
+ right: '50%',
+ bottom: '0',
+ background: '#00d17c',
+ height: '2px',
+ WebkitTransitionProperty: 'left, right',
+ transitionProperty: 'left, right',
+ WebkitTransitionDuration: '0.3s',
+ transitionDuration: '0.3s',
+ WebkitTransitionTimingFunction: 'ease-out',
+ transitionTimingFunction: 'ease-out'
+ },
+ ':hover:before': {
+ left: 0,
+ right: 0
+ },
+ 'focus:before': {
+ left: 0,
+ right: 0
+ },
+ 'active:before': {
+ left: 0,
+ right: 0
+ }
+ }
+
return(
-
this._handleQueryKeyPress(event)}
- onChange={event => this.updateQueryState(event)}
- value={this.state.searchQuery}
- />
-
-
+
+
+ Request new movies or tv shows
+
-
-
- {this.state.responseMovieList}
+
+
+
+
+ this._handleQueryKeyPress(event)}
+ onChange={event => this.updateQueryState(event)}
+ value={this.state.searchQuery}/>
+
+ {this.toggleFilter('movies')}}
+ id="category_active">Movies
+ {this.toggleFilter('tvshows')}}
+ id="category_inactive">TV Shows
+
+
+
+
+
+ {this.state.responseMovieList}
)
diff --git a/client/app/index.html b/client/app/index.html
index 221152a..91f8c81 100644
--- a/client/app/index.html
+++ b/client/app/index.html
@@ -2,9 +2,11 @@
+
+
seasoned Shows
-
+
diff --git a/client/package.json b/client/package.json
index 2a61ff8..de0ddca 100644
--- a/client/package.json
+++ b/client/package.json
@@ -12,16 +12,16 @@
"css-loader": "^0.28.4",
"html-webpack-plugin": "^2.28.0",
"path": "^0.12.7",
- "react": "^15.5.4",
+ "react": "^15.6.1",
"react-dom": "^15.5.4",
"webfontloader": "^1.6.28",
- "webpack": "^3.3.0",
+ "webpack": "^3.5.5",
"webpack-dev-server": "^2.4.5"
},
"devDependencies": {
- "babel-core": "^6.24.1",
- "babel-loader": "^7.0.0",
- "babel-preset-env": "^1.5.1",
+ "babel-core": "^6.26.0",
+ "babel-loader": "^7.1.2",
+ "babel-preset-env": "^1.6.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1"
}
diff --git a/client/webpack.config.js b/client/webpack.config.js
index 9d667c2..e6c383e 100644
--- a/client/webpack.config.js
+++ b/client/webpack.config.js
@@ -2,7 +2,7 @@
* @Author: KevinMidboe
* @Date: 2017-06-01 19:09:16
* @Last Modified by: KevinMidboe
-* @Last Modified time: 2017-06-02 19:38:45
+* @Last Modified time: 2017-09-02 15:51:52
*/
const path = require('path');
@@ -27,14 +27,6 @@ module.exports = {
loaders: [
{ test: /\.js$/, loader: 'babel-loader', exclude: /node_modules/ },
{ test: /\.jsx$/, loader: 'babel-loader', exclude: /node_modules/ },
- { test: /\.scss$/, loader: 'css-loader', exclude: /node_modules/ },
- { test: /\.css$/, loader: 'style-loader!css!scss', exclude: /node_modules/ }
- // { test: /\.css$/, loader: 'style-loader!css-loader!', exclude: /node_modules/ },
- // query: {
- // presets: ['es2015']
- // }
-
- // { test: /\.css-loader$/, loader: 'style-loader!css-loader', exclude: /node_modules/ }
]
},
plugins: [HtmlWebpackPluginConfig]
diff --git a/seasoned_api/src/plex/requestRepository.js b/seasoned_api/src/plex/requestRepository.js
deleted file mode 100644
index a15a8d5..0000000
--- a/seasoned_api/src/plex/requestRepository.js
+++ /dev/null
@@ -1,123 +0,0 @@
-const assert = require('assert');
-const PlexRepository = require('src/plex/plexRepository');
-const plexRepository = new PlexRepository();
-const convertPlexToMovie = require('src/plex/convertPlexToMovie');
-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 MailTemplate = require('src/plex/mailTemplate')
-
-var pythonShell = require('python-shell');
-const nodemailer = require('nodemailer');
-
-
-class RequestRepository {
-
- searchRequest(query, page, type) {
- return Promise.resolve()
- .then(() => tmdb.search(query, page, type))
- .then((tmdbMovies) => {
- return Promise.resolve()
- .then(() => plexRepository.searchMedia(query))
- .then((plexMedia) => {
- return Promise.each(tmdbMovies, function(tmdbMovie) {
- return Promise.each(plexMedia, function(plexMovie) {
- if (tmdbMovie.title == plexMovie.title && tmdbMovie.year == plexMovie.year) {
- tmdbMovie.matchedInPlex = true;
- console.log(tmdbMovie.title + ' : ' + tmdbMovie.year);
- }
- return tmdbMovie;
- })
- })
- })
- })
- .catch((error) => {
- return error;
- });
- }
-
- lookup(identifier, type = 'movie') {
- if (type === 'movie') { type = 'movieInfo'}
- else if (type === 'tv') { type = 'tvInfo'}
- return Promise.resolve()
- .then(() => tmdb.lookup(identifier, type))
- .then((tmdbMovie) => {
- return Promise.resolve(plexRepository.searchMedia(tmdbMovie.title))
- .then((plexMovies) => {
- for (var i = 0; i < plexMovies.length; i++) {
- if (tmdbMovie.title === plexMovies[i].title && tmdbMovie.year === plexMovies[i].year) {
- tmdbMovie.matchedInPlex = true;
- return tmdbMovie;
- }
- }
- })
- .catch((error) => {
- return error;
- });
- return tmdbMovie;
- });
- }
-
- sendRequest(identifier) {
- // TODO try a cache hit on the movie item
-
- tmdb.lookup(identifier).then(movie => {
- console.log(movie.title)
-
-
- // create reusable transporter object using the default SMTP transport
- let transporter = nodemailer.createTransport({
- host: configuration.get('mail', 'host'),
- port: 26,
- ignoreTLS: true,
- tls :{rejectUnauthorized: false},
- secure: false, // secure:true for port 465, secure:false for port 587
- auth: {
- user: configuration.get('mail', 'user'),
- pass: configuration.get('mail', 'password')
- }
- });
-
- const mailTemplate = new MailTemplate(movie)
-
- // setup email data with unicode symbols
- let mailOptions = {
- // TODO get the mail adr from global location (easy to add)
- from: 'MovieRequester
', // sender address
- to: 'kevin.midboe@gmail.com', // list of receivers
- subject: 'Download request', // Subject line
- text: mailTemplate.toText(),
- html: mailTemplate.toHTML()
- };
-
- // send mail with defined transport object
- transporter.sendMail(mailOptions, (error, info) => {
- if (error) {
- return console.log(error);
- }
- console.log('Message %s sent: %s', info.messageId, info.response);
- });
-
- // var options = {
- // args: [movie.title, movie.year, movie.poster]
- // }
-
- // pythonShell.run('sendRequest.py', options, function (err, results) {
- // if (err) throw err;
- // // TODO Add error handling!! RequestRepository.ERROR
- // // results is an array consisting of messages collected during execution
-
- // console.log('results: %j', results)
- // })
- })
-
- return Promise.resolve();
-
- }
-
-}
-
-module.exports = RequestRepository;
\ No newline at end of file