Reworking configuration

This commit is contained in:
jhouse
2020-01-27 15:23:48 +09:00
parent a25c82fe04
commit 59f1d52da7
29 changed files with 570 additions and 341 deletions
@@ -26,7 +26,7 @@ public interface GapsService {
/**
* Updates PlexLibrary's to add them if not added and set them selected or unselected if added
*
* @param selectedLibraries The libraries to update
* @param selectedLibraries The libraries to update. they must come in as a single string added together of the plex server ID and the library key.
*/
void updateLibrarySelections(@NotNull List<String> selectedLibraries);
@@ -19,16 +19,16 @@ import org.jetbrains.annotations.NotNull;
public interface PlexQuery {
/**
* @param plexSearch Needs to have the IP Address, port, and plex token to connect
* @param plexServer Needs to have the IP Address, port, and plex token to connect
* @return The list of libraries that are of type movie for that Plex server
*/
@NotNull List<PlexLibrary> getLibraries(@NotNull PlexSearch plexSearch);
@NotNull List<PlexLibrary> getLibraries(@NotNull PlexServer plexServer);
/**
* Find the plex server name, key, and libraries based on the given PlexSearch parameters
*
* @param plexSearch the search parameters
* @param plexServer the search parameters
* @return A PlexServer instance
*/
@NotNull PlexServer getPlexServer(@NotNull PlexSearch plexSearch);
@NotNull PlexServer queryPlexServer(@NotNull PlexServer plexServer);
}
@@ -10,36 +10,27 @@
package com.jasonhhouse.gaps;
import java.util.ArrayList;
import java.util.List;
public final class PlexSearch {
public static final String MOVIE_DB_API_KEY = "movieDbApiKey";
public static final String PLEX_TOKEN = "plexToken";
public static final String ADDRESS = "address";
public static final String PORT = "port";
private String movieDbApiKey;
private String plexToken;
private String address;
private Integer port;
private PlexServer plexServer;
private final List<PlexServer> plexServers;
public PlexSearch() {
plexServers = new ArrayList<>();
}
public void setPlexServer(PlexServer plexServer) {
this.plexServer = plexServer;
public void addPlexServer(PlexServer plexServer) {
this.plexServers.add(plexServer);
}
public PlexServer getPlexServer() {
return plexServer;
public List<PlexServer> getPlexServers() {
return plexServers;
}
public String getMovieDbApiKey() {
@@ -50,38 +41,11 @@ public final class PlexSearch {
this.movieDbApiKey = movieDbApiKey;
}
public String getPlexToken() {
return plexToken;
}
public void setPlexToken(String plexToken) {
this.plexToken = plexToken;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public Integer getPort() {
return port;
}
public void setPort(Integer port) {
this.port = port;
}
@Override
public String toString() {
return "PlexSearch{" +
"movieDbApiKey='" + movieDbApiKey + '\'' +
", plexToken='" + plexToken + '\'' +
", address='" + address + '\'' +
", port=" + port +
", plexServer=" + plexServer +
", plexServers=" + plexServers +
'}';
}
}
@@ -9,11 +9,17 @@ public class PlexServer {
private final String friendlyName;
private final String machineIdentifier;
private final String plexToken;
private final String address;
private final Integer port;
private final SetUniqueList<PlexLibrary> plexLibraries;
public PlexServer(String friendlyName, String machineIdentifier) {
public PlexServer(String friendlyName, String machineIdentifier, String plexToken, String address, Integer port) {
this.friendlyName = friendlyName;
this.machineIdentifier = machineIdentifier;
this.plexToken = plexToken;
this.address = address;
this.port = port;
plexLibraries = SetUniqueList.setUniqueList(new ArrayList<>());
}
@@ -29,6 +35,18 @@ public class PlexServer {
return plexLibraries;
}
public String getPlexToken() {
return plexToken;
}
public String getAddress() {
return address;
}
public Integer getPort() {
return port;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
@@ -47,6 +65,9 @@ public class PlexServer {
return "PlexServer{" +
"friendlyName='" + friendlyName + '\'' +
", machineIdentifier='" + machineIdentifier + '\'' +
", plexToken='" + plexToken + '\'' +
", address='" + address + '\'' +
", port=" + port +
", plexLibraries=" + plexLibraries +
'}';
}