Sets the default connect timeout for new connections. A value of 0 means no timeout,
- otherwise values must be between 1 and {@link Integer#MAX_VALUE} when converted to milliseconds.
+ otherwise values must be between 1 and Integer.MAX_VALUE when converted to milliseconds.
@@ -99,7 +113,7 @@
Sets the default write timeout for new connections. A value of 0 means no timeout,
- otherwise values must be between 1 and {@link Integer#MAX_VALUE} when converted to milliseconds.
+ otherwise values must be between 1 and Integer.MAX_VALUE when converted to milliseconds.
@@ -107,7 +121,7 @@
Sets the default read timeout for new connections. A value of 0 means no timeout,
- otherwise values must be between 1 and {@link Integer#MAX_VALUE} when converted to milliseconds.
+ otherwise values must be between 1 and Integer.MAX_VALUE when converted to milliseconds.
diff --git a/src/main/resources/static/js/index.js b/src/main/resources/static/js/index.js
index 239370d..fefc4eb 100644
--- a/src/main/resources/static/js/index.js
+++ b/src/main/resources/static/js/index.js
@@ -4,13 +4,13 @@ function start() {
$('.modal').modal();
}
-var keepChecking;
+let keepChecking;
function onSubmitGapsSearch() {
keepChecking = true;
$('#progressContainer').hide();
- var gaps = {
+ const gaps = {
movieDbApiKey: $('#movie_db_api_key').val(),
writeToFile: true,
movieDbListId: $('#movie_db_list_id').val(),
@@ -18,19 +18,19 @@ function onSubmitGapsSearch() {
connectTimeout: $('#connect_timeout').val(),
writeTimeout: $('#write_timeout').val(),
readTimeout: $('#read_timeout').val(),
- movieUrls: [$('#plex_movie_urls').val()]
+ movieUrls: $('#plex_movie_urls').val().split("\n")
}
$.ajax({
type: "POST",
- url: "http://localhost:8080/submit",
+ url: "http://" + $('#address').val() + ":" + $('#port').val() + "/submit",
data: JSON.stringify(gaps),
contentType: "application/json",
timeout: 10000000,
success: function (movies) {
keepChecking = false;
- var movieHtml = "";
- movies.forEach(function(movie) {
+ let movieHtml = "";
+ movies.forEach(function (movie) {
movieHtml += buildMovieDiv(movie);
});
@@ -39,12 +39,21 @@ function onSubmitGapsSearch() {
$('#searchModelTitle').text(movies.length + ' movies to add to complete your collections');
},
error: function (err) {
- alert(err.responseText);
+ let message = "Unknown error. Check docker Gaps log file.";
+ if (err) {
+ message = JSON.parse(err.responseText).message;
+ }
+
+ $('#progressContainer').hide();
+ $('#searchingBody').html(message);
+ $('#searchModelTitle').text("An error occurred...");
+
+ keepChecking = false;
}
})
$('#searchModal').modal('open');
-
+
polling();
}
@@ -61,21 +70,21 @@ function buildMovie(movie) {
}
function polling() {
- if(keepChecking) {
+ if (keepChecking) {
$.ajax({
- type: "GET",
- url: "http://localhost:8080/status",
- contentType: "application/json",
- success: function(data) {
- if(keepChecking) {
- var obj = JSON.parse(data);
- if(!obj.searchedMovieCount && !obj.totalMovieCount && obj.totalMovieCount === 0) {
+ type: "GET",
+ url: "http://" + $('#address').val() + ":" + $('#port').val() + "/status",
+ contentType: "application/json",
+ success: function (data) {
+ if (keepChecking) {
+ const obj = JSON.parse(data);
+ if (!obj.searchedMovieCount && !obj.totalMovieCount && obj.totalMovieCount === 0) {
$('#searchingBody').text("Searching for movies...");
} else {
$('#progressContainer').show();
var percentage = Math.trunc(obj.searchedMovieCount / obj.totalMovieCount * 100);
$('#searchingBody').text(obj.searchedMovieCount + ' of ' + obj.totalMovieCount + " movies searched. " + percentage + "% complete.");
- $('#progressBar').css( "width", percentage + "%" );
+ $('#progressBar').css("width", percentage + "%");
}
setTimeout(polling, 2000);
}
diff --git a/test_cases.txt b/test_cases.txt
new file mode 100644
index 0000000..62750b0
--- /dev/null
+++ b/test_cases.txt
@@ -0,0 +1,42 @@
+{}
+
+{
+ "timestamp": "2019-05-23T18:16:17.402+0000",
+ "status": 422,
+ "error": "Unprocessable Entity",
+ "message": "Missing Movie DB Api Key. This field is required for Gaps.",
+ "path": "/submit"
+}
+
+
+####
+
+{
+ "movieDbApiKey":"test"
+}
+
+{
+ "timestamp": "2019-05-23T18:16:32.154+0000",
+ "status": 422,
+ "error": "Unprocessable Entity",
+ "message": "Must search from Plex and/or Folders. One or both of these fields is required for Gaps.",
+ "path": "/submit"
+}
+
+####
+
+
+{
+ "movieDbApiKey":"test",
+ "searchFromPlex": true
+}
+
+{
+ "timestamp": "2019-05-23T18:17:05.369+0000",
+ "status": 422,
+ "error": "Unprocessable Entity",
+ "message": "Missing Plex Movie Collection Urls. This field is required to search from Plex.",
+ "path": "/submit"
+}
+
+####