mirror of
https://github.com/JasonHHouse/gaps.git
synced 2026-01-29 06:38:39 -06:00
Setting all movies to have a no bad characters private field
This commit is contained in:
@@ -45,10 +45,15 @@ public final class Movie implements Comparable<Movie> {
|
||||
|
||||
public static final String MOVIES_IN_COLLECTION = "movies_in_collection";
|
||||
|
||||
@NotNull
|
||||
private final String name;
|
||||
|
||||
@NotNull
|
||||
private final Integer year;
|
||||
|
||||
@NotNull
|
||||
private final String nameWithoutBadCharacters;
|
||||
|
||||
@Nullable
|
||||
@JsonProperty("poster_url")
|
||||
private final String posterUrl;
|
||||
@@ -67,9 +72,10 @@ public final class Movie implements Comparable<Movie> {
|
||||
@NotNull
|
||||
private final List<MovieFromCollection> moviesInCollection;
|
||||
|
||||
private Movie(String name, Integer year, @Nullable String posterUrl, @Nullable String collection, @NotNull Integer collectionId, @NotNull Integer tvdbId,
|
||||
private Movie(@NotNull String name, @NotNull Integer year, @Nullable String posterUrl, @Nullable String collection, @NotNull Integer collectionId, @NotNull Integer tvdbId,
|
||||
@Nullable String imdbId, @Nullable String language, @Nullable String overview, @NotNull List<MovieFromCollection> moviesInCollection) {
|
||||
this.name = name;
|
||||
this.nameWithoutBadCharacters = name.replaceAll("[<>`~\\[\\]()*&^%$#@!|{}.,?\\-_=+:;]", "");
|
||||
this.year = year;
|
||||
this.posterUrl = posterUrl;
|
||||
this.collection = collection;
|
||||
@@ -97,11 +103,13 @@ public final class Movie implements Comparable<Movie> {
|
||||
this.tvdbId = tvdbId;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getYear() {
|
||||
@NotNull
|
||||
public Integer getYear() {
|
||||
return year;
|
||||
}
|
||||
|
||||
@@ -157,7 +165,7 @@ public final class Movie implements Comparable<Movie> {
|
||||
}
|
||||
|
||||
//Fallback is year and title
|
||||
return year.equals(movie.year) && name.equals(movie.name);
|
||||
return year.equals(movie.year) && nameWithoutBadCharacters.equals(movie.nameWithoutBadCharacters);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -211,7 +219,7 @@ public final class Movie implements Comparable<Movie> {
|
||||
|
||||
private List<MovieFromCollection> moviesInCollection;
|
||||
|
||||
public Builder(String name, int year) {
|
||||
public Builder(@NotNull String name, @NotNull Integer year) {
|
||||
this.name = name;
|
||||
this.year = year;
|
||||
this.tvdbId = -1;
|
||||
|
||||
@@ -424,7 +424,7 @@ public class GapsSearchService implements GapsSearch {
|
||||
if (collection.has("parts")) {
|
||||
JsonNode parts = collection.get("parts");
|
||||
parts.iterator().forEachRemaining(jsonNode -> {
|
||||
String title = jsonNode.get("title").asText().replaceAll("[<>`~\\[\\]()*&^%$#@!|{}.,?\\-_=+:;]", "");
|
||||
String title = jsonNode.get("title").asText();
|
||||
int year = -1;
|
||||
if(jsonNode.has("year")) {
|
||||
year = jsonNode.get("year").asInt(-1);
|
||||
@@ -465,7 +465,7 @@ public class GapsSearchService implements GapsSearch {
|
||||
for (JsonNode part : parts) {
|
||||
int tvdbId = part.get("id").asInt();
|
||||
//Files can't have : so need to remove to find matches correctly
|
||||
String title = part.get("title").asText().replaceAll("[<>`~\\[\\]()*&^%$#@!|{}.,?\\-_=+:;]", "");
|
||||
String title = part.get("title").asText();
|
||||
int year;
|
||||
try {
|
||||
if (part.has("release_date") && StringUtils.isNotEmpty(part.get("release_date").asText())) {
|
||||
|
||||
Reference in New Issue
Block a user