From faacc355e54e2ad4165dc41abe3fefe1e02f4aed Mon Sep 17 00:00:00 2001 From: Jason House Date: Sun, 19 Jul 2020 12:51:28 +0900 Subject: [PATCH] Auto stash before checking out "HEAD" --- Core/pom.xml | 4 +-- .../main/java/com/jasonhhouse/gaps/Movie.java | 25 ++++++++++++++++--- .../main/java/com/jasonhhouse/gaps/Pair.java | 2 +- .../java/com/jasonhhouse/gaps/Payload.java | 5 ++-- .../jasonhhouse/gaps/WebSecurityConfig.java | 2 -- .../controller/ConfigurationController.java | 23 ++++++++--------- .../gaps/controller/GapsController.java | 22 ++++++---------- .../gaps/controller/LibraryController.java | 9 +++---- .../gaps/controller/MislabeledController.java | 8 +++--- .../controller/PlexMovieListController.java | 6 ++--- .../gaps/controller/RSSController.java | 18 ++++++------- .../controller/RecommendedController.java | 16 ++++++------ .../gaps/controller/SearchController.java | 5 +--- .../gaps/service/GapsSearchService.java | 10 +++++++- .../gaps/service/MislabeledService.java | 1 - .../jasonhhouse/gaps/service/TmdbService.java | 2 +- Plex/pom.xml | 1 + pom.xml | 11 ++++++-- 18 files changed, 91 insertions(+), 79 deletions(-) diff --git a/Core/pom.xml b/Core/pom.xml index 9873bf0..94ca693 100755 --- a/Core/pom.xml +++ b/Core/pom.xml @@ -1,6 +1,6 @@ - Gaps diff --git a/Core/src/main/java/com/jasonhhouse/gaps/Movie.java b/Core/src/main/java/com/jasonhhouse/gaps/Movie.java index 45c3589..5d0dd67 100755 --- a/Core/src/main/java/com/jasonhhouse/gaps/Movie.java +++ b/Core/src/main/java/com/jasonhhouse/gaps/Movie.java @@ -14,7 +14,8 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.jasonhhouse.gaps.json.MovieDeserializer; import com.jasonhhouse.gaps.json.MovieSerializer; -import com.jasonhhouse.plex.Video; +import java.util.ArrayList; +import java.util.List; import java.util.Objects; import org.apache.commons.lang3.StringUtils; import org.jetbrains.annotations.NotNull; @@ -42,6 +43,8 @@ public final class Movie implements Comparable { public static final String OVERVIEW = "overview"; + public static final String MOVIES_IN_COLLECTION = "movies_in_collection"; + private final String name; private final Integer year; @@ -61,9 +64,11 @@ public final class Movie implements Comparable { private Integer collectionId; @NotNull private Integer tvdbId; + @NotNull + private final List moviesInCollection; private Movie(String name, Integer year, @Nullable String posterUrl, @Nullable String collection, @NotNull Integer collectionId, @NotNull Integer tvdbId, - @Nullable String imdbId, @Nullable String language, @Nullable String overview) { + @Nullable String imdbId, @Nullable String language, @Nullable String overview, @NotNull List moviesInCollection) { this.name = name; this.year = year; this.posterUrl = posterUrl; @@ -73,6 +78,7 @@ public final class Movie implements Comparable { this.imdbId = imdbId; this.language = language; this.overview = overview; + this.moviesInCollection = moviesInCollection; } public @NotNull Integer getCollectionId() { @@ -123,6 +129,11 @@ public final class Movie implements Comparable { return overview; } + @NotNull + public List getMoviesInCollection() { + return moviesInCollection; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -198,6 +209,8 @@ public final class Movie implements Comparable { private String overview; + private List moviesInCollection; + public Builder(String name, int year) { this.name = name; this.year = year; @@ -208,10 +221,11 @@ public final class Movie implements Comparable { this.collectionId = -1; this.language = "en"; this.overview = ""; + this.moviesInCollection = new ArrayList<>(); } public Movie build() { - return new Movie(name, year, posterUrl, collection, collectionId, tvdbId, imdbId, language, overview); + return new Movie(name, year, posterUrl, collection, collectionId, tvdbId, imdbId, language, overview, moviesInCollection); } public Builder setPosterUrl(String posterUrl) { @@ -248,5 +262,10 @@ public final class Movie implements Comparable { this.overview = overview; return this; } + + public Builder setMoviesInCollection(List moviesInCollection) { + this.moviesInCollection = moviesInCollection; + return this; + } } } diff --git a/Core/src/main/java/com/jasonhhouse/gaps/Pair.java b/Core/src/main/java/com/jasonhhouse/gaps/Pair.java index bca6b20..456956e 100755 --- a/Core/src/main/java/com/jasonhhouse/gaps/Pair.java +++ b/Core/src/main/java/com/jasonhhouse/gaps/Pair.java @@ -2,7 +2,7 @@ package com.jasonhhouse.gaps; import java.util.Objects; -public class Pair { +public class Pair { private final L left; private final R right; diff --git a/Core/src/main/java/com/jasonhhouse/gaps/Payload.java b/Core/src/main/java/com/jasonhhouse/gaps/Payload.java index 6506ec2..c3c66d2 100755 --- a/Core/src/main/java/com/jasonhhouse/gaps/Payload.java +++ b/Core/src/main/java/com/jasonhhouse/gaps/Payload.java @@ -2,7 +2,6 @@ package com.jasonhhouse.gaps; import com.fasterxml.jackson.annotation.JsonFormat; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; -import org.jetbrains.annotations.NotNull; @JsonFormat(shape = JsonFormat.Shape.OBJECT) public enum Payload { @@ -43,8 +42,8 @@ public enum Payload { } @SuppressFBWarnings( - value="ME_ENUM_FIELD_SETTER", - justification="I know what I'm doing") + value = "ME_ENUM_FIELD_SETTER", + justification = "I know what I'm doing") public Payload setExtras(Object extras) { this.extras = extras; return this; diff --git a/GapsWeb/src/main/java/com/jasonhhouse/gaps/WebSecurityConfig.java b/GapsWeb/src/main/java/com/jasonhhouse/gaps/WebSecurityConfig.java index 3c3a7be..c0a5941 100644 --- a/GapsWeb/src/main/java/com/jasonhhouse/gaps/WebSecurityConfig.java +++ b/GapsWeb/src/main/java/com/jasonhhouse/gaps/WebSecurityConfig.java @@ -29,8 +29,6 @@ import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.crypto.factory.PasswordEncoderFactories; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.provisioning.InMemoryUserDetailsManager; -import org.springframework.security.web.DefaultRedirectStrategy; -import org.springframework.security.web.RedirectStrategy; @Configuration @EnableWebSecurity diff --git a/GapsWeb/src/main/java/com/jasonhhouse/gaps/controller/ConfigurationController.java b/GapsWeb/src/main/java/com/jasonhhouse/gaps/controller/ConfigurationController.java index b3cfc0d..6b5c9a9 100755 --- a/GapsWeb/src/main/java/com/jasonhhouse/gaps/controller/ConfigurationController.java +++ b/GapsWeb/src/main/java/com/jasonhhouse/gaps/controller/ConfigurationController.java @@ -31,7 +31,11 @@ import org.springframework.http.ResponseEntity; import org.springframework.messaging.simp.SimpMessagingTemplate; import org.springframework.stereotype.Controller; import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; @@ -60,8 +64,7 @@ public class ConfigurationController { this.ioService = ioService; } - @RequestMapping(method = RequestMethod.GET, - produces = MediaType.TEXT_HTML_VALUE) + @GetMapping(produces = MediaType.TEXT_HTML_VALUE) public ModelAndView getConfiguration() { LOGGER.info("getConfiguration()"); @@ -80,8 +83,7 @@ public class ConfigurationController { return modelAndView; } - @RequestMapping(value = "/add/plex", - method = RequestMethod.POST, + @PostMapping(value = "/add/plex", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) @ResponseStatus(value = HttpStatus.OK) public void postAddPlexServer(@Valid final PlexServer plexServer, BindingResult bindingResult) { @@ -117,8 +119,7 @@ public class ConfigurationController { } } - @RequestMapping(value = "/test/plex", - method = RequestMethod.PUT, + @PutMapping(value = "/test/plex", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody @@ -139,8 +140,7 @@ public class ConfigurationController { return ResponseEntity.ok().body(payload); } - @RequestMapping(value = "/test/plex/{machineIdentifier}", - method = RequestMethod.PUT, + @PutMapping(value = "/test/plex/{machineIdentifier}", produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody public ResponseEntity putTestPlexServerByMachineId(@PathVariable("machineIdentifier") final String machineIdentifier) { @@ -168,8 +168,7 @@ public class ConfigurationController { } } - @RequestMapping(value = "/delete/plex/{machineIdentifier}", - method = RequestMethod.DELETE, + @DeleteMapping(value = "/delete/plex/{machineIdentifier}", produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody public ResponseEntity deletePlexServer(@PathVariable("machineIdentifier") final String machineIdentifier) { @@ -197,15 +196,13 @@ public class ConfigurationController { } } - @RequestMapping(value = "/test/tmdbKey/{tmdbKey}", - method = RequestMethod.PUT, + @PutMapping(value = "/test/tmdbKey/{tmdbKey}", produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody public ResponseEntity postTestTmdbKey(@PathVariable("tmdbKey") final String tmdbKey) { LOGGER.info("postTestTmdbKey( " + tmdbKey + " )"); Payload payload = tmdbService.testTmdbKey(tmdbKey).setExtras("tmdbKey:" + tmdbKey); - ; return ResponseEntity.ok().body(payload); } diff --git a/GapsWeb/src/main/java/com/jasonhhouse/gaps/controller/GapsController.java b/GapsWeb/src/main/java/com/jasonhhouse/gaps/controller/GapsController.java index eb1fc4a..3f50c6a 100755 --- a/GapsWeb/src/main/java/com/jasonhhouse/gaps/controller/GapsController.java +++ b/GapsWeb/src/main/java/com/jasonhhouse/gaps/controller/GapsController.java @@ -14,7 +14,6 @@ import com.jasonhhouse.gaps.Payload; import com.jasonhhouse.gaps.PlexSearch; import com.jasonhhouse.gaps.service.IoService; import java.io.IOException; - import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; @@ -23,8 +22,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.WebDataBinder; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.InitBinder; -import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; @@ -47,8 +47,7 @@ public class GapsController { } - @RequestMapping(method = RequestMethod.GET, - value = "/home", + @GetMapping(value = "/home", produces = MediaType.TEXT_HTML_VALUE) public ModelAndView getIndexOnClick() { LOGGER.info("getIndexOnClick()"); @@ -67,8 +66,7 @@ public class GapsController { return modelAndView; } - @RequestMapping(method = RequestMethod.GET, - produces = MediaType.TEXT_HTML_VALUE) + @GetMapping(produces = MediaType.TEXT_HTML_VALUE) public ModelAndView getIndex() { LOGGER.info("getIndex()"); @@ -82,19 +80,17 @@ public class GapsController { } //If configuration is filled in, jump to libraries page - if(plexSearch != null && StringUtils.isNotEmpty(plexSearch.getMovieDbApiKey()) && CollectionUtils.isNotEmpty(plexSearch.getPlexServers())) { + if (plexSearch != null && StringUtils.isNotEmpty(plexSearch.getMovieDbApiKey()) && CollectionUtils.isNotEmpty(plexSearch.getPlexServers())) { return new ModelAndView("redirect:/libraries"); } - ModelAndView modelAndView = new ModelAndView("index"); modelAndView.addObject("plexSearch", gapsService.getPlexSearch()); return modelAndView; } - @RequestMapping(method = RequestMethod.PUT, - value = "/nuke", + @PutMapping(value = "/nuke", produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody public ResponseEntity putNuke() { @@ -116,8 +112,7 @@ public class GapsController { return new ModelAndView("about"); } - @RequestMapping(method = RequestMethod.GET, - value = "/login", + @GetMapping(value = "/login", produces = MediaType.TEXT_HTML_VALUE) public ModelAndView getLogin() { LOGGER.info("getLogin()"); @@ -125,8 +120,7 @@ public class GapsController { return new ModelAndView("login"); } - @RequestMapping(method = RequestMethod.GET, - value = "/updates", + @GetMapping(value = "/updates", produces = MediaType.TEXT_HTML_VALUE) public ModelAndView getUpdates() { LOGGER.info("getUpdates()"); diff --git a/GapsWeb/src/main/java/com/jasonhhouse/gaps/controller/LibraryController.java b/GapsWeb/src/main/java/com/jasonhhouse/gaps/controller/LibraryController.java index d9f3e4c..a20c0a7 100755 --- a/GapsWeb/src/main/java/com/jasonhhouse/gaps/controller/LibraryController.java +++ b/GapsWeb/src/main/java/com/jasonhhouse/gaps/controller/LibraryController.java @@ -27,6 +27,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -34,7 +35,7 @@ import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.ModelAndView; -@RestController +@RestController(value = "/libraries") public class LibraryController { private static final Logger LOGGER = LoggerFactory.getLogger(LibraryController.class); @@ -54,8 +55,7 @@ public class LibraryController { } } - @RequestMapping(method = RequestMethod.GET, - path = "/libraries") + @GetMapping public ModelAndView getLibraries() { LOGGER.info("getLibraries()"); @@ -99,8 +99,7 @@ public class LibraryController { return modelAndView; } - @RequestMapping(method = RequestMethod.GET, - path = "/libraries/{machineIdentifier}/{key}") + @GetMapping(path = "{machineIdentifier}/{key}") @ResponseBody public ResponseEntity getLibraries(@PathVariable("machineIdentifier") final String machineIdentifier, @PathVariable("key") final Integer key) { LOGGER.info("getLibraries( " + machineIdentifier + ", " + key + " )"); diff --git a/GapsWeb/src/main/java/com/jasonhhouse/gaps/controller/MislabeledController.java b/GapsWeb/src/main/java/com/jasonhhouse/gaps/controller/MislabeledController.java index 5108a99..347e64b 100755 --- a/GapsWeb/src/main/java/com/jasonhhouse/gaps/controller/MislabeledController.java +++ b/GapsWeb/src/main/java/com/jasonhhouse/gaps/controller/MislabeledController.java @@ -11,7 +11,6 @@ package com.jasonhhouse.gaps.controller; import com.jasonhhouse.gaps.GapsService; import com.jasonhhouse.gaps.Mislabeled; -import com.jasonhhouse.gaps.Pair; import com.jasonhhouse.gaps.PlexQuery; import com.jasonhhouse.gaps.service.MislabeledService; import com.jasonhhouse.plex.MediaContainer; @@ -22,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -44,16 +44,14 @@ public class MislabeledController { this.mislabeledService = mislabeledService; } - @RequestMapping(method = RequestMethod.GET, - produces = MediaType.TEXT_HTML_VALUE) + @GetMapping(produces = MediaType.TEXT_HTML_VALUE) public ModelAndView getMislabeled() { LOGGER.info("getMislabeled()"); return new ModelAndView("mislabeled"); } - @RequestMapping(method = RequestMethod.GET, - value = "/{machineIdentifier}/{key}/{percentage}") + @GetMapping(value = "/{machineIdentifier}/{key}/{percentage}") @ResponseBody public ResponseEntity> getMisMatched(@PathVariable("machineIdentifier") final String machineIdentifier, @PathVariable("key") final Integer key, @PathVariable("percentage") final Double percentage) { diff --git a/GapsWeb/src/main/java/com/jasonhhouse/gaps/controller/PlexMovieListController.java b/GapsWeb/src/main/java/com/jasonhhouse/gaps/controller/PlexMovieListController.java index b576de7..f51d214 100755 --- a/GapsWeb/src/main/java/com/jasonhhouse/gaps/controller/PlexMovieListController.java +++ b/GapsWeb/src/main/java/com/jasonhhouse/gaps/controller/PlexMovieListController.java @@ -16,17 +16,16 @@ import com.jasonhhouse.gaps.MoviePair; import com.jasonhhouse.gaps.PlexLibrary; import com.jasonhhouse.gaps.PlexQuery; import com.jasonhhouse.gaps.service.IoService; -import com.jasonhhouse.plex.MediaContainer; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; -import org.apache.commons.collections4.CollectionUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -48,8 +47,7 @@ public class PlexMovieListController { this.plexQuery = plexQuery; } - @RequestMapping(method = RequestMethod.GET, - value = "/movies/{machineIdentifier}/{key}") + @GetMapping(value = "/movies/{machineIdentifier}/{key}") @ResponseBody public ResponseEntity> getPlexMovies(@PathVariable("machineIdentifier") final String machineIdentifier, @PathVariable("key") final Integer key) { LOGGER.info("getPlexMovies( " + machineIdentifier + ", " + key + " )"); diff --git a/GapsWeb/src/main/java/com/jasonhhouse/gaps/controller/RSSController.java b/GapsWeb/src/main/java/com/jasonhhouse/gaps/controller/RSSController.java index 5fb306f..ef14125 100755 --- a/GapsWeb/src/main/java/com/jasonhhouse/gaps/controller/RSSController.java +++ b/GapsWeb/src/main/java/com/jasonhhouse/gaps/controller/RSSController.java @@ -15,17 +15,19 @@ import com.jasonhhouse.gaps.PlexLibrary; import com.jasonhhouse.gaps.PlexServer; import com.jasonhhouse.gaps.service.IoService; import com.jasonhhouse.gaps.service.RssService; -import org.apache.commons.collections4.CollectionUtils; +import java.util.Map; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.ModelAndView; -import java.util.Map; - @RestController public class RSSController { @@ -42,10 +44,9 @@ public class RSSController { this.gapsService = gapsService; } - @RequestMapping(method = RequestMethod.GET, - path = "/rss/{machineIdentifier}/{libraryKey}") + @GetMapping(path = "/rss/{machineIdentifier}/{libraryKey}") public String getRss(@PathVariable("machineIdentifier") String machineIdentifier, @PathVariable("libraryKey") Integer libraryKey) { - LOGGER.info("getRss( " + machineIdentifier + ", " + libraryKey + " )"); + LOGGER.info("getRss( " + machineIdentifier + ", " + libraryKey + " )"); String rss = null; if (ioService.doesRssFileExist(machineIdentifier, libraryKey)) { @@ -63,8 +64,7 @@ public class RSSController { } } - @RequestMapping(method = RequestMethod.GET, - path = "/rssCheck") + @GetMapping(path = "/rssCheck") public ModelAndView getRssCheck() { LOGGER.info("getRssCheck()"); diff --git a/GapsWeb/src/main/java/com/jasonhhouse/gaps/controller/RecommendedController.java b/GapsWeb/src/main/java/com/jasonhhouse/gaps/controller/RecommendedController.java index 825992d..f282a95 100755 --- a/GapsWeb/src/main/java/com/jasonhhouse/gaps/controller/RecommendedController.java +++ b/GapsWeb/src/main/java/com/jasonhhouse/gaps/controller/RecommendedController.java @@ -31,15 +31,15 @@ import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.messaging.handler.annotation.DestinationVariable; import org.springframework.messaging.handler.annotation.MessageMapping; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.ModelAndView; -@RestController +@RestController(value = "/recommended") public class RecommendedController { private static final Logger LOGGER = LoggerFactory.getLogger(RecommendedController.class); @@ -55,7 +55,7 @@ public class RecommendedController { this.gapsSearch = gapsSearch; } - @RequestMapping(method = RequestMethod.GET, path = "/recommended") + @GetMapping public ModelAndView getRecommended() { LOGGER.info("getRecommended()"); @@ -81,8 +81,7 @@ public class RecommendedController { } - @RequestMapping(method = RequestMethod.GET, - path = "/recommended/{machineIdentifier}/{key}") + @GetMapping(path = "{machineIdentifier}/{key}") @ResponseBody public ResponseEntity getRecommended(@PathVariable("machineIdentifier") final String machineIdentifier, @PathVariable("key") final Integer key) { LOGGER.info("getRecommended( " + machineIdentifier + ", " + key + " )"); @@ -133,8 +132,7 @@ public class RecommendedController { * @param machineIdentifier plex server id * @param key plex library key */ - @RequestMapping(value = "/recommended/find/{machineIdentifier}/{key}", - method = RequestMethod.PUT) + @PutMapping(value = "/find/{machineIdentifier}/{key}") @ResponseStatus(value = HttpStatus.OK) public void putFindRecommencedMovies(@PathVariable("machineIdentifier") final String machineIdentifier, @PathVariable("key") final Integer key) { LOGGER.info("putFindRecommencedMovies( " + machineIdentifier + ", " + key + " )"); @@ -148,7 +146,7 @@ public class RecommendedController { * @param machineIdentifier plex server id * @param key plex library key */ - @MessageMapping("/recommended/cancel/{machineIdentifier}/{key}") + @MessageMapping("/cancel/{machineIdentifier}/{key}") public void cancelSearching(@DestinationVariable final String machineIdentifier, @DestinationVariable final Integer key) { LOGGER.info("cancelSearching( " + machineIdentifier + ", " + key + " )"); gapsSearch.cancelSearch(); diff --git a/GapsWeb/src/main/java/com/jasonhhouse/gaps/controller/SearchController.java b/GapsWeb/src/main/java/com/jasonhhouse/gaps/controller/SearchController.java index da406c6..20ef2b4 100755 --- a/GapsWeb/src/main/java/com/jasonhhouse/gaps/controller/SearchController.java +++ b/GapsWeb/src/main/java/com/jasonhhouse/gaps/controller/SearchController.java @@ -28,12 +28,9 @@ public class SearchController { private final GapsSearch gapsSearch; - private final IoService ioService; - @Autowired - SearchController(GapsSearch gapsSearch, IoService ioService) { + SearchController(GapsSearch gapsSearch) { this.gapsSearch = gapsSearch; - this.ioService = ioService; } @MessageMapping("/cancelSearching") diff --git a/GapsWeb/src/main/java/com/jasonhhouse/gaps/service/GapsSearchService.java b/GapsWeb/src/main/java/com/jasonhhouse/gaps/service/GapsSearchService.java index 26e529f..b823051 100755 --- a/GapsWeb/src/main/java/com/jasonhhouse/gaps/service/GapsSearchService.java +++ b/GapsWeb/src/main/java/com/jasonhhouse/gaps/service/GapsSearchService.java @@ -170,7 +170,7 @@ public class GapsSearchService implements GapsSearch { * optimize some network calls, we add movies found in a collection and in plex to our already searched list, so we * don't re-query collections again and again. */ - @SuppressFBWarnings(value="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE") + @SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE") private void searchForMovies(String machineIdentifier, Integer key, Set ownedMovies, List everyMovie, Set recommended, Set searched, AtomicInteger searchedMovieCount) throws SearchCancelledException, IOException { LOGGER.info("searchForMovies()"); @@ -413,6 +413,12 @@ public class GapsSearchService implements GapsSearch { int indexOfMovie = everyMovie.indexOf(movie); + List moviesInCollection = new ArrayList<>(); + if (collection.has("parts")) { + JsonNode parts = collection.get("parts"); + parts.iterator().forEachRemaining(jsonNode -> moviesInCollection.add(jsonNode.get("original_title").toString())); + } + if (collection.has("status_code") && collection.get("status_code").asInt() == 34) { LOGGER.warn(collection.get("status_message").asText()); return; @@ -423,6 +429,7 @@ public class GapsSearchService implements GapsSearch { everyMovie.get(indexOfMovie).setCollection(name); movie.setCollection(name); movie.setCollectionId(id); + movie.getMoviesInCollection().addAll(moviesInCollection); } else { int id = collection.get("id").asInt(); String name = collection.get("name").asText(); @@ -431,6 +438,7 @@ public class GapsSearchService implements GapsSearch { .setImdbId(movie.getImdbId()) .setCollection(name) .setCollectionId(id) + .setMoviesInCollection(moviesInCollection) .build(); everyMovie.add(newMovie); diff --git a/GapsWeb/src/main/java/com/jasonhhouse/gaps/service/MislabeledService.java b/GapsWeb/src/main/java/com/jasonhhouse/gaps/service/MislabeledService.java index c5d5cea..c993a25 100755 --- a/GapsWeb/src/main/java/com/jasonhhouse/gaps/service/MislabeledService.java +++ b/GapsWeb/src/main/java/com/jasonhhouse/gaps/service/MislabeledService.java @@ -10,7 +10,6 @@ package com.jasonhhouse.gaps.service; import com.jasonhhouse.gaps.Mislabeled; -import com.jasonhhouse.gaps.Pair; import com.jasonhhouse.plex.MediaContainer; import com.jasonhhouse.plex.Video; import java.util.ArrayList; diff --git a/GapsWeb/src/main/java/com/jasonhhouse/gaps/service/TmdbService.java b/GapsWeb/src/main/java/com/jasonhhouse/gaps/service/TmdbService.java index 07bbc21..20ad8f5 100755 --- a/GapsWeb/src/main/java/com/jasonhhouse/gaps/service/TmdbService.java +++ b/GapsWeb/src/main/java/com/jasonhhouse/gaps/service/TmdbService.java @@ -53,7 +53,7 @@ public class TmdbService { try (Response response = client.newCall(request).execute()) { ResponseBody responseBody = response.body(); - if(responseBody == null) { + if (responseBody == null) { LOGGER.warn("Empty response body"); return Payload.TMDB_KEY_INVALID.setExtras(key); } diff --git a/Plex/pom.xml b/Plex/pom.xml index cb27952..a558954 100755 --- a/Plex/pom.xml +++ b/Plex/pom.xml @@ -65,4 +65,5 @@ + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 5717753..e12b25a 100755 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ org.springframework.boot spring-boot-starter-parent - 2.3.0.RELEASE + 2.3.1.RELEASE com.jasonhhouse @@ -102,11 +102,18 @@ com.github.spotbugs spotbugs - 4.0.3 + 4.0.6 + + + github + GitHub OWNER Apache Maven Packages + https://maven.pkg.github.com/JasonHHouse/gaps + +