1
0
Fork 0

included radarr-movies capabilities

This commit is contained in:
xeviff 2023-03-16 11:51:34 +01:00
parent 0986382fd1
commit 2402765e00
2 changed files with 16 additions and 3 deletions

View File

@ -16,10 +16,12 @@ public abstract class CommonConfigFileLoader<P extends Enum<P>> {
SONARR_PATHS_STARTER, SONARR_PATHS_STARTER,
RADARR_API_HOST, RADARR_API_HOST,
RADARR_API_KEY, RADARR_API_KEY,
RADARR_PATHS_STARTER,
PLEX_HOST, PLEX_HOST,
PLEX_TOKEN, PLEX_TOKEN,
PLEX_SECTIONS_LIST_URI, PLEX_SECTIONS_LIST_URI,
PLEX_SECTION_REFRESH_URI, PLEX_SECTION_REFRESH_URI,
PLEX_MOVIES_PATHS_STARTER,
PLEX_SERIES_PATHS_STARTER PLEX_SERIES_PATHS_STARTER
} }
private EnumMap<CommonProjectConfiguration, String> commonConfigurationsMap; private EnumMap<CommonProjectConfiguration, String> commonConfigurationsMap;

View File

@ -41,7 +41,13 @@ public class PlexCommandLauncher {
// } // }
public void scanSerieByPath(String fullDestinationPath) { public void scanSerieByPath(String fullDestinationPath) {
String plexPathToRefresh = getPlexSeriePath2Refresh(fullDestinationPath); scanByPath(getPlexSeriePath2Refresh(fullDestinationPath));
}
public void scanMovieByPath(String fullDestinationPath) {
scanByPath(getPlexMoviePath2Refresh(fullDestinationPath));
}
private void scanByPath(String plexPathToRefresh) {
String plexRefreshURL = getPlexRefreshURL(plexPathToRefresh); String plexRefreshURL = getPlexRefreshURL(plexPathToRefresh);
if (plexRefreshURL==null) return; if (plexRefreshURL==null) return;
try (CloseableHttpClient httpclient = HttpClients.createDefault()) { try (CloseableHttpClient httpclient = HttpClients.createDefault()) {
@ -63,8 +69,13 @@ public class PlexCommandLauncher {
public String getPlexSeriePath2Refresh(String fullDestinationPath) { public String getPlexSeriePath2Refresh(String fullDestinationPath) {
String sonarrPathStarter = config.getConfig(SONARR_PATHS_STARTER); String sonarrPathStarter = config.getConfig(SONARR_PATHS_STARTER);
String plexDockerPathStarter = config.getConfig(PLEX_SERIES_PATHS_STARTER); String seriesPlexDockerPathStarter = config.getConfig(PLEX_SERIES_PATHS_STARTER);
return fullDestinationPath.replaceFirst(sonarrPathStarter, plexDockerPathStarter); return fullDestinationPath.replaceFirst(sonarrPathStarter, seriesPlexDockerPathStarter);
}
public String getPlexMoviePath2Refresh(String fullDestinationPath) {
String radarrPathStarter = config.getConfig(RADARR_PATHS_STARTER);
String moviesPlexDockerPathStarter = config.getConfig(PLEX_MOVIES_PATHS_STARTER);
return fullDestinationPath.replaceFirst(radarrPathStarter, moviesPlexDockerPathStarter);
} }
public Document retrieveSectionsInfo() { public Document retrieveSectionsInfo() {