From 231b70c226f5b69378cbfd04003c26eab9ae87b9 Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Mon, 4 Sep 2017 13:43:31 +0200 Subject: [PATCH 01/12] Added what the different parts of seasoned does, that is external, api and services. --- README.md | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6af9825..dd6b359 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# *Seasoned*: an intelligent organizer for your shows +# 🌶 seasonedShows : Your customly seasoned movie and show requester, downloader and organizer -*Seasoned* is a intelligent organizer for your tv show episodes. It is made to automate and simplify to process of renaming and moving newly downloaded tv show episodes following Plex file naming and placement. +*seasonedShows* is a intelligent organizer for your tv show episodes. It is made to automate and simplify to process of renaming and moving newly downloaded tv show episodes following Plex file naming and placement. ## Architecture The flow of the system will first check for new folders in your tv shows directory, if a new file is found it's contents are analyzed, stored and tweets suggested changes to it's contents to use_admin. @@ -8,3 +8,21 @@ The flow of the system will first check for new folders in your tv shows directo Then there is a script for looking for replies on twitter by user_admin, if caanges are needed, it handles the changes specified and updates dtabbase. After approval by user the files are modified and moved to folders in resptected area. If error occours, pasteee link if log is sent to user. + +#### External + + Seasoned: request, discover and manage. + + Stray: Overview of downloaded episodes before they are organized. + + (+) Admin Panel: Overview of all stray episodes/movies. + +#### Api + + All communication between public website to server. + + Plex: All querying to what is localy available in your plex library. + + Stray (seasoned) -> also calls services (moveStray) through api. + + Tmdb: Requesting information from tmdb. + + (+) Admin Panel: Use secure login and session tokens to handle logged in viewer. + +#### Services + + Parse directories for new content. + + Extract and save in db information about stray item. + + Move a confirmed stray item. + + (+) Search for torrents matching new content. \ No newline at end of file -- 2.34.1 From fcf6b324c9a16dcfe36c8ce1bfdc6266c4f6b864 Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Mon, 4 Sep 2017 13:44:34 +0200 Subject: [PATCH 02/12] Moved the pitch sentence down under the header --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dd6b359..e07e08a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ -# 🌶 seasonedShows : Your customly seasoned movie and show requester, downloader and organizer +# 🌶 seasonedShows -*seasonedShows* is a intelligent organizer for your tv show episodes. It is made to automate and simplify to process of renaming and moving newly downloaded tv show episodes following Plex file naming and placement. +Your customly seasoned movie and show requester, downloader and organizer + +## About +seasonedShows is a intelligent organizer for your tv show episodes. It is made to automate and simplify to process of renaming and moving newly downloaded tv show episodes following Plex file naming and placement. ## Architecture The flow of the system will first check for new folders in your tv shows directory, if a new file is found it's contents are analyzed, stored and tweets suggested changes to it's contents to use_admin. -- 2.34.1 From e9c0e5bfa6d8678e5466677de5685c7d501ffb64 Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Mon, 4 Sep 2017 13:45:18 +0200 Subject: [PATCH 03/12] Removed extra space under header --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index e07e08a..8b34d0b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ # 🌶 seasonedShows - Your customly seasoned movie and show requester, downloader and organizer ## About -- 2.34.1 From cd52d295b060b22a40342fe6c46fe8c3f90d0ff1 Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Thu, 7 Sep 2017 23:47:11 +0200 Subject: [PATCH 04/12] Now both Media and Media.Part in the JSON object about a stream is a list and need to index the first element of the stream to get this info. --- seasoned_api/src/plex/convertPlexToStream.js | 8 +++++--- seasoned_api/src/plex/convertStreamToMediaInfo.js | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/seasoned_api/src/plex/convertPlexToStream.js b/seasoned_api/src/plex/convertPlexToStream.js index 46ddfcd..1e82173 100644 --- a/seasoned_api/src/plex/convertPlexToStream.js +++ b/seasoned_api/src/plex/convertPlexToStream.js @@ -5,11 +5,13 @@ const convertStreamToUser = require('src/plex/stream/convertStreamToUser'); const ConvertStreamToPlayback = require('src/plex/stream/convertStreamToPlayback'); function convertPlexToStream(plexStream) { - const stream = convertPlexToSeasoned(plexStream); - stream.mediaInfo = convertStreamToMediaInfo(plexStream.Media); + const stream = convertPlexToSeasoned(plexStream) + const plexStreamMedia = plexStream.Media[0] + stream.mediaInfo = convertStreamToMediaInfo(plexStreamMedia); stream.player = convertStreamToPlayer(plexStream.Player); + stream.user = convertStreamToUser(plexStream.User); - stream.playback = new ConvertStreamToPlayback(plexStream.Media.Part); + stream.playback = new ConvertStreamToPlayback(plexStreamMedia.Part[0]); return stream; } diff --git a/seasoned_api/src/plex/convertStreamToMediaInfo.js b/seasoned_api/src/plex/convertStreamToMediaInfo.js index cd55477..3844fa9 100644 --- a/seasoned_api/src/plex/convertStreamToMediaInfo.js +++ b/seasoned_api/src/plex/convertStreamToMediaInfo.js @@ -15,6 +15,8 @@ function convertStreamToMediaInfo(plexStream) { mediaInfo.container = plexStream.container; mediaInfo.audioCodec = plexStream.audioCodec; + console.log(mediaInfo) + return mediaInfo; } -- 2.34.1 From a8c6850863a00cd83218495524f098f8648b4819 Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Thu, 7 Sep 2017 23:48:06 +0200 Subject: [PATCH 05/12] For some reason this was player info, but it is now been replaced with all the variables specific for mediaInfo --- seasoned_api/src/media_classes/mediaInfo.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/seasoned_api/src/media_classes/mediaInfo.js b/seasoned_api/src/media_classes/mediaInfo.js index c3cb52f..3019f25 100644 --- a/seasoned_api/src/media_classes/mediaInfo.js +++ b/seasoned_api/src/media_classes/mediaInfo.js @@ -1,12 +1,14 @@ class MediaInfo { - constructor(device, platform) { - this.device = undefined; - this.platform = undefined; - this.ip = undefined; - this.product = undefined; - this.title = undefined; - this.state = undefined; - + constructor() { + this.duration = undefined; + this.height = undefined; + this.width = undefined; + this.bitrate = undefined; + this.resolution = undefined; + this.framerate = undefined; + this.protocol = undefined; + this.container = undefined; + this.audioCodec = undefined; } } -- 2.34.1 From 3eb2bbe54e4c20f68128858657c06a5154c1579a Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Thu, 7 Sep 2017 23:49:21 +0200 Subject: [PATCH 06/12] Removed a console log --- seasoned_api/src/plex/convertStreamToMediaInfo.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/seasoned_api/src/plex/convertStreamToMediaInfo.js b/seasoned_api/src/plex/convertStreamToMediaInfo.js index 3844fa9..60d6c1d 100644 --- a/seasoned_api/src/plex/convertStreamToMediaInfo.js +++ b/seasoned_api/src/plex/convertStreamToMediaInfo.js @@ -6,6 +6,7 @@ function convertStreamToMediaInfo(plexStream) { mediaInfo.duration = plexStream.duration; mediaInfo.height = plexStream.height; mediaInfo.width = plexStream.width; + if (plexStream.bitrate) { mediaInfo.bitrate = plexStream.bitrate; } @@ -15,8 +16,6 @@ function convertStreamToMediaInfo(plexStream) { mediaInfo.container = plexStream.container; mediaInfo.audioCodec = plexStream.audioCodec; - console.log(mediaInfo) - return mediaInfo; } -- 2.34.1 From 0370f051bcaddd2e257005fa5de4652d2f8ef69f Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Thu, 7 Sep 2017 23:51:22 +0200 Subject: [PATCH 07/12] Changed the error message returned if something goes wrong when fetching playing --- seasoned_api/src/plex/plexRepository.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seasoned_api/src/plex/plexRepository.js b/seasoned_api/src/plex/plexRepository.js index 0de89c6..25645a8 100644 --- a/seasoned_api/src/plex/plexRepository.js +++ b/seasoned_api/src/plex/plexRepository.js @@ -51,7 +51,7 @@ class PlexRepository { } }) .catch((err) => { - throw new Error(err); + throw new Error('Error handling plex playing. Error: ' + err); }) } } -- 2.34.1 From eb2de340a3bc833b403c263f0c1bd98c4c1969d8 Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Thu, 7 Sep 2017 23:52:05 +0200 Subject: [PATCH 08/12] Added variables for audioProfile, videoProfile, duration and container for a playback. --- seasoned_api/src/plex/stream/convertStreamToPlayback.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/seasoned_api/src/plex/stream/convertStreamToPlayback.js b/seasoned_api/src/plex/stream/convertStreamToPlayback.js index 555a07e..f4fae2d 100644 --- a/seasoned_api/src/plex/stream/convertStreamToPlayback.js +++ b/seasoned_api/src/plex/stream/convertStreamToPlayback.js @@ -4,6 +4,11 @@ class convertStreamToPlayback { this.width = plexStream.width; this.height = plexStream.height; this.decision = plexStream.decision; + this.audioProfile = plexStream.audioProfile; + this.videoProfile = plexStream.videoProfile; + this.duration = plexStream.duration; + this.container = plexStream.container; + } } -- 2.34.1 From d26f4b053175b4dd7033df70cc47593775f7c3cf Mon Sep 17 00:00:00 2001 From: Kevin Date: Fri, 8 Sep 2017 20:21:56 +0200 Subject: [PATCH 09/12] Set theme jekyll-theme-cayman --- _config.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 _config.yml diff --git a/_config.yml b/_config.yml new file mode 100644 index 0000000..c419263 --- /dev/null +++ b/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-cayman \ No newline at end of file -- 2.34.1 From 4fa32440afea39a50f32ee5dc53948db44c107dd Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Tue, 12 Sep 2017 14:39:32 +0200 Subject: [PATCH 12/12] Now we can fetch lists for discover, popular, now playing and upcoming with optional tv_show and movie filter options. --- client/app/components/SearchRequest.jsx | 122 +++++++++++++++--------- 1 file changed, 79 insertions(+), 43 deletions(-) diff --git a/client/app/components/SearchRequest.jsx b/client/app/components/SearchRequest.jsx index e32d4da..5ee5d20 100644 --- a/client/app/components/SearchRequest.jsx +++ b/client/app/components/SearchRequest.jsx @@ -5,6 +5,8 @@ import MovieObject from './MovieObject.jsx'; // StyleComponents import searchStyle from './styles/searchRequestStyle.jsx'; +import URI from 'urijs'; + // TODO add option for searching multi, movies or tv shows class SearchRequest extends React.Component { constructor(props){ @@ -14,10 +16,18 @@ class SearchRequest extends React.Component { searchQuery: '', responseMovieList: null, movieFilter: true, - tvshowFilter: false, + showFilter: false, + discoverType: '', page: 1 } + this.allowedDiscoverTypes = [ + 'discover', 'popular', 'nowplaying', 'upcoming' + ] + + // this.baseUrl = 'https://apollo.kevinmidboe.com/api/v1/'; + this.baseUrl = 'http://localhost:31459/api/v1/tmdb/'; + this.URLs = { // request: 'https://apollo.kevinmidboe.com/api/v1/plex/request?page='+this.state.page+'&query=', request: 'http://localhost:31459/api/v1/plex/request?page='+this.state.page+'&query=', @@ -32,7 +42,7 @@ class SearchRequest extends React.Component { componentDidMount(){ var that = this; // this.setState({responseMovieList: null}) - this.getUpcoming(); + this.fetchDiscover('upcoming'); } // Handles all errors of the response of a fetch call @@ -43,56 +53,77 @@ class SearchRequest extends React.Component { return response; } - getUpcoming() { - let url = this.URLs.upcoming + '?page=' + this.state.page; - fetch(url) - .then(response => this.handleErrors(response)) - .then(response => response.json()) - .then(data => { - console.log(data.total_pages) - if (data.results.length > 0) { - this.setState({ - responseMovieList: data.results.map(item => this.createMovieObjects(item)) - }) - } - }) - .catch(error => { - console.log(error); + fetchDiscover(queryDiscoverType) { + if (this.allowedDiscoverTypes.indexOf(queryDiscoverType) === -1) + throw Error('Invalid discover type: ' + queryDiscoverType); + + var uri = new URI(this.baseUrl); + uri.segment(queryDiscoverType) + uri = uri.setSearch('page', this.state.page); + if (this.state.showFilter) + uri = uri.addSearch('type', 'show'); + + console.log(uri) + + this.setState({ + responseMovieList: 'Loading...' + }); + + fetch(uri) + // Check if the response is ok + .then(response => this.handleErrors(response)) + .then(response => response.json()) // Convert to json object and pass to next then + .then(data => { // Parse the data of the JSON response + // If it is something here it updates the state variable with the HTML list of all + // movie objects that where returned by the search request + if (data.results.length > 0) { this.setState({ - reposemovieList:

Not found (upcoming)

+ responseMovieList: data.results.map(item => this.createMovieObjects(item)) }) + } + }) + // If the -------- + .catch(error => { + console.log(error) + this.setState({ + responseMovieList:

Not Found

}) + + console.log('Error submit: ', error.toString()); + }); } + fetchQuery() { let url = this.URLs.request + this.state.searchQuery - if (this.state.tvshowFilter) { + if (this.state.showFilter) { url = url + '&type=tv' } - fetch(url) - // Check if the response is ok - .then(response => this.handleErrors(response)) - .then(response => response.json()) // Convert to json object and pass to next then - .then(data => { // Parse the data of the JSON response - // If it is something here it updates the state variable with the HTML list of all - // movie objects that where returned by the search request - if (data.length > 0) { - this.setState({ - responseMovieList: data.map(item => this.createMovieObjects(item)) - }) - } + fetch(url) + // Check if the response is ok + .then(response => this.handleErrors(response)) + .then(response => response.json()) // Convert to json object and pass to next then + .then(data => { // Parse the data of the JSON response + // If it is something here it updates the state variable with the HTML list of all + // movie objects that where returned by the search request + console.log(data) + if (data.length > 0) { + this.setState({ + responseMovieList: data.map(item => this.createMovieObjects(item)) }) - // If the -------- - .catch(error => { - console.log(error) - this.setState({ - responseMovieList:

Not Found

- }) + } + }) + // If the -------- + .catch(error => { + console.log(error) + this.setState({ + responseMovieList:

Not Found

+ }) - console.log('Error submit: ', error.toString()); - }); + console.log('Error submit: ', error.toString()); + }); } // Updates the internal state of the query search field. @@ -123,11 +154,11 @@ class SearchRequest extends React.Component { }) console.log(this.state.movieFilter); } - else if (filterType == 'tvshows') { + else if (filterType == 'shows') { this.setState({ - tvshowFilter: !this.state.tvshowFilter + showFilter: !this.state.showFilter }) - console.log(this.state.tvshowFilter); + console.log(this.state.showFilter); } } @@ -151,6 +182,11 @@ class SearchRequest extends React.Component { render(){ return(
+ + + + +
Request new movies or tv shows @@ -171,7 +207,7 @@ class SearchRequest extends React.Component { id="category_active">Movies {this.toggleFilter('tvshows')}} + onClick={() => {this.toggleFilter('shows')}} id="category_inactive">TV Shows
-- 2.34.1