1
0
Fork 0

refine CommonProjectConfiguration

This commit is contained in:
Xavier Fontanet 2022-10-12 12:14:31 +02:00
parent bec734b64c
commit 4c39ba3e77
3 changed files with 9 additions and 9 deletions

View File

@ -11,16 +11,16 @@ public abstract class CommonConfigFileLoader<P extends Enum<P>> {
private static final String CONFIG_FOLDER = "/config"; private static final String CONFIG_FOLDER = "/config";
public enum CommonProjectConfiguration { public enum CommonProjectConfiguration {
RADARR_API_KEY,
RADARR_API_HOST,
SONARR_API_KEY,
SONARR_API_HOST, SONARR_API_HOST,
PLEX_TOKEN, SONARR_API_KEY,
SONARR_PATHS_STARTER,
RADARR_API_HOST,
RADARR_API_KEY,
PLEX_HOST, PLEX_HOST,
PLEX_TOKEN,
PLEX_SECTIONS_LIST_URI, PLEX_SECTIONS_LIST_URI,
PLEX_SECTION_REFRESH_URI, PLEX_SECTION_REFRESH_URI,
SONARR_PATHS_STARTER, PLEX_SERIES_PATHS_STARTER
PLEX_PATHS_STARTER
} }
private EnumMap<CommonProjectConfiguration, String> commonConfigurationsMap; private EnumMap<CommonProjectConfiguration, String> commonConfigurationsMap;

View File

@ -66,7 +66,7 @@ public class PlexCommandLauncher {
Pattern p = Pattern.compile(config.getCommonConfig(SONARR_PATHS_STARTER).concat("(.+/.+ \\(\\d{4}\\))")); Pattern p = Pattern.compile(config.getCommonConfig(SONARR_PATHS_STARTER).concat("(.+/.+ \\(\\d{4}\\))"));
Matcher m = p.matcher(fullDestinationPath); Matcher m = p.matcher(fullDestinationPath);
if (m.find()) { if (m.find()) {
String pathInPlexDockerStart = config.getCommonConfig(PLEX_PATHS_STARTER); String pathInPlexDockerStart = config.getCommonConfig(PLEX_SERIES_PATHS_STARTER);
return pathInPlexDockerStart.concat(m.group(1)); return pathInPlexDockerStart.concat(m.group(1));
} }
return null; return null;

View File

@ -13,7 +13,7 @@ import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory; import javax.xml.xpath.XPathFactory;
import static tv.mangrana.config.CommonConfigFileLoader.CommonProjectConfiguration.PLEX_PATHS_STARTER; import static tv.mangrana.config.CommonConfigFileLoader.CommonProjectConfiguration.PLEX_SERIES_PATHS_STARTER;
public class PlexLibrarySectionsResolver { public class PlexLibrarySectionsResolver {
@ -26,7 +26,7 @@ public class PlexLibrarySectionsResolver {
} }
public String resolveSectionByPath(String fullDestinationPath) { public String resolveSectionByPath(String fullDestinationPath) {
final String plexPathStarter = config.getCommonConfig(PLEX_PATHS_STARTER); final String plexPathStarter = config.getCommonConfig(PLEX_SERIES_PATHS_STARTER);
String keyFolder = fullDestinationPath.replaceFirst(plexPathStarter,"").split("/")[1]; String keyFolder = fullDestinationPath.replaceFirst(plexPathStarter,"").split("/")[1];
Document xmlDocument = commandLauncher.retrieveSectionsInfo(); Document xmlDocument = commandLauncher.retrieveSectionsInfo();
XPath xPath = XPathFactory.newInstance().newXPath(); XPath xPath = XPathFactory.newInstance().newXPath();