mirror of
https://github.com/JasonHHouse/gaps.git
synced 2026-02-22 12:28:26 -06:00
PlexSearch to PlexProperties
This commit is contained in:
@@ -21,7 +21,7 @@ public interface GapsService {
|
||||
/**
|
||||
* @return Returns the PlexSearch instance as a singleton
|
||||
*/
|
||||
PlexSearch getPlexSearch();
|
||||
PlexProperties getPlexSearch();
|
||||
|
||||
/**
|
||||
* Updates PlexLibrary's to add them if not added and set them selected or unselected if added
|
||||
@@ -33,9 +33,9 @@ public interface GapsService {
|
||||
/**
|
||||
* Updates the plex search object itself to the singleton object
|
||||
*
|
||||
* @param plexSearch The object to copy into the plex search singleton
|
||||
* @param plexProperties The object to copy into the plex search singleton
|
||||
*/
|
||||
void updatePlexSearch(PlexSearch plexSearch);
|
||||
void updatePlexSearch(PlexProperties plexProperties);
|
||||
|
||||
/**
|
||||
* Resets the plex search object itself to the singleton object
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public final class PlexSearch {
|
||||
public final class PlexProperties {
|
||||
|
||||
public static final String MOVIE_DB_API_KEY = "movieDbApiKey";
|
||||
public static final String VERSION_KEY = "version";
|
||||
@@ -30,7 +30,7 @@ public final class PlexSearch {
|
||||
@NotNull
|
||||
private Schedule schedule;
|
||||
|
||||
public PlexSearch() {
|
||||
public PlexProperties() {
|
||||
plexServers = new HashSet<>();
|
||||
schedule = Schedule.DAILY_4AM;
|
||||
}
|
||||
@@ -19,17 +19,17 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.format.Formatter;
|
||||
|
||||
public class PlexSearchFormatter implements Formatter<PlexSearch> {
|
||||
public class PlexSearchFormatter implements Formatter<PlexProperties> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(PlexSearchFormatter.class);
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public PlexSearch parse(@NotNull String text, @NotNull Locale locale) throws ParseException {
|
||||
public PlexProperties parse(@NotNull String text, @NotNull Locale locale) throws ParseException {
|
||||
LOGGER.info("parse( {}, {} )", text, locale);
|
||||
try {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
return objectMapper.readValue(text, PlexSearch.class);
|
||||
return objectMapper.readValue(text, PlexProperties.class);
|
||||
} catch (JsonProcessingException e) {
|
||||
LOGGER.error("Error parsing player.", e);
|
||||
throw new ParseException("Error parsing player.", 0);
|
||||
@@ -38,12 +38,12 @@ public class PlexSearchFormatter implements Formatter<PlexSearch> {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String print(@NotNull PlexSearch plexSearch, @NotNull Locale locale) {
|
||||
LOGGER.info("print( {}, {} )", plexSearch, locale);
|
||||
public String print(@NotNull PlexProperties plexProperties, @NotNull Locale locale) {
|
||||
LOGGER.info("print( {}, {} )", plexProperties, locale);
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
try {
|
||||
return mapper.writeValueAsString(plexSearch);
|
||||
return mapper.writeValueAsString(plexProperties);
|
||||
} catch (JsonProcessingException e) {
|
||||
LOGGER.error("Error converting room id and issue id to JSON", e);
|
||||
return "";
|
||||
|
||||
@@ -106,28 +106,28 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
LOGGER.info("userDetailsService()");
|
||||
if (Boolean.TRUE.equals(myConfig.getLoginEnabled())) {
|
||||
|
||||
PlexSearch plexSearch = null;
|
||||
PlexProperties plexProperties = null;
|
||||
try {
|
||||
plexSearch = ioService.readProperties();
|
||||
plexProperties = ioService.readProperties();
|
||||
} catch (IOException e) {
|
||||
LOGGER.warn("No properties found to get password. Generating new password");
|
||||
}
|
||||
|
||||
String password;
|
||||
if (plexSearch == null || StringUtils.isEmpty(plexSearch.getPassword())) {
|
||||
if (plexProperties == null || StringUtils.isEmpty(plexProperties.getPassword())) {
|
||||
password = UUID.randomUUID().toString();
|
||||
plexSearch = new PlexSearch();
|
||||
plexSearch.setPassword(password);
|
||||
plexProperties = new PlexProperties();
|
||||
plexProperties.setPassword(password);
|
||||
LOGGER.info("Gaps Password: {}", password);
|
||||
try {
|
||||
ioService.writeProperties(plexSearch);
|
||||
gapsService.updatePlexSearch(plexSearch);
|
||||
ioService.writeProperties(plexProperties);
|
||||
gapsService.updatePlexSearch(plexProperties);
|
||||
} catch (IOException e) {
|
||||
LOGGER.error("Failed to write out password to properties file.");
|
||||
}
|
||||
} else {
|
||||
LOGGER.info("Using password from /usr/data/gaps.properties");
|
||||
password = plexSearch.getPassword();
|
||||
password = plexProperties.getPassword();
|
||||
}
|
||||
|
||||
PasswordEncoder encoder = PasswordEncoderFactories.createDelegatingPasswordEncoder();
|
||||
|
||||
@@ -13,7 +13,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import com.jasonhhouse.gaps.GapsService;
|
||||
import com.jasonhhouse.gaps.Payload;
|
||||
import com.jasonhhouse.gaps.PlexSearch;
|
||||
import com.jasonhhouse.gaps.PlexProperties;
|
||||
import com.jasonhhouse.gaps.PlexServer;
|
||||
import com.jasonhhouse.gaps.service.IoService;
|
||||
import com.jasonhhouse.gaps.service.PlexQueryImpl;
|
||||
@@ -73,8 +73,8 @@ public class ConfigurationController {
|
||||
LOGGER.info("getConfiguration()");
|
||||
|
||||
try {
|
||||
PlexSearch plexSearch = ioService.readProperties();
|
||||
gapsService.updatePlexSearch(plexSearch);
|
||||
PlexProperties plexProperties = ioService.readProperties();
|
||||
gapsService.updatePlexSearch(plexProperties);
|
||||
|
||||
List<PlexServer> plexServers = ioService.readPlexConfiguration();
|
||||
gapsService.getPlexSearch().getPlexServers().addAll(plexServers);
|
||||
@@ -95,8 +95,8 @@ public class ConfigurationController {
|
||||
LOGGER.info("postAddPlexServer( {} )", plexServer);
|
||||
|
||||
try {
|
||||
PlexSearch plexSearch = ioService.readProperties();
|
||||
gapsService.updatePlexSearch(plexSearch);
|
||||
PlexProperties plexProperties = ioService.readProperties();
|
||||
gapsService.updatePlexSearch(plexProperties);
|
||||
|
||||
plexQuery.queryPlexServer(plexServer);
|
||||
Payload payload = plexQuery.getLibraries(plexServer);
|
||||
@@ -143,8 +143,8 @@ public class ConfigurationController {
|
||||
LOGGER.info("putTestPlexServerByMachineId( {} )", machineIdentifier);
|
||||
|
||||
try {
|
||||
PlexSearch plexSearch = ioService.readProperties();
|
||||
gapsService.updatePlexSearch(plexSearch);
|
||||
PlexProperties plexProperties = ioService.readProperties();
|
||||
gapsService.updatePlexSearch(plexProperties);
|
||||
|
||||
ObjectNode objectNode = objectMapper.createObjectNode();
|
||||
PlexServer returnedPlexServer = gapsService.getPlexSearch().getPlexServers().stream().filter(plexServer -> plexServer.getMachineIdentifier().equals(machineIdentifier)).findFirst().orElse(new PlexServer());
|
||||
@@ -171,8 +171,8 @@ public class ConfigurationController {
|
||||
LOGGER.info("deletePlexServer( {} )", machineIdentifier);
|
||||
|
||||
try {
|
||||
PlexSearch plexSearch = ioService.readProperties();
|
||||
gapsService.updatePlexSearch(plexSearch);
|
||||
PlexProperties plexProperties = ioService.readProperties();
|
||||
gapsService.updatePlexSearch(plexProperties);
|
||||
|
||||
ObjectNode objectNode = objectMapper.createObjectNode();
|
||||
PlexServer returnedPlexServer = gapsService.getPlexSearch().getPlexServers().stream().filter(plexServer -> plexServer.getMachineIdentifier().equals(machineIdentifier)).findFirst().orElse(new PlexServer());
|
||||
@@ -210,8 +210,8 @@ public class ConfigurationController {
|
||||
|
||||
Payload payload;
|
||||
try {
|
||||
PlexSearch plexSearch = ioService.readProperties();
|
||||
gapsService.updatePlexSearch(plexSearch);
|
||||
PlexProperties plexProperties = ioService.readProperties();
|
||||
gapsService.updatePlexSearch(plexProperties);
|
||||
gapsService.getPlexSearch().setMovieDbApiKey(tmdbKey);
|
||||
|
||||
ioService.writeProperties(gapsService.getPlexSearch());
|
||||
|
||||
@@ -11,7 +11,7 @@ package com.jasonhhouse.gaps.controller;
|
||||
|
||||
import com.jasonhhouse.gaps.GapsService;
|
||||
import com.jasonhhouse.gaps.Payload;
|
||||
import com.jasonhhouse.gaps.PlexSearch;
|
||||
import com.jasonhhouse.gaps.PlexProperties;
|
||||
import com.jasonhhouse.gaps.service.IoService;
|
||||
import java.io.IOException;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
@@ -51,11 +51,11 @@ public class GapsController {
|
||||
public ModelAndView getIndexOnClick() {
|
||||
LOGGER.info("getIndexOnClick()");
|
||||
|
||||
PlexSearch plexSearch = null;
|
||||
PlexProperties plexProperties = null;
|
||||
try {
|
||||
plexSearch = ioService.readProperties();
|
||||
plexSearch.getPlexServers().addAll(ioService.readPlexConfiguration());
|
||||
gapsService.updatePlexSearch(plexSearch);
|
||||
plexProperties = ioService.readProperties();
|
||||
plexProperties.getPlexServers().addAll(ioService.readPlexConfiguration());
|
||||
gapsService.updatePlexSearch(plexProperties);
|
||||
} catch (IOException e) {
|
||||
LOGGER.warn("Failed to read gaps properties.", e);
|
||||
}
|
||||
@@ -69,17 +69,17 @@ public class GapsController {
|
||||
public ModelAndView getIndex() {
|
||||
LOGGER.info("getIndex()");
|
||||
|
||||
PlexSearch plexSearch = null;
|
||||
PlexProperties plexProperties = null;
|
||||
try {
|
||||
plexSearch = ioService.readProperties();
|
||||
plexSearch.getPlexServers().addAll(ioService.readPlexConfiguration());
|
||||
gapsService.updatePlexSearch(plexSearch);
|
||||
plexProperties = ioService.readProperties();
|
||||
plexProperties.getPlexServers().addAll(ioService.readPlexConfiguration());
|
||||
gapsService.updatePlexSearch(plexProperties);
|
||||
} catch (IOException e) {
|
||||
LOGGER.warn("Failed to read gaps properties.", e);
|
||||
}
|
||||
|
||||
//If configuration is filled in, jump to libraries page
|
||||
if (plexSearch != null && StringUtils.isNotEmpty(plexSearch.getMovieDbApiKey()) && CollectionUtils.isNotEmpty(plexSearch.getPlexServers())) {
|
||||
if (plexProperties != null && StringUtils.isNotEmpty(plexProperties.getMovieDbApiKey()) && CollectionUtils.isNotEmpty(plexProperties.getPlexServers())) {
|
||||
return new ModelAndView("redirect:/libraries");
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import com.jasonhhouse.gaps.GapsService;
|
||||
import com.jasonhhouse.gaps.Movie;
|
||||
import com.jasonhhouse.gaps.Payload;
|
||||
import com.jasonhhouse.gaps.PlexLibrary;
|
||||
import com.jasonhhouse.gaps.PlexSearch;
|
||||
import com.jasonhhouse.gaps.PlexProperties;
|
||||
import com.jasonhhouse.gaps.PlexServer;
|
||||
import com.jasonhhouse.gaps.service.IoService;
|
||||
import java.io.IOException;
|
||||
@@ -78,8 +78,8 @@ public class LibraryController {
|
||||
|
||||
if (StringUtils.isEmpty(gapsService.getPlexSearch().getMovieDbApiKey())) {
|
||||
try {
|
||||
PlexSearch plexSearch = ioService.readProperties();
|
||||
gapsService.updatePlexSearch(plexSearch);
|
||||
PlexProperties plexProperties = ioService.readProperties();
|
||||
gapsService.updatePlexSearch(plexProperties);
|
||||
|
||||
if (StringUtils.isEmpty(gapsService.getPlexSearch().getMovieDbApiKey())) {
|
||||
LOGGER.warn("No owned movies found.");
|
||||
|
||||
@@ -12,7 +12,7 @@ package com.jasonhhouse.gaps.service;
|
||||
|
||||
import com.jasonhhouse.gaps.GapsService;
|
||||
import com.jasonhhouse.gaps.PlexLibrary;
|
||||
import com.jasonhhouse.gaps.PlexSearch;
|
||||
import com.jasonhhouse.gaps.PlexProperties;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -28,15 +28,15 @@ public class GapsServiceImpl implements GapsService {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(GapsServiceImpl.class);
|
||||
|
||||
@NotNull
|
||||
private final PlexSearch plexSearch;
|
||||
private final PlexProperties plexProperties;
|
||||
|
||||
public GapsServiceImpl() {
|
||||
this.plexSearch = new PlexSearch();
|
||||
this.plexProperties = new PlexProperties();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull PlexSearch getPlexSearch() {
|
||||
return plexSearch;
|
||||
public @NotNull PlexProperties getPlexSearch() {
|
||||
return plexProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -62,25 +62,25 @@ public class GapsServiceImpl implements GapsService {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GapsServiceImpl{" +
|
||||
"plexSearch=" + plexSearch +
|
||||
"plexSearch=" + plexProperties +
|
||||
'}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePlexSearch(PlexSearch plexSearch) {
|
||||
LOGGER.info("updatePlexSearch( {} )", plexSearch);
|
||||
if (StringUtils.isNotEmpty(plexSearch.getMovieDbApiKey())) {
|
||||
this.plexSearch.setMovieDbApiKey(plexSearch.getMovieDbApiKey());
|
||||
public void updatePlexSearch(PlexProperties plexProperties) {
|
||||
LOGGER.info("updatePlexSearch( {} )", plexProperties);
|
||||
if (StringUtils.isNotEmpty(plexProperties.getMovieDbApiKey())) {
|
||||
this.plexProperties.setMovieDbApiKey(plexProperties.getMovieDbApiKey());
|
||||
}
|
||||
|
||||
if (StringUtils.isNotEmpty(plexSearch.getPassword())) {
|
||||
this.plexSearch.setPassword(plexSearch.getPassword());
|
||||
if (StringUtils.isNotEmpty(plexProperties.getPassword())) {
|
||||
this.plexProperties.setPassword(plexProperties.getPassword());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void nukePlexSearch() {
|
||||
plexSearch.setMovieDbApiKey("");
|
||||
plexSearch.getPlexServers().clear();
|
||||
plexProperties.setMovieDbApiKey("");
|
||||
plexProperties.getPlexServers().clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.jasonhhouse.gaps.Movie;
|
||||
import com.jasonhhouse.gaps.Payload;
|
||||
import com.jasonhhouse.gaps.PlexSearch;
|
||||
import com.jasonhhouse.gaps.PlexProperties;
|
||||
import com.jasonhhouse.gaps.PlexServer;
|
||||
import com.jasonhhouse.gaps.Rss;
|
||||
import com.jasonhhouse.gaps.Schedule;
|
||||
@@ -355,20 +355,20 @@ public class IoService {
|
||||
return everyMovie;
|
||||
}
|
||||
|
||||
public void writeProperties(PlexSearch plexSearch) throws IOException {
|
||||
LOGGER.info("writeProperties( {} )", plexSearch);
|
||||
public void writeProperties(PlexProperties plexProperties) throws IOException {
|
||||
LOGGER.info("writeProperties( {} )", plexProperties);
|
||||
Properties properties = new Properties();
|
||||
|
||||
if (StringUtils.isNotEmpty(plexSearch.getMovieDbApiKey())) {
|
||||
properties.setProperty(PlexSearch.MOVIE_DB_API_KEY, plexSearch.getMovieDbApiKey());
|
||||
if (StringUtils.isNotEmpty(plexProperties.getMovieDbApiKey())) {
|
||||
properties.setProperty(PlexProperties.MOVIE_DB_API_KEY, plexProperties.getMovieDbApiKey());
|
||||
}
|
||||
|
||||
properties.setProperty(PlexSearch.VERSION_KEY, yamlConfig.getVersion());
|
||||
properties.setProperty(PlexSearch.USERNAME_KEY, PlexSearch.USERNAME_VALUE);
|
||||
properties.setProperty(PlexSearch.SCHEDULE, plexSearch.getSchedule().getId().toString());
|
||||
properties.setProperty(PlexProperties.VERSION_KEY, yamlConfig.getVersion());
|
||||
properties.setProperty(PlexProperties.USERNAME_KEY, PlexProperties.USERNAME_VALUE);
|
||||
properties.setProperty(PlexProperties.SCHEDULE, plexProperties.getSchedule().getId().toString());
|
||||
|
||||
if (StringUtils.isNotEmpty(plexSearch.getPassword())) {
|
||||
properties.setProperty(PlexSearch.PASSWORD, plexSearch.getPassword());
|
||||
if (StringUtils.isNotEmpty(plexProperties.getPassword())) {
|
||||
properties.setProperty(PlexProperties.PASSWORD, plexProperties.getPassword());
|
||||
}
|
||||
|
||||
try (FileOutputStream fileOutputStream = new FileOutputStream(storageFolder + PROPERTIES)) {
|
||||
@@ -385,10 +385,10 @@ public class IoService {
|
||||
|
||||
}
|
||||
|
||||
public PlexSearch readProperties() throws IOException {
|
||||
public PlexProperties readProperties() throws IOException {
|
||||
LOGGER.info("readProperties()");
|
||||
File file = new File(storageFolder + PROPERTIES);
|
||||
PlexSearch plexSearch = new PlexSearch();
|
||||
PlexProperties plexProperties = new PlexProperties();
|
||||
|
||||
LOGGER.info("Can Read {}:{}", file, file.canRead());
|
||||
LOGGER.info("Can Write {}:{}", file, file.canWrite());
|
||||
@@ -399,32 +399,32 @@ public class IoService {
|
||||
try (InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, StandardCharsets.UTF_8)) {
|
||||
properties.load(inputStreamReader);
|
||||
|
||||
if (properties.containsKey(PlexSearch.MOVIE_DB_API_KEY)) {
|
||||
String movieDbApiKey = properties.getProperty(PlexSearch.MOVIE_DB_API_KEY);
|
||||
plexSearch.setMovieDbApiKey(movieDbApiKey);
|
||||
if (properties.containsKey(PlexProperties.MOVIE_DB_API_KEY)) {
|
||||
String movieDbApiKey = properties.getProperty(PlexProperties.MOVIE_DB_API_KEY);
|
||||
plexProperties.setMovieDbApiKey(movieDbApiKey);
|
||||
}
|
||||
|
||||
if (properties.containsKey(PlexSearch.PASSWORD)) {
|
||||
String password = properties.getProperty(PlexSearch.PASSWORD);
|
||||
plexSearch.setPassword(password);
|
||||
if (properties.containsKey(PlexProperties.PASSWORD)) {
|
||||
String password = properties.getProperty(PlexProperties.PASSWORD);
|
||||
plexProperties.setPassword(password);
|
||||
}
|
||||
|
||||
if (properties.containsKey(PlexSearch.SCHEDULE)) {
|
||||
String strSchedule = properties.getProperty(PlexSearch.SCHEDULE);
|
||||
if (properties.containsKey(PlexProperties.SCHEDULE)) {
|
||||
String strSchedule = properties.getProperty(PlexProperties.SCHEDULE);
|
||||
Integer intSchedule = Integer.valueOf(strSchedule);
|
||||
Schedule schedule = Schedule.getSchedule(intSchedule);
|
||||
plexSearch.setSchedule(schedule);
|
||||
plexProperties.setSchedule(schedule);
|
||||
}
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
LOGGER.warn("{} does not exist", file);
|
||||
return plexSearch;
|
||||
return plexProperties;
|
||||
} catch (IOException e) {
|
||||
LOGGER.warn("{} failed to parse", file);
|
||||
return plexSearch;
|
||||
return plexProperties;
|
||||
}
|
||||
LOGGER.info("plexSearch: {}", plexSearch);
|
||||
return plexSearch;
|
||||
LOGGER.info("plexSearch: {}", plexProperties);
|
||||
return plexProperties;
|
||||
}
|
||||
|
||||
public Payload nuke() {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
package com.jasonhhouse.gaps.validator;
|
||||
|
||||
import com.jasonhhouse.gaps.PlexSearch;
|
||||
import com.jasonhhouse.gaps.PlexProperties;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.slf4j.Logger;
|
||||
@@ -25,15 +25,15 @@ public class TmdbKeyValidator implements Validator {
|
||||
|
||||
@Override
|
||||
public boolean supports(@NotNull Class<?> clazz) {
|
||||
return PlexSearch.class.equals(clazz);
|
||||
return PlexProperties.class.equals(clazz);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate(@NotNull Object obj, @NotNull Errors errors) {
|
||||
LOGGER.info("validate( {}, {} )", obj, errors);
|
||||
|
||||
PlexSearch plexSearch = (PlexSearch) obj;
|
||||
if (StringUtils.isEmpty(plexSearch.getMovieDbApiKey())) {
|
||||
PlexProperties plexProperties = (PlexProperties) obj;
|
||||
if (StringUtils.isEmpty(plexProperties.getMovieDbApiKey())) {
|
||||
errors.rejectValue("movieDbApiKey", "movieDbApiKey.empty");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
href="https://www.themoviedb.org/settings/api" rel="noopener" target="_blank">The Movie DB</a>,
|
||||
create an account, and make an API Key. Copy that key and paste it below.</p>
|
||||
|
||||
<form class="needs-validation" id="tmdbConfiguration" novalidate th:object="${plexSearch}">
|
||||
<form class="needs-validation" id="tmdbConfiguration" novalidate th:object="${plexProperties}">
|
||||
<div class="form-group">
|
||||
<label for="movieDbApiKey">Movie Database Api Key</label>
|
||||
<div class="input-group">
|
||||
@@ -244,7 +244,7 @@
|
||||
<h3 class="top-margin">Servers</h3>
|
||||
|
||||
<div class="row top-margin" id="plexServers">
|
||||
<div class="col-lg-4" th:each="plexServer,status : *{plexSearch.plexServers}"
|
||||
<div class="col-lg-4" th:each="plexServer,status : *{plexProperties.plexServers}"
|
||||
th:id="*{plexServer.machineIdentifier}">
|
||||
<div class="top-margin">
|
||||
<div class="card border-secondary mb-3" style="max-width: 20rem;">
|
||||
@@ -275,7 +275,7 @@
|
||||
on each configured server, then search for all movies in each library, and produce a missing movie
|
||||
list.</p>
|
||||
|
||||
<form class="needs-validation" id="scheduleConfiguration" novalidate th:object="${plexSearch}">
|
||||
<form class="needs-validation" id="scheduleConfiguration" novalidate th:object="${plexProperties}">
|
||||
<div class="form-group">
|
||||
<label for="setSchedule">Set Schedule</label>
|
||||
<select class="form-control" id="setSchedule">
|
||||
|
||||
@@ -175,7 +175,7 @@
|
||||
|
||||
<input id="plexServers" name="plexServers" th:value="${{plexServers}}" type="hidden"/>
|
||||
<input id="plexServer" name="plexServer" th:value="${{plexServer}}" type="hidden"/>
|
||||
<input id="plexSearch" name="plexSearch" th:value="${{plexSearch}}" type="hidden"/>
|
||||
<input id="plexProperties" name="plexProperties" th:value="${{plexProperties}}" type="hidden"/>
|
||||
<input id="libraryKey" name="libraryKey" th:value="${{plexLibrary.key}}" type="hidden"/>
|
||||
|
||||
<script src="/js/jquery-3.4.1.min.js" type="text/javascript"></script>
|
||||
|
||||
@@ -209,7 +209,7 @@
|
||||
|
||||
<input id="plexServers" name="plexServers" th:value="${{plexServers}}" type="hidden"/>
|
||||
<input id="plexServer" name="plexServer" th:value="${{plexServer}}" type="hidden"/>
|
||||
<input id="plexSearch" name="plexSearch" th:value="${{plexSearch}}" type="hidden"/>
|
||||
<input id="plexProperties" name="plexProperties" th:value="${{plexProperties}}" type="hidden"/>
|
||||
<input id="libraryKey" name="libraryKey" th:value="${{plexLibrary.key}}" type="hidden"/>
|
||||
|
||||
<script src="/js/jquery-3.4.1.min.js" type="text/javascript"></script>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.jasonhhouse.gaps.service;
|
||||
|
||||
import com.jasonhhouse.gaps.PlexLibrary;
|
||||
import com.jasonhhouse.gaps.PlexSearch;
|
||||
import com.jasonhhouse.gaps.PlexProperties;
|
||||
import com.jasonhhouse.gaps.PlexServer;
|
||||
import java.util.ArrayList;
|
||||
import org.junit.Before;
|
||||
@@ -26,10 +26,10 @@ public class GapsServiceTest {
|
||||
|
||||
@Test
|
||||
public void setPlexSearchMovieDbApiKey() {
|
||||
PlexSearch plexSearch = new PlexSearch();
|
||||
plexSearch.setMovieDbApiKey("123qwe");
|
||||
gapsService.updatePlexSearch(plexSearch);
|
||||
assertEquals("GapsSearch not updating movie db api key", gapsService.getPlexSearch().getMovieDbApiKey(), plexSearch.getMovieDbApiKey());
|
||||
PlexProperties plexProperties = new PlexProperties();
|
||||
plexProperties.setMovieDbApiKey("123qwe");
|
||||
gapsService.updatePlexSearch(plexProperties);
|
||||
assertEquals("GapsSearch not updating movie db api key", gapsService.getPlexSearch().getMovieDbApiKey(), plexProperties.getMovieDbApiKey());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -38,10 +38,10 @@ public class GapsServiceTest {
|
||||
plexServer.setAddress("123");
|
||||
plexServer.setPort(123);
|
||||
|
||||
PlexSearch plexSearch = new PlexSearch();
|
||||
plexSearch.setMovieDbApiKey("123qwe");
|
||||
PlexProperties plexProperties = new PlexProperties();
|
||||
plexProperties.setMovieDbApiKey("123qwe");
|
||||
|
||||
gapsService.updatePlexSearch(plexSearch);
|
||||
gapsService.updatePlexSearch(plexProperties);
|
||||
gapsService.getPlexSearch().addPlexServer(plexServer);
|
||||
|
||||
assertEquals("GapsSearch not updating plex servers", 1, gapsService.getPlexSearch().getPlexServers().size());
|
||||
@@ -65,10 +65,10 @@ public class GapsServiceTest {
|
||||
plexServer.getPlexLibraries().add(plexLibrary1);
|
||||
plexServer.getPlexLibraries().add(plexLibrary2);
|
||||
|
||||
PlexSearch plexSearch = new PlexSearch();
|
||||
plexSearch.setMovieDbApiKey("123qwe");
|
||||
PlexProperties plexProperties = new PlexProperties();
|
||||
plexProperties.setMovieDbApiKey("123qwe");
|
||||
|
||||
gapsService.updatePlexSearch(plexSearch);
|
||||
gapsService.updatePlexSearch(plexProperties);
|
||||
gapsService.getPlexSearch().addPlexServer(plexServer);
|
||||
|
||||
int count = 0;
|
||||
|
||||
Reference in New Issue
Block a user