diff --git a/src/main/java/net/pms/configuration/BaseConfiguration.java b/src/main/java/net/pms/configuration/BaseConfiguration.java index c9b104c0e68..92aae17476f 100644 --- a/src/main/java/net/pms/configuration/BaseConfiguration.java +++ b/src/main/java/net/pms/configuration/BaseConfiguration.java @@ -64,7 +64,7 @@ public boolean getBoolean(String key, boolean def) { return configurationReader.getBoolean(key, def); } - public String getString(String key, String def) { + public final String getString(String key, String def) { return configurationReader.getNonBlankConfigurationString(key, def); } diff --git a/src/main/java/net/pms/database/MediaTableVideoMetadata.java b/src/main/java/net/pms/database/MediaTableVideoMetadata.java index 6840da338ea..b51bfb66f1b 100644 --- a/src/main/java/net/pms/database/MediaTableVideoMetadata.java +++ b/src/main/java/net/pms/database/MediaTableVideoMetadata.java @@ -614,7 +614,6 @@ public static VideoMetadataLocalized getVideoMetadataUnLocalized(final Connectio return null; } - /** * Checks whether the latest data from our API has been written to the * database for this video. diff --git a/src/main/java/net/pms/external/umsapi/APIUtils.java b/src/main/java/net/pms/external/umsapi/APIUtils.java index aa021c16869..b9b0f4ba989 100644 --- a/src/main/java/net/pms/external/umsapi/APIUtils.java +++ b/src/main/java/net/pms/external/umsapi/APIUtils.java @@ -425,14 +425,16 @@ public static void backgroundLookupAndAddMetadata(final File file, final MediaIn if (isTVEpisode) { Long tvSeriesId = setTVSeriesInfo(connection, titleFromFilename, tvSeriesStartYear, titleSimplifiedFromFilename, file, media, seriesIMDbIDFromAPI, tmdbTvIDFromAPI); + if (tvSeriesId != null) { videoMetadata.setTvSeriesId(tvSeriesId); TvSeriesMetadata tvSeriesMetadata = MediaTableTVSeries.getTvSeriesMetadata(connection, tvSeriesId); videoMetadata.setSeriesMetadata(tvSeriesMetadata); + videoMetadata.setTmdbTvId(tvSeriesMetadata.getTmdbId()); + } if (isNotBlank(titleFromAPI)) { LOGGER.trace("Setting episode name from api: " + titleFromAPI); videoMetadata.setTitle(titleFromAPI); } - videoMetadata.setTmdbTvId(tvSeriesMetadata.getTmdbId()); videoMetadata.setTvSeason(tvSeasonFromAPI); videoMetadata.setTvEpisodeNumber(tvEpisodeNumberFromAPI); videoMetadata.setIsTvEpisode(true); diff --git a/src/main/java/net/pms/store/StoreContainer.java b/src/main/java/net/pms/store/StoreContainer.java index 5f47c08b8b9..5dd33c18ac4 100644 --- a/src/main/java/net/pms/store/StoreContainer.java +++ b/src/main/java/net/pms/store/StoreContainer.java @@ -473,8 +473,14 @@ protected void sortChildrenIfNeeded(String lang) { if (!child1.isSortableByDisplayName || !child2.isSortableByDisplayName) { return 0; } - String str1 = Normalizer.normalize(child1.getLocalizedDisplayName(lang), Normalizer.Form.NFKD); - String str2 = Normalizer.normalize(child2.getLocalizedDisplayName(lang), Normalizer.Form.NFKD); + String str1 = child1.getLocalizedDisplayName(lang); + String str2 = child2.getLocalizedDisplayName(lang); + if (PMS.getConfiguration().isIgnoreTheWordAandThe()) { + str1 = str1.replaceAll("^(?i)A[ .]|The[ .]", "").replaceAll("\\s{2,}", " "); + str2 = str2.replaceAll("^(?i)A[ .]|The[ .]", "").replaceAll("\\s{2,}", " "); + } + str1 = Normalizer.normalize(str1, Normalizer.Form.NFKD); + str2 = Normalizer.normalize(str2, Normalizer.Form.NFKD); return str1.compareToIgnoreCase(str2); }); }