diff --git a/index.html b/index.html index d89c2fe..d73f0ca 100644 --- a/index.html +++ b/index.html @@ -109,6 +109,20 @@
+ diff --git a/server.js b/server.js index 31c9fc5..765ce55 100644 --- a/server.js +++ b/server.js @@ -5,19 +5,17 @@ var history = require('connect-history-api-fallback'); app = express(); app.use('/dist', express.static(path.join(__dirname + "/dist"))); +app.use('/dist', express.static(path.join(__dirname + "/dist/"))); app.use('/favicons', express.static(path.join(__dirname + "/favicons"))); app.use(history({ index: '/' })); -var port = process.env.PORT || 5000; app.get('/', function(req, res) { res.sendFile(path.join(__dirname + '/index.html')); }); - app.listen(port); -console.log('server started '+ port); \ No newline at end of file diff --git a/src/App.vue b/src/App.vue index efa6c83..cbb9ecf 100644 --- a/src/App.vue +++ b/src/App.vue @@ -3,7 +3,7 @@
+
@@ -76,20 +79,18 @@
-->
-

- Release Date -

-
- {{ movie.year }} -
+

Release Date

+
{{ movie.year }}
+ + +
-

- Seasons -

-
- 10 -
+

Seasons

+
{{ movie.seasons }}
@@ -130,7 +131,9 @@ export default { favoriteChecked: false, requested: false, admin: localStorage.getItem('admin'), - showTorrents: false + showTorrents: false, + rating_int: 0, + rating_dec: 0 } }, computed: { @@ -161,7 +164,7 @@ export default { } // Push state if(storage.createMoviePopup){ - storage.moviePath = '/request/' + this.mediaType + '/' + id; + storage.moviePath = this.mediaType + '/' + id; history.pushState({ popup: true }, null, storage.moviePath); storage.createMoviePopup = false; } @@ -219,6 +222,13 @@ export default { axios.post(`https://api.kevinmidboe.com/api/v1/plex/request/${this.id}?type=${this.mediaType}`, { headers: {authorization: storage.token} }, ) + axios({ + method: 'post', //you can set what request you want to be + url: `https://api.kevinmidboe.com/api/v1/plex/request/${this.id}?type=${this.mediaType}`, + headers: { + authorization: storage.token + } + }) // axios.post(`https://api.kevinmidboe.com/api/v1/plex/request/${this.id}?api_key=${storage.apiKey}&session_id=${storage.sessionId}`, { .then(function(resp){ if (resp.data.success) diff --git a/src/components/MoviesList.vue b/src/components/MoviesList.vue index fc627a4..4c1063e 100644 --- a/src/components/MoviesList.vue +++ b/src/components/MoviesList.vue @@ -40,20 +40,30 @@ let removed; export default { props: ['type', 'mode', 'category', 'shortList'], components: { MoviesListItem }, - beforeRouteLeave (to, from, next) { - if(from.name == 'search'){ - eventHub.$emit('setSearchQuery', true); - } - next(); - }, + // beforeRouteLeave (to, from, next) { + // if(from.name == 'search'){ + // eventHub.$emit('setSearchQuery', true); + // } + // next(); + // }, data() { return { listTitle: '', movies: [], + unfiltered_movies: [], pages: '', + filter: '', + filter_query: '', results: '', currentPage: 1, - listLoaded: false + listLoaded: false, + showFilter: false, + filters: { + status: { + elms: ['all', 'requested', 'downloading', 'downloaded'], + selected: 0, + } + } } }, computed: { @@ -68,7 +78,7 @@ export default { if(this.mode == 'search'){ return `https://api.kevinmidboe.com/api/v1/plex/request?query=${this.query}&page=${this.currentPage}`; } else if(this.mode == 'requests' || this.$route.params.category == 'requests') { - return `https://api.kevinmidboe.com/api/v1/plex/requests/all?page=${this.currentPage}&status=requested`; + return `https://api.kevinmidboe.com/api/v1/plex/requests/all?page=${this.currentPage}&status=${this.filter}`; } else if(this.mode == 'collection') { let category = this.$route.params.category || this.category; return `https://api.kevinmidboe.com/api/v1/tmdb/list/${category}?page=${this.currentPage}`; @@ -104,6 +114,7 @@ export default { this.pages = data.total_pages; this.results = data.total_results; } + this.unfiltered_movies = this.movies; this.listLoaded = true; // Change Page title if(this.type == 'page'){ @@ -123,32 +134,51 @@ export default { this.movies = newData; }.bind(this)); }, - updateFavorite(){ - if(this.mode == 'favorite'){ - let promises = [], movies = [], pages, results; - for(let i = 1; i <= this.currentPage; i++){ - promises.push(axios.get(`https://api.themoviedb.org/3/account/${storage.userId}/favorite/movies?api_key=${storage.apiKey}&session_id=${storage.sessionId}&language=en-US&sort_by=created_at.desc&page=${i}`)) - } - axios.all(promises).then(function(results) { - results.forEach(function(resp) { - let data = resp.data; - movies = movies.concat(data.results); - pages = data.total_pages; - results = data.total_results; - }); - this.movies = movies; - this.pages = pages; - if(this.currentPage > pages){ - this.currentPage -= 1; - } - this.results = results; - }.bind(this)); - } + sortt() { + console.log(this.showFilters) + }, + toggleFilter(item, index){ + this.showFilter = this.showFilter ? false : true; + // this.results = this.results.filter(result => result.status != 'downloaded') + }, + applyFilter(item, index) { + this.filter = item; + this.filters.status.selected = index; + console.log('applied query filter: ', item, index) + this.fetchCategory() } + // updateFavorite(){ + // if(this.mode == 'favorite'){ + // let promises = [], movies = [], pages, results; + // for(let i = 1; i <= this.currentPage; i++){ + // promises.push(axios.get(`https://api.themoviedb.org/3/account/${storage.userId}/favorite/movies?api_key=${storage.apiKey}&session_id=${storage.sessionId}&language=en-US&sort_by=created_at.desc&page=${i}`)) + // } + // axios.all(promises).then(function(results) { + // results.forEach(function(resp) { + // let data = resp.data; + // movies = movies.concat(data.results); + // pages = data.total_pages; + // results = data.total_results; + // }); + // this.movies = movies; + // this.pages = pages; + // if(this.currentPage > pages){ + // this.currentPage -= 1; + // } + // this.results = results; + // }.bind(this)); + // } + // } }, watch: { - query(value){ - this.fetchCategory(value); + filter_query: function(val, oldVal) { + let movies = this.unfiltered_movies; + val = val.toLowerCase() + if (val.length > 0) + movies = movies.filter(movie => movie.title.toLowerCase().startsWith(val)) + + if (movies.length > 0) + this.movies = movies; } }, created(){ @@ -171,7 +201,21 @@ export default { } } +