Cleaning up code

Adding license
This commit is contained in:
jhouse
2019-10-07 17:08:35 +09:00
parent c52c7b1f85
commit ffd5930f17
31 changed files with 282 additions and 91 deletions
@@ -10,8 +10,8 @@
package com.jasonhhouse.Gaps;
import java.util.List;
import javax.validation.constraints.NotNull;
import java.util.List;
public class FolderProperties {
@@ -1,3 +1,13 @@
/*
* Copyright 2019 Jason H House
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.jasonhhouse.Gaps;
import java.util.List;
@@ -10,19 +10,15 @@
package com.jasonhhouse.Gaps;
import java.util.concurrent.Executor;
import org.apache.catalina.Server;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.embedded.jetty.JettyServerCustomizer;
import org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory;
import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.Executor;
/**
* Search for all missing movies in your plex collection by MovieDB collection.
*/
@@ -1,10 +1,14 @@
/*
* Copyright 2019 Jason H House
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.jasonhhouse.Gaps;
import java.util.List;
import java.util.Set;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
@@ -16,14 +20,13 @@ import org.springframework.http.ResponseEntity;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.server.ResponseStatusException;
import java.util.List;
import java.util.Set;
import java.util.concurrent.Future;
/**
* Handles REST and WebSocket calls for Gaps.
*/
@@ -33,7 +36,6 @@ public class GapsControllerImpl {
private final Logger logger = LoggerFactory.getLogger(GapsControllerImpl.class);
private final GapsSearch gapsSearch;
@Autowired
private final SimpMessagingTemplate template;
@Autowired
@@ -60,12 +62,6 @@ public class GapsControllerImpl {
return new ResponseEntity<>(plexLibraries, HttpStatus.OK);
}
@RequestMapping(value = "/ssl-test", method = RequestMethod.GET)
@ResponseBody
public String greeting() {
return "Self Signed SSL is Working!!";
}
/**
* Forces a stop to searching. Used commonly if navigated away from page.
*
@@ -86,6 +82,7 @@ public class GapsControllerImpl {
*/
@RequestMapping(value = "submit", method = RequestMethod.POST)
@ResponseStatus(value = HttpStatus.OK)
@SuppressWarnings("unchecked")
public Future<ResponseEntity<Set<Movie>>> submit(@RequestBody Gaps gaps) {
logger.info("submit()");
@@ -1,9 +1,20 @@
/*
* Copyright 2019 Jason H House
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.jasonhhouse.Gaps;
import org.jetbrains.annotations.NotNull;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CopyOnWriteArrayList;
import org.jetbrains.annotations.NotNull;
public interface GapsSearch {
@@ -15,7 +26,7 @@ public interface GapsSearch {
@NotNull CopyOnWriteArrayList<Movie> getRecommendedMovies();
@NotNull Set<PlexLibrary> getPlexLibraries(@NotNull String address, @NotNull int port, @NotNull String token);
@NotNull Set<PlexLibrary> getPlexLibraries(@NotNull String address, int port, @NotNull String token);
void cancelSearch();
@@ -1,37 +1,16 @@
/*
* Copyright 2019 Jason H House
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.jasonhhouse.Gaps;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import okhttp3.HttpUrl;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.*;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -50,6 +29,22 @@ import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import java.io.*;
import java.net.URLEncoder;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
@Service
public class GapsSearchBean implements GapsSearch {
@@ -145,7 +140,7 @@ public class GapsSearchBean implements GapsSearch {
}
@Override
public @NotNull Set<PlexLibrary> getPlexLibraries(@NotNull String address, @NotNull int port, @NotNull String token) {
public @NotNull Set<PlexLibrary> getPlexLibraries(@NotNull String address, int port, @NotNull String token) {
logger.info("Searching for Plex Libraries...");
OkHttpClient client = new OkHttpClient.Builder()
.build();
@@ -316,7 +311,7 @@ public class GapsSearchBean implements GapsSearch {
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/octet-stream");
RequestBody.create(mediaType, "{}");
RequestBody.create("{}", mediaType);
RequestBody body;
Request request = new Request.Builder()
.url("https://api.themoviedb.org/3/authentication/token/new?api_key=" + gaps.getMovieDbApiKey())
@@ -344,7 +339,7 @@ public class GapsSearchBean implements GapsSearch {
// Create the sesssion ID for MovieDB using the approved token
mediaType = MediaType.parse("application/json");
body = RequestBody.create(mediaType, "{\"request_token\":\"" + request_token + "\"}");
body = RequestBody.create("{\"request_token\":\"" + request_token + "\"}", mediaType);
request = new Request.Builder()
.url("https://api.themoviedb.org/3/authentication/session/new?api_key=" + gaps.getMovieDbApiKey())
.post(body)
@@ -375,7 +370,7 @@ public class GapsSearchBean implements GapsSearch {
for (Movie m : recommended) {
client = new OkHttpClient();
body = RequestBody.create(mediaType, "{\"media_id\":" + m.getMedia_id() + "}");
body = RequestBody.create("{\"media_id\":" + m.getMedia_id() + "}", mediaType);
String url = "https://api.themoviedb.org/3/list/" + gaps.getMovieDbListId()
+ "/add_item?session_id=" + sessionId + "&api_key=" + gaps.getMovieDbApiKey();
Request request = new Request.Builder()
@@ -690,7 +685,7 @@ public class GapsSearchBean implements GapsSearch {
}
}
public class UserInputThreadCountdown implements java.lang.Runnable {
public static class UserInputThreadCountdown implements java.lang.Runnable {
int time_limit = 60;
@@ -706,15 +701,12 @@ public class GapsSearchBean implements GapsSearch {
}
}
public void runTimer() throws IOException {
long timePassedstart = 0;
private void runTimer() throws IOException {
long timePassedStart;
do {
timePassedstart = (new Date().getTime() - start.getTime()) / 1000;
} while (timePassedstart < time_limit);
timePassedStart = (new Date().getTime() - start.getTime()) / 1000;
} while (timePassedStart < time_limit);
System.in.close();
}
}
}
}
@@ -10,9 +10,10 @@
package com.jasonhhouse.Gaps;
import java.util.Objects;
import org.apache.commons.lang3.StringUtils;
import java.util.Objects;
public final class Movie implements Comparable<Movie> {
private final String name;
@@ -1,8 +1,19 @@
/*
* Copyright 2019 Jason H House
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.jasonhhouse.Gaps;
import java.util.Objects;
import org.jetbrains.annotations.NotNull;
import java.util.Objects;
public class PlexLibrary implements Comparable<PlexLibrary> {
private Integer key;
private String title;
@@ -10,12 +10,13 @@
package com.jasonhhouse.Gaps;
import javax.validation.constraints.NotNull;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;
import javax.validation.constraints.NotNull;
@Configuration
@ConfigurationProperties(prefix = "gaps")
@Component
@@ -1,3 +1,13 @@
/*
* Copyright 2019 Jason H House
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.jasonhhouse.Gaps;
import org.springframework.context.annotation.Configuration;
@@ -1,3 +1,13 @@
/*
* Copyright 2019 Jason H House
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.jasonhhouse.Gaps;
public class SearchCancelledException extends Exception {
@@ -1,3 +1,13 @@
/*
* Copyright 2019 Jason H House
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.jasonhhouse.Gaps;
import java.util.List;
@@ -1,3 +1,13 @@
/*
* Copyright 2019 Jason H House
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.jasonhhouse.Gaps;
import java.util.Objects;
@@ -1,3 +1,13 @@
/*
* Copyright 2019 Jason H House
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.jasonhhouse.Gaps;
import org.springframework.context.annotation.Configuration;
+10
View File
@@ -1,3 +1,13 @@
/*
* Copyright 2019 Jason H House
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
body {
display: flex;
min-height: 100vh;
+10
View File
@@ -1,3 +1,13 @@
/*
* Copyright 2019 Jason H House
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/* Change the white to any color ;) */
input:-webkit-autofill,
input:-webkit-autofill:hover,
+10
View File
@@ -1,3 +1,13 @@
/*
* Copyright 2019 Jason H House
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/* unvisited link */
a:link {
color: #fffde7;
+10
View File
@@ -1,3 +1,13 @@
<!--
- Copyright 2019 Jason H House
-
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-->
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/html">
<head>
+9
View File
@@ -1,3 +1,12 @@
<!--
- Copyright 2019 Jason H House
-
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-->
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/html" lang="en">
+10
View File
@@ -1,3 +1,13 @@
/*
* Copyright 2019 Jason H House
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
"use strict";
function onStart() {
+9
View File
@@ -1,3 +1,12 @@
/*
* Copyright 2019 Jason H House
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
"use strict";
let keepChecking;
+1 -1
View File
@@ -1 +1 @@
"use strict";let keepChecking;let stompClient;let modal;document.addEventListener("DOMContentLoaded",function(){M.AutoInit();const a=document.querySelectorAll(".modal");M.Modal.init(a,{onCloseEnd:function(){$.ajax({type:"PUT",url:"http://"+$("#address").val()+":"+$("#port").val()+"/cancelSearch",contentType:"application/json",timeout:0})}});M.Modal.getInstance($("#searchModal"));console.debug(document.cookie)});function onSubmitGapsSearch(){if(validateInput()){search()}}function search(){connect();keepChecking=true;let searchModelTitle=$("#searchModelTitle");let progressContainer=$("#progressContainer");let searchingBody=$("#searchingBody");let modelButton=$("#modelButton");progressContainer.hide();modelButton.text("cancel");searchModelTitle.text("Searching");searchingBody.empty();const a={movieDbApiKey:$("#movie_db_api_key").val(),writeToFile:true,movieDbListId:$("#movie_db_list_id").val(),searchFromPlex:true,connectTimeout:$("#connect_timeout").val(),writeTimeout:$("#write_timeout").val(),readTimeout:$("#read_timeout").val(),movieUrls:$("#plex_movie_urls").val().split("\n")};$.ajax({type:"POST",url:"http://"+$("#address").val()+":"+$("#port").val()+"/submit",data:JSON.stringify(a),contentType:"application/json",timeout:0,success:function(b){keepChecking=false;let movieHtml="";b.forEach(function(c){movieHtml+=buildMovieDiv(c)});progressContainer.hide();searchingBody.html(buildMovies(movieHtml));searchModelTitle.text(b.length+" movies to add to complete your collections");modelButton.text("close");disconnect()},error:function(b){let message="Unknown error. Check docker Gaps log file.";if(b){message=JSON.parse(b.responseText).message}progressContainer.hide();searchingBody.html(message);searchModelTitle.text("An error occurred...");modelButton.text("close");keepChecking=false;disconnect()}});$("#searchModal").modal("open");polling()}function buildMovies(a){return'<ul class="collection">'+a+"</ul>"}function buildMovieDiv(a){return'<li class="collection-item">'+buildMovie(a)+"</li>"}function buildMovie(a){return a.name+" ("+a.year+") from '"+a.collection+"'"}function polling(){if(keepChecking){$.ajax({type:"GET",url:"http://"+$("#address").val()+":"+$("#port").val()+"/status",contentType:"application/json",success:function(a){}})}}function connect(){const a=new SockJS("/gs-guide-websocket");stompClient=Stomp.over(a);stompClient.connect({},function(b){stompClient.subscribe("/topic/searchResults",function(c){showSearchStatus(JSON.parse(c.body))})})}function disconnect(){if(stompClient!==null){stompClient.disconnect()}console.log("Disconnected")}function showSearchStatus(b){if(keepChecking){if(!b.searchedMovieCount&&!b.totalMovieCount&&b.totalMovieCount===0){$("#searchingBody").text("Searching for movies...")}else{$("#progressContainer").show();const a=Math.trunc(b.searchedMovieCount/b.totalMovieCount*100);$("#searchingBody").text(b.searchedMovieCount+" of "+b.totalMovieCount+" movies searched. "+a+"% complete. "+b.moviesFound);$("#progressBar").css("width",a+"%")}}};
"use strict";let keepChecking;let stompClient;let modal;document.addEventListener("DOMContentLoaded",function(){M.AutoInit();const elems=document.querySelectorAll(".modal");M.Modal.init(elems,{onCloseEnd:function(){$.ajax({type:"PUT",url:"http://"+$("#address").val()+":"+$("#port").val()+"/cancelSearch",contentType:"application/json",timeout:0})}});M.Modal.getInstance($("#searchModal"));console.debug(document.cookie)});function onSubmitGapsSearch(){if(validateInput()){search()}}function search(){connect();keepChecking=true;let searchModelTitle=$("#searchModelTitle");let progressContainer=$("#progressContainer");let searchingBody=$("#searchingBody");let modelButton=$("#modelButton");progressContainer.hide();modelButton.text("cancel");searchModelTitle.text("Searching");searchingBody.empty();const gaps={movieDbApiKey:$("#movie_db_api_key").val(),writeToFile:true,movieDbListId:$("#movie_db_list_id").val(),searchFromPlex:true,connectTimeout:$("#connect_timeout").val(),writeTimeout:$("#write_timeout").val(),readTimeout:$("#read_timeout").val(),movieUrls:$("#plex_movie_urls").val().split("\n")};$.ajax({type:"POST",url:"http://"+$("#address").val()+":"+$("#port").val()+"/submit",data:JSON.stringify(gaps),contentType:"application/json",timeout:0,success:function(movies){keepChecking=false;let movieHtml="";movies.forEach(function(movie){movieHtml+=buildMovieDiv(movie)});progressContainer.hide();searchingBody.html(buildMovies(movieHtml));searchModelTitle.text(movies.length+" movies to add to complete your collections");modelButton.text("close");disconnect()},error:function(err){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...");modelButton.text("close");keepChecking=false;disconnect()}});$("#searchModal").modal("open");polling()}function buildMovies(html){return'<ul class="collection">'+html+"</ul>"}function buildMovieDiv(movie){return'<li class="collection-item">'+buildMovie(movie)+"</li>"}function buildMovie(movie){return movie.name+" ("+movie.year+") from '"+movie.collection+"'"}function polling(){if(keepChecking){$.ajax({type:"GET",url:"http://"+$("#address").val()+":"+$("#port").val()+"/status",contentType:"application/json",success:function(data){}})}}function connect(){const socket=new SockJS("/gs-guide-websocket");stompClient=Stomp.over(socket);stompClient.connect({},function(frame){stompClient.subscribe("/topic/searchResults",function(status){showSearchStatus(JSON.parse(status.body))})})}function disconnect(){if(stompClient!==null){stompClient.disconnect()}console.log("Disconnected")}function showSearchStatus(obj){if(keepChecking){if(!obj.searchedMovieCount&&!obj.totalMovieCount&&obj.totalMovieCount===0){$("#searchingBody").text("Searching for movies...")}else{$("#progressContainer").show();const percentage=Math.trunc(obj.searchedMovieCount/obj.totalMovieCount*100);$("#searchingBody").text(obj.searchedMovieCount+" of "+obj.totalMovieCount+" movies searched. "+percentage+"% complete. "+obj.moviesFound);$("#progressBar").css("width",percentage+"%")}}}
@@ -1,3 +1,13 @@
/*
* Copyright 2019 Jason H House
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
"use strict";
function onStart() {
+1 -1
View File
@@ -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(a){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()){let obj;try{obj=JSON.parse(document.cookie)}catch(e){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}
@@ -1,3 +1,13 @@
/*
* Copyright 2019 Jason H House
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
"use strict";
let allLibraries;
@@ -1,3 +1,13 @@
/*
* Copyright 2019 Jason H House
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
"use strict"
let stompClient;
+1 -13
View File
@@ -1,13 +1 @@
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}};$jscomp.arrayIterator=function(a){return{next:$jscomp.arrayIteratorImpl(a)}};$jscomp.makeIterator=function(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return b?b.call(a):$jscomp.arrayIterator(a)};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)};$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);
$jscomp.polyfill=function(a,b,c,d){if(b){c=$jscomp.global;a=a.split(".");for(d=0;d<a.length-1;d++){var e=a[d];e in c||(c[e]={});c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&$jscomp.defineProperty(c,a,{configurable:!0,writable:!0,value:b})}};$jscomp.polyfill("Math.trunc",function(a){return a?a:function(a){a=Number(a);if(isNaN(a)||Infinity===a||-Infinity===a||0===a)return a;var b=Math.floor(Math.abs(a));return 0>a?-b:b}},"es6","es3");
var stompClient,backButton,copyToClipboard,searchResults,searchPosition,progressContainer,searchTitle,searchDescription;
document.addEventListener("DOMContentLoaded",function(){var a=document.querySelectorAll(".modal");M.Modal.init(a);searchResults=$("#searchResults");backButton=$("#cancel");copyToClipboard=$("#copyToClipboard");searchResults=$("#searchResults");searchPosition=$("#searchPosition");progressContainer=$("#progressContainer");searchTitle=$("#searchTitle");searchDescription=$("#searchDescription");backButton.click(function(){$("#warningModal").modal("open")});setCopyToClipboardEnabled(!1);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(a){a?copyToClipboard.removeClass("disabled"):copyToClipboard.addClass("disabled")}
function search(){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.");for(var a=JSON.parse(document.cookie),b=[],c=$jscomp.makeIterator(a.libraries),d=c.next();!d.done;d=c.next())d="http://"+a.address+":"+a.port+"/library/sections/"+d.value.key+"/all/?"+encodeQueryData({"X-Plex-Token":a.plex_token}),b.push(d);$.ajax({type:"POST",
url:"http://"+location.hostname+":"+location.port+"/submit",data:JSON.stringify({movieDbApiKey:a.movie_db_api_key,writeToFile:!0,searchFromPlex:!0,movieUrls:b}),contentType:"application/json",timeout:0,success:function(a){var b="";a.forEach(function(a){b+=buildMovieDiv(a)});searchTitle.text(a.length+" 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(!0)},error:function(a){disconnect();a&&(a=JSON.parse(a.responseText).message,Console.error(a));searchTitle.text("An error occurred...");searchDescription.text("");progressContainer.hide();backButton.text("restart");setCopyToClipboardEnabled(!1)}});showSearchStatus()}function buildMoviesDiv(a){var b="";a=$jscomp.makeIterator(a);for(var c=a.next();!c.done;c=a.next())b+=buildMovieDiv(c.value);return b}function buildMovieDiv(a){return"<div>"+buildMovie(a)+"</div>"}
function buildMovie(a){return a.name+" ("+a.year+") from '"+a.collection+"'"}function connect(){var a=new SockJS("/gs-guide-websocket");stompClient=Stomp.over(a);stompClient.connect({},function(a){stompClient.subscribe("/topic/currentSearchResults",function(a){a=JSON.parse(a.body);showSearchStatus(a);shouldDisconnect(a)})})}function disconnect(){null!==stompClient&&stompClient.disconnect();console.log("Disconnected")}
function shouldDisconnect(a){a&&a.searchedMovieCount&&a.totalMovieCount&&a.totalMovieCount===a.searchedMovieCount&&(disconnect(),$.ajax({type:"PUT",url:"http://"+location.hostname+":"+location.port+"/cancelSearch",contentType:"application/json"}))}
function showSearchStatus(a){if(a&&(a.searchedMovieCount||a.totalMovieCount||0!==a.totalMovieCount)){progressContainer.show();var b=Math.trunc(a.searchedMovieCount/a.totalMovieCount*100);searchPosition.html("<h5>"+a.searchedMovieCount+" of "+a.totalMovieCount+" movies searched. "+b+"% complete.</h5>");searchResults.html(buildMoviesDiv(a.moviesFound));$("#progressBar").css("width",b+"%")}else searchResults.html("")}
function encodeQueryData(a){var b=[],c;for(c in a)b.push(encodeURIComponent(c)+"="+encodeURIComponent(a[c]));return b.join("&")}function CopyToClipboard(a){if(document.selection){var b=document.body.createTextRange();b.moveToElementText(document.getElementById(a));b.select().createTextRange();document.execCommand("copy")}else window.getSelection&&(b=document.createRange(),b.selectNode(document.getElementById(a)),window.getSelection().addRange(b),document.execCommand("copy"))};
"use strict";let stompClient;let backButton;let copyToClipboard;let searchResults;let searchPosition;let progressContainer;let searchTitle;let searchDescription;document.addEventListener("DOMContentLoaded",function(){var elems=document.querySelectorAll(".modal");M.Modal.init(elems);searchResults=$("#searchResults");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(){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){let movieHtml="";movies.forEach(function(movie){movieHtml+=buildMovieDiv(movie)});searchTitle.text(movies.length+" 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(frame){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>");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")}}
+10 -1
View File
@@ -1,5 +1,14 @@
<!--
- Copyright 2019 Jason H House
-
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-->
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/html">
<html xmlns="http://www.w3.org/1999/html" lang="en">
<head>
<title>Gaps</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
@@ -1,3 +1,12 @@
<!--
- Copyright 2019 Jason H House
-
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-->
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/html" lang="en">
@@ -1,3 +1,12 @@
<!--
- Copyright 2019 Jason H House
-
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-->
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/html" lang="en">
@@ -1,3 +1,12 @@
<!--
- Copyright 2019 Jason H House
-
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-->
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/html" lang="en">