mirror of
https://github.com/JasonHHouse/gaps.git
synced 2026-04-25 18:38:42 -05:00
Fixing gaps movie issues
Updating readme
This commit is contained in:
@@ -69,7 +69,7 @@ Click the *Search via Plex* button and move on to the next page.
|
||||
|
||||
With your Movie DB key added, now we need to configure the information to connect to Plex.
|
||||
|
||||

|
||||

|
||||
|
||||
On this page, you'll need to configure how you connect to Plex. This includes three main things: the host/ip address of Plex, the port Plex uses, and your personal Plex Token.
|
||||
|
||||
@@ -97,7 +97,7 @@ Once you have those three, click next.
|
||||
|
||||
On the Libraries page, Gaps will try to connect to Plex and if successful it will return the 'Movie' type libraries it found.
|
||||
|
||||

|
||||

|
||||
|
||||
Select any or all of the movie libraries you want to search. You must select at least one.
|
||||
|
||||
@@ -105,7 +105,7 @@ Select any or all of the movie libraries you want to search. You must select at
|
||||
Once you've started searching, the movies will start populating on the final page.
|
||||
|
||||
|
||||

|
||||

|
||||
|
||||
## Jay add last photo, need to implement three buttons and a cancel option
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 6.0 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.4 MiB |
|
Before Width: | Height: | Size: 694 KiB After Width: | Height: | Size: 694 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 878 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 630 KiB |
+1
-1
@@ -1 +1 @@
|
||||
"use strict";function onStart(){$("#plex").click(function(){if(validateInput()){let obj;try{obj=JSON.parse(document.cookie)}catch(e){obj={}}obj.movie_db_api_key=$("#movie_db_api_key").val();document.cookie=JSON.stringify(obj);location.assign("plex_configuration.html")}});populateCookieValues();M.AutoInit();M.updateTextFields()}function populateCookieValues(){if(document.cookie){try{let obj=JSON.parse(document.cookie);if(obj.movie_db_api_key){$("#movie_db_api_key").val(obj.movie_db_api_key)}}catch(e){}}}function validateInput(){if(!$("#movie_db_api_key").val()){M.toast({html:"The MovieDB api key must not be empty"});return false}return true}
|
||||
"use strict";function onStart(){$("#plex").click(function(){if(validateInput()){Cookies.set("movie_db_api_key",$("#movie_db_api_key").val());location.assign("plex_configuration.html")}});populateCookieValues();M.AutoInit();M.updateTextFields()}function populateCookieValues(){if(document.cookie){const movieDbApiKey=Cookies.get("movie_db_api_key");if(movieDbApiKey){$("#movie_db_api_key").val(movieDbApiKey)}}}function validateInput(){if(!$("#movie_db_api_key").val()){M.toast({html:"The MovieDB api key must not be empty"});return false}return true}
|
||||
+1
-1
@@ -1 +1 @@
|
||||
"use strict";function onStart(){$("#back").click(function(){location.assign("index.html")});$("#next").click(function(){if(validateInput()){let obj;try{obj=JSON.parse(document.cookie)}catch(e){const errorMessage="Missing cookie information for address, port, and token";M.toast({html:errorMessage});Console.error(errorMessage);obj={}}obj.address=$("#address").val();obj.port=$("#port").val();obj.plex_token=$("#plex_token").val();document.cookie=JSON.stringify(obj);location.assign("plex_libraries.html")}});populateCookieValues();M.AutoInit();M.updateTextFields()}function populateCookieValues(){if(document.cookie){let obj=JSON.parse(document.cookie);if(obj.address){$("#address").val(obj.address)}if(obj.port){$("#port").val(obj.port)}if(obj.plex_token){$("#plex_token").val(obj.plex_token)}}}function validateInput(){if(!$("#address").val()){M.toast({html:"Plex IP address must not be empty"});return false}if(!$("#port").val()){M.toast({html:"Plex port must not be empty"});return false}if(!$("#plex_token").val()){M.toast({html:"Plex Token must not be empty"});return false}return true}
|
||||
"use strict";function onStart(){$("#back").click(function(){location.assign("index.html")});$("#next").click(function(){if(validateInput()){Cookies.set("address",$("#address").val());Cookies.set("port",$("#port").val());Cookies.set("plex_token",$("#plex_token").val());location.assign("plex_libraries.html")}});populateCookieValues();M.AutoInit();M.updateTextFields()}function populateCookieValues(){const address=Cookies.get("address");const port=Cookies.get("port");const plexToken=Cookies.get("plex_token");if(address){$("#address").val(address)}if(port){$("#port").val(port)}if(plexToken){$("#plex_token").val(plexToken)}}function validateInput(){if(!$("#address").val()){M.toast({html:"Plex IP address must not be empty"});return false}if(!$("#port").val()){M.toast({html:"Plex port must not be empty"});return false}if(!$("#plex_token").val()){M.toast({html:"Plex Token must not be empty"});return false}return true}
|
||||
@@ -91,7 +91,7 @@ function getLibraries() {
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "http://" + location.hostname + ":" + location.port + "/getPlexLibraries?" + encodeQueryData(data),
|
||||
url: "https://" + location.hostname + ":" + location.port + "/getPlexLibraries?" + encodeQueryData(data),
|
||||
contentType: "application/json",
|
||||
success: function (data) {
|
||||
allLibraries = data;
|
||||
@@ -150,7 +150,7 @@ function findIfChecked(selectedLibraries, key) {
|
||||
}
|
||||
|
||||
function updatedSelectedLibraries() {
|
||||
Cookies.set('libraries', findSelectedLibraries());
|
||||
Cookies.set('libraries', JSON.stringify(findSelectedLibraries()));
|
||||
}
|
||||
|
||||
function findSelectedLibraries() {
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
"use strict";let allLibraries;function onStart(){$("#back").click(function(){location.assign("plex_configuration.html")});$("#search").click(function(){let obj=JSON.parse(document.cookie);if(!obj.dialogDontShowAgain){if(validateInput()){$("#warningModal").modal("open")}}else{if(validateInput()){updatedSelectedLibraries();location.assign("plex_movie_list.html")}}});$("#agree").click(function(){if(validateInput()){let obj=JSON.parse(document.cookie);obj.dialogDontShowAgain=$("#dialogDontShowAgain").is(":checked");document.cookie=JSON.stringify(obj);updatedSelectedLibraries();location.assign("plex_movie_list.html")}});setPreloaderVisibility(true);getLibraries();M.AutoInit();M.updateTextFields();document.addEventListener("DOMContentLoaded",function(){const elements=document.querySelectorAll(".modal");M.Modal.init(elements)})}function setPreloaderVisibility(bool){$("#progressBar").toggle(bool)}function setSearchEnabled(bool){if(bool){$("#search").removeClass("disabled")}else{$("#search").addClass("disabled")}}function clearLibrariesAndErrors(){$("#libraryException").html("");$("#libraryCheckboxes").html("")}function getLibraries(){setSearchEnabled(false);clearLibrariesAndErrors();let obj=JSON.parse(document.cookie);let token=obj.plex_token;let port=obj.port;let address=obj.address;if(!token||!port||!address){console.warn("Could not find plex token, port, or address in cookies");M.toast({html:"Could not find plex token, port, or address in cookies"});return}let data={token:token,port:port,address:address};$.ajax({type:"GET",url:"http://"+location.hostname+":"+location.port+"/getPlexLibraries?"+encodeQueryData(data),contentType:"application/json",success:function(data){allLibraries=data;setPreloaderVisibility(false);setSearchEnabled(true);generateLibrariesCheckbox(data)},error:function(){setPreloaderVisibility(false);setSearchEnabled(false);setErrorMessage()}})}function encodeQueryData(data){const ret=[];for(const d in data){ret.push(encodeURIComponent(d)+"="+encodeURIComponent(data[d]))}return ret.join("&")}function validateInput(){let selectedLibraries=findSelectedLibraries();if(selectedLibraries===undefined||selectedLibraries.length===0){M.toast({html:"Must select at least one library"});return false}return true}function setErrorMessage(){$("#libraryCheckboxes").html("<p>Something went wrong. Please make sure your connection to Plex is correct. You can navigate back to make changes and then retry connecting. Check the browser and Docker logs for more information.</p>")}function generateLibrariesCheckbox(){let obj=JSON.parse(document.cookie);let selectedLibraries=obj.libraries||[];let row="";for(const library of allLibraries){const ifChecked=findIfChecked(selectedLibraries,library.key)?" checked='checked'":"";row+=`<div class='row'><p class='col s5'><label><input onclick='updatedSelectedLibraries()' id='${library.key}' type='checkbox' class='filled-in grey-text text-lighten-4' ${ifChecked} /><span>${library.title}</span></label></p></div>`}$("#libraryCheckboxes").html(row)}function findIfChecked(selectedLibraries,key){for(let i=0;i<selectedLibraries.length;i++){if(selectedLibraries[i].key===key){return true}}return false}function updatedSelectedLibraries(){let obj=JSON.parse(document.cookie);obj.libraries=findSelectedLibraries();document.cookie=JSON.stringify(obj)}function findSelectedLibraries(){let selectedLibraries=[];for(let library of allLibraries){if($("#"+library.key).is(":checked")){selectedLibraries.push(library)}}return selectedLibraries}
|
||||
"use strict";let allLibraries;function onStart(){$("#back").click(function(){location.assign("plex_configuration.html")});$("#search").click(function(){if(Cookies.get("dialogDontShowAgain")){if(validateInput()){$("#warningModal").modal("open")}}else{if(validateInput()){updatedSelectedLibraries();location.assign("plex_movie_list.html")}}});$("#agree").click(function(){if(validateInput()){Cookies.set("dialogDontShowAgain",$("#dialogDontShowAgain").is(":checked"));updatedSelectedLibraries();location.assign("plex_movie_list.html")}});setPreloaderVisibility(true);getLibraries();M.AutoInit();M.updateTextFields();document.addEventListener("DOMContentLoaded",function(){const elements=document.querySelectorAll(".modal");M.Modal.init(elements)})}function setPreloaderVisibility(bool){$("#progressBar").toggle(bool)}function setSearchEnabled(bool){if(bool){$("#search").removeClass("disabled")}else{$("#search").addClass("disabled")}}function clearLibrariesAndErrors(){$("#libraryException").html("");$("#libraryCheckboxes").html("")}function getLibraries(){setSearchEnabled(false);clearLibrariesAndErrors();const address=Cookies.get("address");const port=Cookies.get("port");const plexToken=Cookies.get("plex_token");if(!plexToken||!port||!address){console.warn("Could not find plex token, port, or address in cookies");M.toast({html:"Could not find plex token, port, or address in cookies"});return}let data={token:plexToken,port:port,address:address};$.ajax({type:"GET",url:"https://"+location.hostname+":"+location.port+"/getPlexLibraries?"+encodeQueryData(data),contentType:"application/json",success:function(data){allLibraries=data;setPreloaderVisibility(false);setSearchEnabled(true);generateLibrariesCheckbox(data)},error:function(){setPreloaderVisibility(false);setSearchEnabled(false);setErrorMessage()}})}function encodeQueryData(data){const ret=[];for(const d in data){ret.push(encodeURIComponent(d)+"="+encodeURIComponent(data[d]))}return ret.join("&")}function validateInput(){let selectedLibraries=findSelectedLibraries();if(selectedLibraries===undefined||selectedLibraries.length===0){M.toast({html:"Must select at least one library"});return false}return true}function setErrorMessage(){$("#libraryCheckboxes").html("<p>Something went wrong. Please make sure your connection to Plex is correct. You can navigate back to make changes and then retry connecting. Check the browser and Docker logs for more information.</p>")}function generateLibrariesCheckbox(){const selectedLibraries=Cookies.get("libraries")||[];let row="";for(const library of allLibraries){const ifChecked=findIfChecked(selectedLibraries,library.key)?" checked='checked'":"";row+=`<div class='row'><p class='col s5'><label><input onclick='updatedSelectedLibraries()' id='${library.key}' type='checkbox' class='filled-in grey-text text-lighten-4' ${ifChecked} /><span>${library.title}</span></label></p></div>`}$("#libraryCheckboxes").html(row)}function findIfChecked(selectedLibraries,key){for(let i=0;i<selectedLibraries.length;i++){if(selectedLibraries[i].key===key){return true}}return false}function updatedSelectedLibraries(){Cookies.set("libraries",JSON.stringify(findSelectedLibraries()))}function findSelectedLibraries(){let selectedLibraries=[];for(let library of allLibraries){if($("#"+library.key).is(":checked")){selectedLibraries.push(library)}}return selectedLibraries}
|
||||
@@ -46,7 +46,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
//Cancel Search
|
||||
$.ajax({
|
||||
type: "PUT",
|
||||
url: "http://" + location.hostname + ":" + location.port + "/cancelSearch",
|
||||
url: "https://" + location.hostname + ":" + location.port + "/cancelSearch",
|
||||
contentType: "application/json",
|
||||
});
|
||||
|
||||
@@ -79,7 +79,7 @@ function search() {
|
||||
searchTitle.text("Searching for Movies...");
|
||||
searchDescription.text("Gaps is looking through your Plex libraries. This could take a while so just sit tight and we'll find all the missing movies for you.");
|
||||
|
||||
const libraries = Cookies.get('libraries');
|
||||
const libraries = JSON.parse(Cookies.get('libraries'));
|
||||
const address = Cookies.get('address');
|
||||
const port = Cookies.get('port');
|
||||
const plexToken = Cookies.get('plex_token');
|
||||
@@ -87,7 +87,7 @@ function search() {
|
||||
|
||||
let plexMovieUrls = [];
|
||||
|
||||
for (let library of libraries) {
|
||||
for (const library of libraries) {
|
||||
let data = {
|
||||
'X-Plex-Token': plexToken
|
||||
};
|
||||
@@ -105,7 +105,7 @@ function search() {
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "http://" + location.hostname + ":" + location.port + "/submit",
|
||||
url: "https://" + location.hostname + ":" + location.port + "/submit",
|
||||
data: JSON.stringify(gaps),
|
||||
contentType: "application/json",
|
||||
timeout: 0,
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
"use strict";let stompClient;let backButton;let copyToClipboard;let searchResults;let searchPosition;let progressContainer;let searchTitle;let searchDescription;let movieCounter;document.addEventListener("DOMContentLoaded",function(){const elements=document.querySelectorAll(".modal");M.Modal.init(elements);backButton=$("#cancel");copyToClipboard=$("#copyToClipboard");searchResults=$("#searchResults");searchPosition=$("#searchPosition");progressContainer=$("#progressContainer");searchTitle=$("#searchTitle");searchDescription=$("#searchDescription");backButton.click(function(){$("#warningModal").modal("open")});setCopyToClipboardEnabled(false);copyToClipboard.click(function(){CopyToClipboard("searchResults");M.toast({html:"Copied to Clipboard"})});$("#agree").click(function(){$.ajax({type:"PUT",url:"http://"+location.hostname+":"+location.port+"/cancelSearch",contentType:"application/json"});location.assign("index.html")});connect();search()});window.onbeforeunload=function(){disconnect()};function setCopyToClipboardEnabled(bool){if(bool){copyToClipboard.removeClass("disabled")}else{copyToClipboard.addClass("disabled")}}function search(){movieCounter=0;progressContainer.hide();searchTitle.text("Searching for Movies...");searchDescription.text("Gaps is looking through your Plex libraries. This could take a while so just sit tight and we'll find all the missing movies for you.");let obj=JSON.parse(document.cookie);let plexMovieUrls=[];for(let library of obj.libraries){let data={"X-Plex-Token":obj.plex_token};let plexMovieUrl="http://"+obj.address+":"+obj.port+"/library/sections/"+library.key+"/all/?"+encodeQueryData(data);plexMovieUrls.push(plexMovieUrl)}const gaps={movieDbApiKey:obj.movie_db_api_key,writeToFile:true,searchFromPlex:true,movieUrls:plexMovieUrls};$.ajax({type:"POST",url:"http://"+location.hostname+":"+location.port+"/submit",data:JSON.stringify(gaps),contentType:"application/json",timeout:0,success:function(movies){searchResults.html(searchResults.html()+buildMoviesDiv(movies));movieCounter+=movies.length;searchTitle.text(`${movieCounter} movies to add to complete your collections`);searchDescription.text("Below is everything Gaps found that is missing from your movie collections.");progressContainer.hide();backButton.text("restart");setCopyToClipboardEnabled(true)},error:function(err){disconnect();let message="Unknown error. Check docker Gaps log file.";if(err){message=JSON.parse(err.responseText).message;console.error(message)}searchTitle.text("An error occurred...");searchDescription.text("");progressContainer.hide();backButton.text("restart");setCopyToClipboardEnabled(false)}});showSearchStatus()}function buildMoviesDiv(movies){let result="";for(let movie of movies){result+=buildMovieDiv(movie)}return result}function buildMovieDiv(movie){return"<div>"+buildMovie(movie)+"</div>"}function buildMovie(movie){return`${movie.name} (${movie.year}) from '${movie.collection}'`}function connect(){const socket=new SockJS("/gs-guide-websocket");stompClient=Stomp.over(socket);stompClient.connect({},function(){stompClient.subscribe("/topic/currentSearchResults",function(status){let obj=JSON.parse(status.body);showSearchStatus(obj);shouldDisconnect(obj)})})}function disconnect(){if(stompClient!==null){stompClient.disconnect()}console.log("Disconnected")}function shouldDisconnect(obj){if(obj&&obj.searchedMovieCount&&obj.totalMovieCount&&obj.totalMovieCount===obj.searchedMovieCount){disconnect();$.ajax({type:"PUT",url:"http://"+location.hostname+":"+location.port+"/cancelSearch",contentType:"application/json"})}}function showSearchStatus(obj){if(!obj||!obj.searchedMovieCount&&!obj.totalMovieCount&&obj.totalMovieCount===0){searchResults.html("")}else{progressContainer.show();let percentage=Math.trunc(obj.searchedMovieCount/obj.totalMovieCount*100);searchPosition.html(`<h5>${obj.searchedMovieCount} of ${obj.totalMovieCount} movies searched. ${percentage}% complete.</h5>`);movieCounter=obj.moviesFound.length;searchResults.html(buildMoviesDiv(obj.moviesFound));$("#progressBar").css("width",percentage+"%")}}function encodeQueryData(data){const ret=[];for(let d in data){ret.push(encodeURIComponent(d)+"="+encodeURIComponent(data[d]))}return ret.join("&")}function CopyToClipboard(containerId){let range;if(document.selection){range=document.body.createTextRange();range.moveToElementText(document.getElementById(containerId));range.select().createTextRange();document.execCommand("copy")}else if(window.getSelection){range=document.createRange();range.selectNode(document.getElementById(containerId));window.getSelection().addRange(range);document.execCommand("copy")}}
|
||||
"use strict";let stompClient;let backButton;let copyToClipboard;let searchResults;let searchPosition;let progressContainer;let searchTitle;let searchDescription;let movieCounter;document.addEventListener("DOMContentLoaded",function(){const elements=document.querySelectorAll(".modal");M.Modal.init(elements);backButton=$("#cancel");copyToClipboard=$("#copyToClipboard");searchResults=$("#searchResults");searchPosition=$("#searchPosition");progressContainer=$("#progressContainer");searchTitle=$("#searchTitle");searchDescription=$("#searchDescription");backButton.click(function(){$("#warningModal").modal("open")});setCopyToClipboardEnabled(false);copyToClipboard.click(function(){CopyToClipboard("searchResults");M.toast({html:"Copied to Clipboard"})});$("#agree").click(function(){$.ajax({type:"PUT",url:"https://"+location.hostname+":"+location.port+"/cancelSearch",contentType:"application/json"});location.assign("index.html")});connect();search()});window.onbeforeunload=function(){disconnect()};function setCopyToClipboardEnabled(bool){if(bool){copyToClipboard.removeClass("disabled")}else{copyToClipboard.addClass("disabled")}}function search(){movieCounter=0;progressContainer.hide();searchTitle.text("Searching for Movies...");searchDescription.text("Gaps is looking through your Plex libraries. This could take a while so just sit tight and we'll find all the missing movies for you.");const libraries=JSON.parse(Cookies.get("libraries"));const address=Cookies.get("address");const port=Cookies.get("port");const plexToken=Cookies.get("plex_token");const movieDbApiKey=Cookies.get("movie_db_api_key");let plexMovieUrls=[];for(const library of libraries){let data={"X-Plex-Token":plexToken};let plexMovieUrl="http://"+address+":"+port+"/library/sections/"+library.key+"/all/?"+encodeQueryData(data);plexMovieUrls.push(plexMovieUrl)}const gaps={movieDbApiKey:movieDbApiKey,writeToFile:true,searchFromPlex:true,movieUrls:plexMovieUrls};$.ajax({type:"POST",url:"https://"+location.hostname+":"+location.port+"/submit",data:JSON.stringify(gaps),contentType:"application/json",timeout:0,success:function(movies){searchResults.html(searchResults.html()+buildMoviesDiv(movies));movieCounter+=movies.length;searchTitle.text(`${movieCounter} movies to add to complete your collections`);searchDescription.text("Below is everything Gaps found that is missing from your movie collections.");progressContainer.hide();backButton.text("restart");setCopyToClipboardEnabled(true)},error:function(err){disconnect();let message="Unknown error. Check docker Gaps log file.";if(err){message=JSON.parse(err.responseText).message;console.error(message)}searchTitle.text("An error occurred...");searchDescription.text("");progressContainer.hide();backButton.text("restart");setCopyToClipboardEnabled(false)}});showSearchStatus()}function buildMoviesDiv(movies){let result="";for(let movie of movies){result+=buildMovieDiv(movie)}return result}function buildMovieDiv(movie){return"<div>"+buildMovie(movie)+"</div>"}function buildMovie(movie){return`${movie.name} (${movie.year}) from '${movie.collection}'`}function connect(){const socket=new SockJS("/gs-guide-websocket");stompClient=Stomp.over(socket);stompClient.connect({},function(){stompClient.subscribe("/topic/currentSearchResults",function(status){let obj=JSON.parse(status.body);showSearchStatus(obj);shouldDisconnect(obj)})})}function disconnect(){if(stompClient!==null){stompClient.disconnect()}console.log("Disconnected")}function shouldDisconnect(obj){if(obj&&obj.searchedMovieCount&&obj.totalMovieCount&&obj.totalMovieCount===obj.searchedMovieCount){disconnect();$.ajax({type:"PUT",url:"http://"+location.hostname+":"+location.port+"/cancelSearch",contentType:"application/json"})}}function showSearchStatus(obj){if(!obj||!obj.searchedMovieCount&&!obj.totalMovieCount&&obj.totalMovieCount===0){searchResults.html("")}else{progressContainer.show();let percentage=Math.trunc(obj.searchedMovieCount/obj.totalMovieCount*100);searchPosition.html(`<h5>${obj.searchedMovieCount} of ${obj.totalMovieCount} movies searched. ${percentage}% complete.</h5>`);movieCounter=obj.moviesFound.length;searchResults.html(buildMoviesDiv(obj.moviesFound));$("#progressBar").css("width",percentage+"%")}}function encodeQueryData(data){const ret=[];for(let d in data){ret.push(encodeURIComponent(d)+"="+encodeURIComponent(data[d]))}return ret.join("&")}function CopyToClipboard(containerId){let range;if(document.selection){range=document.body.createTextRange();range.moveToElementText(document.getElementById(containerId));range.select().createTextRange();document.execCommand("copy")}else if(window.getSelection){range=document.createRange();range.selectNode(document.getElementById(containerId));window.getSelection().addRange(range);document.execCommand("copy")}}
|
||||
Reference in New Issue
Block a user