mirror of
https://github.com/JasonHHouse/gaps.git
synced 2026-05-11 20:10:38 -05:00
Auto stash before checking out "HEAD"
This commit is contained in:
+2
-2
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>Gaps</artifactId>
|
||||
|
||||
@@ -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<Movie> {
|
||||
|
||||
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<Movie> {
|
||||
private Integer collectionId;
|
||||
@NotNull
|
||||
private Integer tvdbId;
|
||||
@NotNull
|
||||
private final List<String> 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<String> moviesInCollection) {
|
||||
this.name = name;
|
||||
this.year = year;
|
||||
this.posterUrl = posterUrl;
|
||||
@@ -73,6 +78,7 @@ public final class Movie implements Comparable<Movie> {
|
||||
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<Movie> {
|
||||
return overview;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<String> getMoviesInCollection() {
|
||||
return moviesInCollection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
@@ -198,6 +209,8 @@ public final class Movie implements Comparable<Movie> {
|
||||
|
||||
private String overview;
|
||||
|
||||
private List<String> moviesInCollection;
|
||||
|
||||
public Builder(String name, int year) {
|
||||
this.name = name;
|
||||
this.year = year;
|
||||
@@ -208,10 +221,11 @@ public final class Movie implements Comparable<Movie> {
|
||||
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<Movie> {
|
||||
this.overview = overview;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setMoviesInCollection(List<String> moviesInCollection) {
|
||||
this.moviesInCollection = moviesInCollection;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.jasonhhouse.gaps;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class Pair<L,R> {
|
||||
public class Pair<L, R> {
|
||||
private final L left;
|
||||
private final R right;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
+10
-13
@@ -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<String> 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<String> 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<Payload> postTestTmdbKey(@PathVariable("tmdbKey") final String tmdbKey) {
|
||||
LOGGER.info("postTestTmdbKey( " + tmdbKey + " )");
|
||||
|
||||
Payload payload = tmdbService.testTmdbKey(tmdbKey).setExtras("tmdbKey:" + tmdbKey);
|
||||
;
|
||||
return ResponseEntity.ok().body(payload);
|
||||
}
|
||||
|
||||
|
||||
@@ -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<Payload> 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()");
|
||||
|
||||
@@ -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<Payload> getLibraries(@PathVariable("machineIdentifier") final String machineIdentifier, @PathVariable("key") final Integer key) {
|
||||
LOGGER.info("getLibraries( " + machineIdentifier + ", " + key + " )");
|
||||
|
||||
@@ -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<List<Mislabeled>> getMisMatched(@PathVariable("machineIdentifier") final String machineIdentifier, @PathVariable("key") final Integer key,
|
||||
@PathVariable("percentage") final Double percentage) {
|
||||
|
||||
@@ -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<List<Movie>> getPlexMovies(@PathVariable("machineIdentifier") final String machineIdentifier, @PathVariable("key") final Integer key) {
|
||||
LOGGER.info("getPlexMovies( " + machineIdentifier + ", " + key + " )");
|
||||
|
||||
@@ -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()");
|
||||
|
||||
|
||||
@@ -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<Payload> 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();
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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<Movie> ownedMovies, List<Movie> everyMovie, Set<Movie> recommended, Set<Movie> searched,
|
||||
AtomicInteger searchedMovieCount) throws SearchCancelledException, IOException {
|
||||
LOGGER.info("searchForMovies()");
|
||||
@@ -413,6 +413,12 @@ public class GapsSearchService implements GapsSearch {
|
||||
|
||||
int indexOfMovie = everyMovie.indexOf(movie);
|
||||
|
||||
List<String> 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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -65,4 +65,5 @@
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -11,7 +11,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.3.0.RELEASE</version>
|
||||
<version>2.3.1.RELEASE</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>com.jasonhhouse</groupId>
|
||||
@@ -102,11 +102,18 @@
|
||||
<dependency>
|
||||
<groupId>com.github.spotbugs</groupId>
|
||||
<artifactId>spotbugs</artifactId>
|
||||
<version>4.0.3</version>
|
||||
<version>4.0.6</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>github</id>
|
||||
<name>GitHub OWNER Apache Maven Packages</name>
|
||||
<url>https://maven.pkg.github.com/JasonHHouse/gaps</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
</project>
|
||||
|
||||
Reference in New Issue
Block a user