diff --git a/Core/pom.xml b/Core/pom.xml index 10d210fb..67064e7c 100755 --- a/Core/pom.xml +++ b/Core/pom.xml @@ -5,7 +5,7 @@ Gaps com.jasonhhouse - 0.9.4 + 0.9.5 4.0.0 diff --git a/Core/src/main/java/com/jasonhhouse/gaps/MovieFromCollection.java b/Core/src/main/java/com/jasonhhouse/gaps/MovieFromCollection.java index 7e388b60..059a1159 100644 --- a/Core/src/main/java/com/jasonhhouse/gaps/MovieFromCollection.java +++ b/Core/src/main/java/com/jasonhhouse/gaps/MovieFromCollection.java @@ -14,14 +14,18 @@ public final class MovieFromCollection { private final Integer tmdbId; @NotNull private final Boolean owned; + @NotNull + private final Integer year; @JsonCreator public MovieFromCollection(@JsonProperty(value = "title") @Nullable String title, @JsonProperty(value = "tmdbId") @Nullable Integer tmdbId, - @JsonProperty(value = "owned") @Nullable Boolean owned) { + @JsonProperty(value = "owned") @Nullable Boolean owned, + @JsonProperty(value = "year") @Nullable Integer year) { this.title = StringUtils.isEmpty(title) ? "" : title; this.tmdbId = tmdbId == null ? -1 : tmdbId; this.owned = owned != null && owned; + this.year = year == null ? -1 : year; } @NotNull @@ -39,27 +43,30 @@ public Boolean getOwned() { return owned; } + public Integer getYear() { + return year; + } + + @Override + public String toString() { + return "MovieFromCollection{" + + "title='" + title + '\'' + + ", tmdbId=" + tmdbId + + ", owned=" + owned + + ", year=" + year + + '}'; + } + @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; MovieFromCollection that = (MovieFromCollection) o; - return title.equals(that.title) && - tmdbId.equals(that.tmdbId) && - owned.equals(that.owned); + return title.equals(that.title) && tmdbId.equals(that.tmdbId) && owned.equals(that.owned) && year.equals(that.year); } @Override public int hashCode() { - return Objects.hash(title, tmdbId, owned); - } - - @Override - public String toString() { - return "MovieFromCollection{" + - "title='" + title + '\'' + - ", id='" + tmdbId + '\'' + - ", owned=" + owned + - '}'; + return Objects.hash(title, tmdbId, owned, year); } } diff --git a/Core/src/test/java/com/jasonhhouse/gaps/BasicMovieFromCollectionTest.java b/Core/src/test/java/com/jasonhhouse/gaps/BasicMovieFromCollectionTest.java index c966a804..6ec2c7f5 100644 --- a/Core/src/test/java/com/jasonhhouse/gaps/BasicMovieFromCollectionTest.java +++ b/Core/src/test/java/com/jasonhhouse/gaps/BasicMovieFromCollectionTest.java @@ -9,32 +9,40 @@ class BasicMovieFromCollectionTest { @Test void MovieFromCollectionTest_Invalid_Owned (){ - MovieFromCollection movieFromCollection1 = new MovieFromCollection("ABC", 1234, false); - MovieFromCollection movieFromCollection2 = new MovieFromCollection("ABC", 1234, true); + MovieFromCollection movieFromCollection1 = new MovieFromCollection("ABC", 1234, false, 5); + MovieFromCollection movieFromCollection2 = new MovieFromCollection("ABC", 1234, true, 5); assertNotEquals(movieFromCollection1, movieFromCollection2, "Movies should not be equal because of owned field"); } @Test void MovieFromCollectionTest_Invalid_Id (){ - MovieFromCollection movieFromCollection1 = new MovieFromCollection("ABC", 1234, false); - MovieFromCollection movieFromCollection2 = new MovieFromCollection("ABC", 9874, false); + MovieFromCollection movieFromCollection1 = new MovieFromCollection("ABC", 1234, false, 5); + MovieFromCollection movieFromCollection2 = new MovieFromCollection("ABC", 9874, false, 5); assertNotEquals(movieFromCollection1, movieFromCollection2, "Movies should not be equal because of ID field"); } @Test void MovieFromCollectionTest_Invalid_Name (){ - MovieFromCollection movieFromCollection1 = new MovieFromCollection("ABC", 1234, false); - MovieFromCollection movieFromCollection2 = new MovieFromCollection("qwe", 1234, false); + MovieFromCollection movieFromCollection1 = new MovieFromCollection("ABC", 1234, false, 5); + MovieFromCollection movieFromCollection2 = new MovieFromCollection("qwe", 1234, false, 5); assertNotEquals(movieFromCollection1, movieFromCollection2, "Movies should not be equal because of name field"); } + @Test + void MovieFromCollectionTest_Invalid_Year (){ + MovieFromCollection movieFromCollection1 = new MovieFromCollection("ABC", 1234, false, 5); + MovieFromCollection movieFromCollection2 = new MovieFromCollection("qwe", 1234, false, 4); + + assertNotEquals(movieFromCollection1, movieFromCollection2, "Movies should not be equal because of year field"); + } + @Test void MovieFromCollectionTest_Valid (){ - MovieFromCollection movieFromCollection1 = new MovieFromCollection("ABC", 1234, false); - MovieFromCollection movieFromCollection2 = new MovieFromCollection("ABC", 1234, false); + MovieFromCollection movieFromCollection1 = new MovieFromCollection("ABC", 1234, false, 5); + MovieFromCollection movieFromCollection2 = new MovieFromCollection("ABC", 1234, false, 5); assertEquals(movieFromCollection1, movieFromCollection2, "Movies should be equal"); } diff --git a/Core/src/test/java/com/jasonhhouse/gaps/MovieFromCollectionTest.java b/Core/src/test/java/com/jasonhhouse/gaps/MovieFromCollectionTest.java index 2518817e..f5e8c960 100644 --- a/Core/src/test/java/com/jasonhhouse/gaps/MovieFromCollectionTest.java +++ b/Core/src/test/java/com/jasonhhouse/gaps/MovieFromCollectionTest.java @@ -13,9 +13,6 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import com.jasonhhouse.gaps.properties.DiscordProperties; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.StringUtils; import org.jetbrains.annotations.NotNull; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -34,16 +31,17 @@ void setUp() { @Test void testReadingFromJson() throws JsonProcessingException { - MovieFromCollection movieFromCollection = objectMapper.readValue("{\"title\":\"TITLE\",\"tmdbId\":123,\"owned\":true}", MovieFromCollection.class); + MovieFromCollection movieFromCollection = objectMapper.readValue("{\"title\":\"TITLE\",\"tmdbId\":123,\"owned\":true,\"year\":5}}", MovieFromCollection.class); assertEquals("TITLE", movieFromCollection.getTitle(), "Title should be 'TITLE'"); assertEquals(123, movieFromCollection.getTmdbId(), "tmdbId should be '123'"); assertTrue(movieFromCollection.getOwned(), "Title should be 'TITLE'"); + assertEquals(5, movieFromCollection.getYear(), "year should be '5'"); } @Test void testWritingToJson() throws JsonProcessingException { - MovieFromCollection movieFromCollection = new MovieFromCollection("TITLE",123,true); + MovieFromCollection movieFromCollection = new MovieFromCollection("TITLE",123,true, 5); String json = objectMapper.writeValueAsString(movieFromCollection); - assertEquals("{\"title\":\"TITLE\",\"tmdbId\":123,\"owned\":true}", json, "JSON output should be equal"); + assertEquals("{\"title\":\"TITLE\",\"tmdbId\":123,\"owned\":true,\"year\":5}", json, "JSON output should be equal"); } } \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index a588bbe8..fa5956b9 100755 --- a/Dockerfile +++ b/Dockerfile @@ -32,7 +32,7 @@ RUN mkdir -p /usr/app && chmod 777 /usr/data WORKDIR /usr/app -COPY GapsWeb/target/GapsWeb-0.9.4.jar /usr/app/gaps.jar +COPY GapsWeb/target/GapsWeb-0.9.5.jar /usr/app/gaps.jar COPY start.sh /usr/app/ diff --git a/Dockerfile.arm64 b/Dockerfile.arm64 index e53a7820..4f7aaaa9 100755 --- a/Dockerfile.arm64 +++ b/Dockerfile.arm64 @@ -36,7 +36,7 @@ RUN mkdir -p /usr/app && chmod 777 /usr/data WORKDIR /usr/app -COPY GapsWeb/target/GapsWeb-0.9.4.jar /usr/app/gaps.jar +COPY GapsWeb/target/GapsWeb-0.9.5.jar /usr/app/gaps.jar COPY start.sh /usr/app/ diff --git a/Dockerfile.ppc64le b/Dockerfile.ppc64le index 6c7db07c..467f9253 100755 --- a/Dockerfile.ppc64le +++ b/Dockerfile.ppc64le @@ -32,7 +32,7 @@ RUN mkdir -p /usr/app && chmod 777 /usr/data WORKDIR /usr/app -COPY GapsWeb/target/GapsWeb-0.9.4.jar /usr/app/gaps.jar +COPY GapsWeb/target/GapsWeb-0.9.5.jar /usr/app/gaps.jar COPY start.sh /usr/app/ diff --git a/Dockerfile.raspbian b/Dockerfile.raspbian index 396d7b1d..6b3d69c6 100755 --- a/Dockerfile.raspbian +++ b/Dockerfile.raspbian @@ -32,7 +32,7 @@ RUN mkdir -p /usr/app && chmod 777 /usr/data WORKDIR /usr/app -COPY GapsWeb/target/GapsWeb-0.9.4.jar /usr/app/gaps.jar +COPY GapsWeb/target/GapsWeb-0.9.5.jar /usr/app/gaps.jar COPY start.sh /usr/app/ diff --git a/Dockerfile.riscv64 b/Dockerfile.riscv64 index f203d7b4..8b9f48fb 100755 --- a/Dockerfile.riscv64 +++ b/Dockerfile.riscv64 @@ -36,7 +36,7 @@ RUN mkdir -p /usr/app && chmod 777 /usr/data WORKDIR /usr/app -COPY GapsWeb/target/GapsWeb-0.9.4.jar /usr/app/gaps.jar +COPY GapsWeb/target/GapsWeb-0.9.5.jar /usr/app/gaps.jar COPY start.sh /usr/app/ diff --git a/GapsAsJar/gaps.nsi b/GapsAsJar/gaps.nsi index 21181449..da27367d 100644 --- a/GapsAsJar/gaps.nsi +++ b/GapsAsJar/gaps.nsi @@ -48,4 +48,4 @@ RMDIR /r $INSTDIR SectionEnd # name the installer -OutFile "gaps-0.9.4-installer.exe" \ No newline at end of file +OutFile "gaps-0.9.5-installer.exe" \ No newline at end of file diff --git a/GapsWeb/pom.xml b/GapsWeb/pom.xml index 8b2a46c5..5d4d9b62 100755 --- a/GapsWeb/pom.xml +++ b/GapsWeb/pom.xml @@ -5,7 +5,7 @@ Gaps com.jasonhhouse - 0.9.4 + 0.9.5 4.0.0 diff --git a/GapsWeb/src/main/java/com/jasonhhouse/gaps/service/GapsSearchService.java b/GapsWeb/src/main/java/com/jasonhhouse/gaps/service/GapsSearchService.java index 684ac14a..d7eff207 100755 --- a/GapsWeb/src/main/java/com/jasonhhouse/gaps/service/GapsSearchService.java +++ b/GapsWeb/src/main/java/com/jasonhhouse/gaps/service/GapsSearchService.java @@ -36,7 +36,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; -import java.util.Collections; import java.util.Date; import java.util.GregorianCalendar; import java.util.HashSet; @@ -500,7 +499,7 @@ private void handleCollection(PlexProperties plexProperties, String machineIdent LOGGER.info(collectionBasicMovie.toString()); Boolean owned = ownedBasicMovies.contains(collectionBasicMovie); - moviesInCollection.add(new MovieFromCollection(title, tmdbId, owned)); + moviesInCollection.add(new MovieFromCollection(title, tmdbId, owned, year)); }); } diff --git a/GapsWeb/src/main/resources/application.yaml b/GapsWeb/src/main/resources/application.yaml index 58be7927..68a0d70b 100755 --- a/GapsWeb/src/main/resources/application.yaml +++ b/GapsWeb/src/main/resources/application.yaml @@ -50,7 +50,7 @@ info: app: name: Gaps description: Gaps searches through your Plex Server or local folders for all movies, then queries for known movies in the same collection. If those movies don't exist in your library, Gaps will recommend getting those movies, legally of course. - version: 0.9.4 + version: 0.9.5 storageFolder: /usr/data properties: rssFeed: rssFeed.json diff --git a/GapsWeb/src/main/resources/static/js/page/recommended.js b/GapsWeb/src/main/resources/static/js/page/recommended.js index 054eaa19..33621db3 100755 --- a/GapsWeb/src/main/resources/static/js/page/recommended.js +++ b/GapsWeb/src/main/resources/static/js/page/recommended.js @@ -124,6 +124,12 @@ jQuery(($) => { isEqual(a, b) { return a === b; }, + getYear(year) { + if (year && (year !== -1 || year !== 0)) { + return ` (${year})`; + } + return ''; + }, }); libraryTitle = $('#libraryTitle'); diff --git a/GapsWeb/src/main/resources/templates/about.html b/GapsWeb/src/main/resources/templates/about.html index c482d1e1..d4ab068b 100755 --- a/GapsWeb/src/main/resources/templates/about.html +++ b/GapsWeb/src/main/resources/templates/about.html @@ -29,7 +29,7 @@ Gaps Logo

About

-

v0.9.4

+

v0.9.5

Gaps searches through your Plex Server. It then queries for known diff --git a/GapsWeb/src/main/resources/templates/index.html b/GapsWeb/src/main/resources/templates/index.html index 3b25989c..2d269444 100755 --- a/GapsWeb/src/main/resources/templates/index.html +++ b/GapsWeb/src/main/resources/templates/index.html @@ -27,7 +27,7 @@

Gaps Logo -

v0.9.4

+

v0.9.5

Gaps searches through your Plex Server. It then queries for known diff --git a/GapsWeb/src/main/resources/templates/recommended.html b/GapsWeb/src/main/resources/templates/recommended.html index 8e88e045..c24be048 100755 --- a/GapsWeb/src/main/resources/templates/recommended.html +++ b/GapsWeb/src/main/resources/templates/recommended.html @@ -156,7 +156,7 @@

Owned
{{this.title}} + rel="noopener noreferrer">{{this.title}}{{getYear this.year}} {{/if}} {{/each}}
@@ -170,12 +170,12 @@
Missing
{{this.title}} + rel="noopener noreferrer">{{this.title}}{{getYear this.year}} {{else}} {{this.title}} + rel="noopener noreferrer">{{this.title}}{{getYear this.year}} {{/if}} {{/if}} {{/each}} diff --git a/GapsWeb/src/main/resources/templates/updates.html b/GapsWeb/src/main/resources/templates/updates.html index 1c0ea6c9..090e46f4 100755 --- a/GapsWeb/src/main/resources/templates/updates.html +++ b/GapsWeb/src/main/resources/templates/updates.html @@ -28,6 +28,11 @@ Gaps Logo

Updates

+

v0.9.5

+ +

v0.9.4