From 482ac750be8b660d50b13531f74b784023555c2f Mon Sep 17 00:00:00 2001 From: Jason Date: Thu, 3 Jun 2021 12:29:35 +0900 Subject: [PATCH 1/2] Adding years to collection movies --- .../jasonhhouse/gaps/MovieFromCollection.java | 35 +++++++++++-------- .../gaps/BasicMovieFromCollectionTest.java | 24 ++++++++----- .../gaps/MovieFromCollectionTest.java | 10 +++--- .../gaps/service/GapsSearchService.java | 3 +- .../resources/static/js/page/recommended.js | 6 ++++ .../main/resources/templates/recommended.html | 6 ++-- .../searchRecommendedMovies.spec.js | 12 +++---- 7 files changed, 57 insertions(+), 39 deletions(-) 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/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/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/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/cypress/integration/recommended/searchRecommendedMovies.spec.js b/cypress/integration/recommended/searchRecommendedMovies.spec.js index e59e6eba..1729dd23 100755 --- a/cypress/integration/recommended/searchRecommendedMovies.spec.js +++ b/cypress/integration/recommended/searchRecommendedMovies.spec.js @@ -97,10 +97,10 @@ describe('Search for Recommended', () => { .should('have.text', 'Showing 1 to 7 of 7 entries'); cy.get('[data-cy=tt0432348-176]') - .should('have.text', 'Saw'); + .should('have.text', 'Saw (2004)'); cy.get('[data-cy=tt0432348-215]') - .should('have.text', 'Saw II'); + .should('have.text', 'Saw II (2005)'); }); it('Research Movies', () => { @@ -119,10 +119,10 @@ describe('Search for Recommended', () => { .should('have.text', 'Showing 1 to 7 of 7 entries'); cy.get('[data-cy=tt0432348-176]') - .should('have.text', 'Saw'); + .should('have.text', 'Saw (2004)'); cy.get('[data-cy=tt0432348-215]') - .should('have.text', 'Saw II'); + .should('have.text', 'Saw II (2005)'); cy.get('#movieContainer > [onclick="searchForMovies()"]') .click(); @@ -131,9 +131,9 @@ describe('Search for Recommended', () => { .should('have.text', 'Showing 1 to 7 of 7 entries'); cy.get('[data-cy=tt0432348-176]') - .should('have.text', 'Saw'); + .should('have.text', 'Saw (2004)'); cy.get('[data-cy=tt0432348-215]') - .should('have.text', 'Saw II'); + .should('have.text', 'Saw II (2005)'); }); }); From 51fb2125b6bf29a724049f0f08508e3f318cb072 Mon Sep 17 00:00:00 2001 From: Jason Date: Thu, 3 Jun 2021 12:38:36 +0900 Subject: [PATCH 2/2] 0.9.5 --- Core/pom.xml | 2 +- Dockerfile | 2 +- Dockerfile.arm64 | 2 +- Dockerfile.ppc64le | 2 +- Dockerfile.raspbian | 2 +- Dockerfile.riscv64 | 2 +- GapsAsJar/gaps.nsi | 2 +- GapsWeb/pom.xml | 2 +- GapsWeb/src/main/resources/application.yaml | 2 +- GapsWeb/src/main/resources/templates/about.html | 2 +- GapsWeb/src/main/resources/templates/index.html | 2 +- GapsWeb/src/main/resources/templates/updates.html | 5 +++++ Plex/pom.xml | 2 +- RadarrV3/pom.xml | 2 +- application-custom.yml | 2 +- build | 2 +- build.bat | 2 +- cypress/integration/about/about.spec.js | 2 +- package-lock.json | 2 +- package.json | 2 +- pom.xml | 4 ++-- 21 files changed, 26 insertions(+), 21 deletions(-) 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/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/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/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/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

+
    +
  • Adding years collection movies
  • +
+

v0.9.4

  • Adding genres to owned and recommended movies
  • diff --git a/Plex/pom.xml b/Plex/pom.xml index 1cd36cab..4b3d8c95 100755 --- a/Plex/pom.xml +++ b/Plex/pom.xml @@ -5,7 +5,7 @@ Gaps com.jasonhhouse - 0.9.4 + 0.9.5 4.0.0 diff --git a/RadarrV3/pom.xml b/RadarrV3/pom.xml index a1be1086..886df317 100755 --- a/RadarrV3/pom.xml +++ b/RadarrV3/pom.xml @@ -5,7 +5,7 @@ Gaps com.jasonhhouse - 0.9.4 + 0.9.5 4.0.0 diff --git a/application-custom.yml b/application-custom.yml index b3045ae6..844da51d 100644 --- a/application-custom.yml +++ b/application-custom.yml @@ -44,7 +44,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: /{CUSTOM_FOLDER} #Change to folder that gaps has permission to read, write, and delete in. properties: rssFeed: rssFeed.json diff --git a/build b/build index ee9e0d79..60b07b38 100755 --- a/build +++ b/build @@ -11,7 +11,7 @@ ## set -e -VERSION=0.9.4 +VERSION=0.9.5 JAR_VERSION="GapsWeb/target/GapsWeb-$VERSION.jar" ZIP_VERSION="GapsAsJar-$VERSION.zip" npm ci diff --git a/build.bat b/build.bat index 52bdd6e2..923c6cfb 100644 --- a/build.bat +++ b/build.bat @@ -7,7 +7,7 @@ call npm run uglifyjs-pages call mvn clean install del GapsOnWindows\*.jar del GapsOnWindows\README.md -copy GapsWeb\target\GapsWeb-0.9.4.jar GapsOnWindows\gaps.jar +copy GapsWeb\target\GapsWeb-0.9.5.jar GapsOnWindows\gaps.jar copy README.md GapsOnWindows\ cd GapsOnWindows makensis gaps.nsi \ No newline at end of file diff --git a/cypress/integration/about/about.spec.js b/cypress/integration/about/about.spec.js index 32f91166..d50ae9f3 100644 --- a/cypress/integration/about/about.spec.js +++ b/cypress/integration/about/about.spec.js @@ -21,7 +21,7 @@ describe('Verify About Page', () => { .should('have.text', 'About'); cy.get('.container > :nth-child(3)') - .should('have.text', 'v0.9.4'); + .should('have.text', 'v0.9.5'); cy.get('.container > :nth-child(6)') .should('have.text', 'Software'); diff --git a/package-lock.json b/package-lock.json index 417d0c9b..878907a9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "gaps", - "version": "0.9.4", + "version": "0.9.5", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index a9528c47..e5ad71ef 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gaps", - "version": "0.9.4", + "version": "0.9.5", "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.", "main": "/", "dependencies": { diff --git a/pom.xml b/pom.xml index 2d4497e8..14f21c76 100755 --- a/pom.xml +++ b/pom.xml @@ -17,7 +17,7 @@ com.jasonhhouse Gaps - 0.9.4 + 0.9.5 Gaps Demo project for Spring Boot @@ -26,7 +26,7 @@ 3.9 1.9 2.8.0 - 0.9.4 + 0.9.5 3.0.0 30.1-jre 5.2.12.Final