diff --git a/source/net/filebot/web/Movie.java b/source/net/filebot/web/Movie.java index 80a438bb..59b95108 100644 --- a/source/net/filebot/web/Movie.java +++ b/source/net/filebot/web/Movie.java @@ -19,11 +19,15 @@ public class Movie extends SearchResult { } public Movie(int imdbId) { - this(null, 0, imdbId, 0); + this(null, null, 0, imdbId, 0, null); } - public Movie(String name, int year, int imdbId, int tmdbId) { - this(name, null, year, imdbId, tmdbId, null); + public Movie(String name, int year) { + this(name, null, year, 0, 0, null); + } + + public Movie(String name, int year, int imdbId) { + this(name, null, year, imdbId, 0, null); } public Movie(String name, String[] aliasNames, int year, int imdbId, int tmdbId, Locale locale) { diff --git a/source/net/filebot/web/MovieFormat.java b/source/net/filebot/web/MovieFormat.java index 9aedb76f..21ed3f30 100644 --- a/source/net/filebot/web/MovieFormat.java +++ b/source/net/filebot/web/MovieFormat.java @@ -1,7 +1,6 @@ package net.filebot.web; - import java.text.FieldPosition; import java.text.Format; import java.text.ParseException; @@ -9,7 +8,6 @@ import java.text.ParsePosition; import java.util.regex.Matcher; import java.util.regex.Pattern; - public class MovieFormat extends Format { public static final MovieFormat NameYear = new MovieFormat(true, true, true); @@ -18,14 +16,12 @@ public class MovieFormat extends Format { private final boolean includePartIndex; private final boolean smart; - public MovieFormat(boolean includeYear, boolean includePartIndex, boolean smart) { this.includeYear = includeYear; this.includePartIndex = includePartIndex; this.smart = smart; } - @Override public StringBuffer format(Object obj, StringBuffer sb, FieldPosition pos) { // format episode object, e.g. Avatar (2009), Part 1 @@ -53,7 +49,6 @@ public class MovieFormat extends Format { private final Pattern moviePattern = Pattern.compile("([^\\p{Punct}]+?)[\\p{Punct}\\s]+(\\d{4})(?:[\\p{Punct}\\s]+|$)"); private final Pattern partPattern = Pattern.compile("(?:Part|CD)\\D?(\\d)$", Pattern.CASE_INSENSITIVE); - @Override public Movie parseObject(String source, ParsePosition pos) { String s = source; @@ -72,7 +67,7 @@ public class MovieFormat extends Format { String name = m.group(1).trim(); int year = Integer.parseInt(m.group(2)); - Movie movie = new Movie(name, year, -1, -1); + Movie movie = new Movie(name, year); if (partIndex >= 0) { movie = new MoviePart(movie, partIndex, partCount); } @@ -87,7 +82,6 @@ public class MovieFormat extends Format { return null; } - @Override public Movie parseObject(String source) throws ParseException { return (Movie) super.parseObject(source); diff --git a/source/net/filebot/web/OMDbClient.java b/source/net/filebot/web/OMDbClient.java index aa24f23b..557f30d8 100644 --- a/source/net/filebot/web/OMDbClient.java +++ b/source/net/filebot/web/OMDbClient.java @@ -120,7 +120,7 @@ public class OMDbClient implements MovieIdentificationService { if (name.length() <= 0 || year <= 1900 || imdbid <= 0) throw new IllegalArgumentException(); - return new Movie(name, year, imdbid, 0); + return new Movie(name, year, imdbid); } catch (Exception e) { throw new IllegalArgumentException("Illegal fields: " + info); } diff --git a/source/net/filebot/web/OpenSubtitlesClient.java b/source/net/filebot/web/OpenSubtitlesClient.java index 09fe14f8..562c3d6e 100644 --- a/source/net/filebot/web/OpenSubtitlesClient.java +++ b/source/net/filebot/web/OpenSubtitlesClient.java @@ -268,7 +268,7 @@ public class OpenSubtitlesClient implements SubtitleProvider, VideoHashSubtitleS String imdb = fields.get("IDMovieImdb"); String name = fields.get("MovieName"); String year = fields.get("MovieYear"); - identity = new Movie(name, Integer.parseInt(year), Integer.parseInt(imdb), -1); + identity = new Movie(name, Integer.parseInt(year), Integer.parseInt(imdb)); } catch (Exception e) { debug.log(Level.SEVERE, "Failed to upload subtitles", e); } diff --git a/source/net/filebot/web/OpenSubtitlesXmlRpc.java b/source/net/filebot/web/OpenSubtitlesXmlRpc.java index 2a370272..48fe66e4 100644 --- a/source/net/filebot/web/OpenSubtitlesXmlRpc.java +++ b/source/net/filebot/web/OpenSubtitlesXmlRpc.java @@ -157,7 +157,7 @@ public class OpenSubtitlesXmlRpc { String name = data.get("title"); int year = Integer.parseInt(data.get("year")); - return new Movie(name, year, imdbid, -1); + return new Movie(name, year, imdbid); } catch (RuntimeException e) { // ignore, invalid response debug.log(Level.WARNING, String.format("Failed to lookup movie by imdbid %s: %s", imdbid, e.getMessage())); @@ -289,7 +289,7 @@ public class OpenSubtitlesXmlRpc { int year = Integer.parseInt(info.get("MovieYear")); int imdb = Integer.parseInt(info.get("MovieImdbID")); - matches.add(new Movie(name, year, imdb, -1)); + matches.add(new Movie(name, year, imdb)); } } } diff --git a/source/net/filebot/web/SearchResult.java b/source/net/filebot/web/SearchResult.java index b812562a..ea54b3e4 100644 --- a/source/net/filebot/web/SearchResult.java +++ b/source/net/filebot/web/SearchResult.java @@ -28,7 +28,7 @@ public class SearchResult implements Serializable { public SearchResult(int id, String name, String[] aliasNames) { this.id = id; this.name = name; - this.aliasNames = (aliasNames == null || aliasNames.length == 0) ? EMPTY_STRING_ARRAY : aliasNames.clone(); + this.aliasNames = aliasNames == null || aliasNames.length == 0 ? EMPTY_STRING_ARRAY : aliasNames.clone(); } public int getId() { diff --git a/source/net/filebot/web/TMDbClient.java b/source/net/filebot/web/TMDbClient.java index f43e3c62..b86865d1 100644 --- a/source/net/filebot/web/TMDbClient.java +++ b/source/net/filebot/web/TMDbClient.java @@ -354,7 +354,7 @@ public class TMDbClient implements MovieIdentificationService, ArtworkProvider { String title = getString(it, "title"); int year = getStringValue(it, "release_date", SimpleDate::parse).getYear(); int id = getInteger(it, "id"); - return new Movie(title, year, 0, id); + return new Movie(title, null, year, 0, id, locale); }).collect(toList()); }