diff --git a/Core/pom.xml b/Core/pom.xml index f016a561..3315fdae 100755 --- a/Core/pom.xml +++ b/Core/pom.xml @@ -5,7 +5,7 @@ Gaps com.jasonhhouse - 0.8.9 + 0.8.10 4.0.0 diff --git a/Core/src/main/java/com/jasonhhouse/gaps/PlexLibraryComparator.java b/Core/src/main/java/com/jasonhhouse/gaps/PlexLibraryComparator.java new file mode 100644 index 00000000..7eea37c4 --- /dev/null +++ b/Core/src/main/java/com/jasonhhouse/gaps/PlexLibraryComparator.java @@ -0,0 +1,59 @@ +/* + * Copyright 2020 Jason H House + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +package com.jasonhhouse.gaps; + +import com.jasonhhouse.plex.libs.PlexLibrary; +import java.util.Comparator; +import java.util.function.Function; +import java.util.function.ToDoubleFunction; +import java.util.function.ToIntFunction; +import java.util.function.ToLongFunction; + +public class PlexLibraryComparator implements Comparator { + @Override + public int compare(PlexLibrary o1, PlexLibrary o2) { + return o1.getTitle().compareTo(o2.getTitle()); + } + + @Override + public Comparator reversed() { + throw new UnsupportedOperationException(); + } + + @Override + public Comparator thenComparing(Comparator other) { + throw new UnsupportedOperationException(); + } + + @Override + public Comparator thenComparing(Function keyExtractor, Comparator keyComparator) { + throw new UnsupportedOperationException(); + } + + @Override + public > Comparator thenComparing(Function keyExtractor) { + throw new UnsupportedOperationException(); + } + + @Override + public Comparator thenComparingInt(ToIntFunction keyExtractor) { + throw new UnsupportedOperationException(); + } + + @Override + public Comparator thenComparingLong(ToLongFunction keyExtractor) { + throw new UnsupportedOperationException(); + } + + @Override + public Comparator thenComparingDouble(ToDoubleFunction keyExtractor) { + throw new UnsupportedOperationException(); + } +} diff --git a/Core/src/main/java/com/jasonhhouse/gaps/PlexServer.java b/Core/src/main/java/com/jasonhhouse/gaps/PlexServer.java index 1a9f802b..b3cda1eb 100755 --- a/Core/src/main/java/com/jasonhhouse/gaps/PlexServer.java +++ b/Core/src/main/java/com/jasonhhouse/gaps/PlexServer.java @@ -11,12 +11,12 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.jasonhhouse.plex.libs.PlexLibrary; import io.swagger.v3.oas.annotations.media.Schema; -import java.util.ArrayList; -import java.util.Collections; import java.util.List; import java.util.Objects; +import javax.validation.constraints.NotNull; @JsonIgnoreProperties(ignoreUnknown = true) @JsonInclude(JsonInclude.Include.NON_NULL) @@ -36,7 +36,7 @@ public final class PlexServer { private Integer port; public PlexServer() { - plexLibraries = new ArrayList<>(); + plexLibraries = new SortedList<>(new PlexLibraryComparator()); } public PlexServer(String friendlyName, String machineIdentifier, String plexToken, String address, Integer port) { @@ -45,7 +45,7 @@ public PlexServer(String friendlyName, String machineIdentifier, String plexToke this.plexToken = plexToken; this.address = address; this.port = port; - plexLibraries = new ArrayList<>(); + plexLibraries = new SortedList<>(new PlexLibraryComparator()); } public String getFriendlyName() { @@ -65,10 +65,14 @@ public void setMachineIdentifier(String machineIdentifier) { } public List getPlexLibraries() { - Collections.sort(plexLibraries); return plexLibraries; } + public void setPlexLibraries(@NotNull List plexLibraries) { + this.plexLibraries.clear(); + this.plexLibraries.addAll(plexLibraries); + } + public String getPlexToken() { return plexToken; } diff --git a/Core/src/main/java/com/jasonhhouse/gaps/Schedule.java b/Core/src/main/java/com/jasonhhouse/gaps/Schedule.java index a7a27988..02aa3101 100644 --- a/Core/src/main/java/com/jasonhhouse/gaps/Schedule.java +++ b/Core/src/main/java/com/jasonhhouse/gaps/Schedule.java @@ -22,7 +22,7 @@ @JsonDeserialize(using = ScheduleDeserializer.class) public enum Schedule { - HOURLY("Hourly", "0 35 * * * ?", 0), + HOURLY("Hourly", "0 49 * * * ?", 0), DAILY_4AM("Daily", "0 0 4 * * ?", 1), EVERY_MONDAY("Weekly", "0 0 4 * * MON", 2), EVERY_TWO_WEEKS("Bi-weekly", "0 0 4 1,15 * ?", 3), diff --git a/Core/src/main/java/com/jasonhhouse/gaps/SortedList.java b/Core/src/main/java/com/jasonhhouse/gaps/SortedList.java new file mode 100644 index 00000000..81b53014 --- /dev/null +++ b/Core/src/main/java/com/jasonhhouse/gaps/SortedList.java @@ -0,0 +1,90 @@ +/* + * Copyright 2020 Jason H House + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package com.jasonhhouse.gaps; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; + +public class SortedList extends ArrayList { + + private static final long serialVersionUID = -441423857950125427L; + + private final Comparator comparator; + + public SortedList(Class clazz) { + super(); + if (!Comparable.class.isAssignableFrom(clazz)) { + throw new ClassCastException(clazz + " does not implement comparable"); + } + // Create comparator using the comparable interface. + this.comparator = new Comparator() { + @SuppressWarnings("unchecked") + @Override + public int compare(T o1, T o2) { + return ((Comparable) o1).compareTo(o2); + } + }; + } + + public SortedList(Comparator comparator) { + super(); + this.comparator = comparator; + } + + /** + * Add the element to this sorted list in a sorted order. + * + * @param e The element + * @return Always true + */ + @Override + public boolean add(T e) { + int insertPoint = Collections.binarySearch(this, e, comparator); + if (insertPoint < 0) { + insertPoint = (insertPoint * -1) - 1; + } + super.add(insertPoint, e); + return true; + + } + + /** + * @deprecated Function ignores the index and insert the element in the correct order + */ + @Deprecated + public void add(int index, T element) { + add(element); + } + + /** + * Add all elements from the collection to this sorted list in a sorted order. + * + * @param c The collection holding all elements to add to this sorted list. The elements in the collection needn't to be in sorted order + * @return Always true + */ + @Override + public boolean addAll(Collection c) { + for (T s : c) { + add(s); + } + return true; + } + + /** + * @deprecated Function ignores the index and insert the elements in the correct order + */ + @Deprecated + public boolean addAll(int index, Collection c) { + return addAll(c); + } +} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index e53673bf..7649e37e 100755 --- a/Dockerfile +++ b/Dockerfile @@ -24,7 +24,7 @@ RUN mkdir -p /usr/app && chmod 777 /usr/data WORKDIR /usr/app -COPY GapsWeb/target/GapsWeb-0.8.9.jar /usr/app/gaps.jar +COPY GapsWeb/target/GapsWeb-0.8.10.jar /usr/app/gaps.jar COPY start.sh /usr/app/ diff --git a/Dockerfile.arm64 b/Dockerfile.arm64 index abb9698f..67f06500 100755 --- a/Dockerfile.arm64 +++ b/Dockerfile.arm64 @@ -26,7 +26,7 @@ RUN mkdir -p /usr/app && chmod 777 /usr/data WORKDIR /usr/app -COPY GapsWeb/target/GapsWeb-0.8.9.jar /usr/app/gaps.jar +COPY GapsWeb/target/GapsWeb-0.8.10.jar /usr/app/gaps.jar COPY start.sh /usr/app/ diff --git a/Dockerfile.ppc64le b/Dockerfile.ppc64le index 56f4e5f1..9d966c85 100755 --- a/Dockerfile.ppc64le +++ b/Dockerfile.ppc64le @@ -20,7 +20,7 @@ RUN mkdir -p /usr/app && chmod 777 /usr/data WORKDIR /usr/app -COPY GapsWeb/target/GapsWeb-0.8.9.jar /usr/app/gaps.jar +COPY GapsWeb/target/GapsWeb-0.8.10.jar /usr/app/gaps.jar COPY start.sh /usr/app/ diff --git a/Dockerfile.raspbian b/Dockerfile.raspbian index b118d38b..cad60335 100755 --- a/Dockerfile.raspbian +++ b/Dockerfile.raspbian @@ -20,7 +20,7 @@ RUN mkdir -p /usr/app && chmod 777 /usr/data WORKDIR /usr/app -COPY GapsWeb/target/GapsWeb-0.8.9.jar /usr/app/gaps.jar +COPY GapsWeb/target/GapsWeb-0.8.10.jar /usr/app/gaps.jar COPY start.sh /usr/app/ diff --git a/Dockerfile.riscv64 b/Dockerfile.riscv64 index bb1ca5c1..7eeaccc5 100755 --- a/Dockerfile.riscv64 +++ b/Dockerfile.riscv64 @@ -24,7 +24,7 @@ RUN mkdir -p /usr/app && chmod 777 /usr/data WORKDIR /usr/app -COPY GapsWeb/target/GapsWeb-0.8.9.jar /usr/app/gaps.jar +COPY GapsWeb/target/GapsWeb-0.8.10.jar /usr/app/gaps.jar COPY start.sh /usr/app/ diff --git a/GapsAsJar/gaps.nsi b/GapsAsJar/gaps.nsi index 63282c72..29af3617 100644 --- a/GapsAsJar/gaps.nsi +++ b/GapsAsJar/gaps.nsi @@ -48,4 +48,4 @@ RMDIR /r $INSTDIR SectionEnd # name the installer -OutFile "gaps-0.8.9-installer.exe" \ No newline at end of file +OutFile "gaps-0.8.10-installer.exe" \ No newline at end of file diff --git a/GapsWeb/pom.xml b/GapsWeb/pom.xml index 2ddbd0aa..42bd6ce8 100755 --- a/GapsWeb/pom.xml +++ b/GapsWeb/pom.xml @@ -5,7 +5,7 @@ Gaps com.jasonhhouse - 0.8.9 + 0.8.10 4.0.0 diff --git a/GapsWeb/src/main/java/com/jasonhhouse/gaps/service/PlexQueryImpl.java b/GapsWeb/src/main/java/com/jasonhhouse/gaps/service/PlexQueryImpl.java index 5337d016..cefc50ca 100755 --- a/GapsWeb/src/main/java/com/jasonhhouse/gaps/service/PlexQueryImpl.java +++ b/GapsWeb/src/main/java/com/jasonhhouse/gaps/service/PlexQueryImpl.java @@ -115,8 +115,7 @@ public PlexQueryImpl(@Qualifier("real") UrlGenerator urlGenerator) { List plexLibraries = mediaContainer.getPlexLibraries().stream().filter(plexLibrary -> plexLibrary.getType().equalsIgnoreCase("movie")).collect(Collectors.toList()); LOGGER.info("{} Plex libraries found", plexLibraries.size()); - plexServer.getPlexLibraries().clear(); - plexServer.getPlexLibraries().addAll(plexLibraries); + plexServer.setPlexLibraries(plexLibraries); return Payload.PLEX_LIBRARIES_FOUND.setExtras("size():" + plexLibraries.size()); } catch (IOException e) { String reason = String.format("Error connecting to Plex to get library list: %s", url); diff --git a/GapsWeb/src/main/resources/application.yaml b/GapsWeb/src/main/resources/application.yaml index c4a5c535..d2efd3ac 100755 --- a/GapsWeb/src/main/resources/application.yaml +++ b/GapsWeb/src/main/resources/application.yaml @@ -47,7 +47,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.8.9 + version: 0.8.10 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 fd9d3a2f..d92f94c5 100755 --- a/GapsWeb/src/main/resources/templates/about.html +++ b/GapsWeb/src/main/resources/templates/about.html @@ -78,7 +78,7 @@ Gaps Logo

About

-

v0.8.9

+

v0.8.10

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 a2416723..b7aaebdf 100755 --- a/GapsWeb/src/main/resources/templates/index.html +++ b/GapsWeb/src/main/resources/templates/index.html @@ -77,7 +77,7 @@

Gaps Logo -

v0.8.9

+

v0.8.10

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 4d13c91f..7aa27ea2 100755 --- a/GapsWeb/src/main/resources/templates/updates.html +++ b/GapsWeb/src/main/resources/templates/updates.html @@ -78,6 +78,11 @@ Gaps Logo

Updates

+

v0.8.10

+
    +
  • Fixing exception that prevented multi plex server automatic scans
  • +
+

v0.8.9

  • Reduced bugs and code rot
  • diff --git a/Plex/pom.xml b/Plex/pom.xml index 93b85277..6da91943 100755 --- a/Plex/pom.xml +++ b/Plex/pom.xml @@ -5,7 +5,7 @@ Gaps com.jasonhhouse - 0.8.9 + 0.8.10 4.0.0 diff --git a/RadarrV3/pom.xml b/RadarrV3/pom.xml index d80d41d0..e93c2c7a 100755 --- a/RadarrV3/pom.xml +++ b/RadarrV3/pom.xml @@ -5,7 +5,7 @@ Gaps com.jasonhhouse - 0.8.9 + 0.8.10 4.0.0 diff --git a/application-custom.yml b/application-custom.yml index c93c3be4..c08ed3e1 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.8.9 + version: 0.8.10 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 5622e3f4..26e5e3f2 100755 --- a/build +++ b/build @@ -1,6 +1,6 @@ #!/bin/bash set -e -VERSION=0.8.9 +VERSION=0.8.10 JAR_VERSION="GapsWeb/target/GapsWeb-$VERSION.jar" ZIP_VERSION="GapsAsJar-$VERSION.zip" npm ci diff --git a/build.bat b/build.bat index 5db987e7..494b775a 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.8.9.jar GapsOnWindows\gaps.jar +copy GapsWeb\target\GapsWeb-0.8.10.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 5450aaad..3aee218e 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.8.9'); + .should('have.text', 'v0.8.10'); cy.get('.container > :nth-child(6)') .should('have.text', 'Software'); diff --git a/docker-compose-dev.yaml b/docker-compose-dev.yaml index bcc9409f..2962ee45 100755 --- a/docker-compose-dev.yaml +++ b/docker-compose-dev.yaml @@ -27,6 +27,7 @@ services: #javaInitialHeapSize: 150M ports: - 8484:8484 + - 5005:5005 restart: unless-stopped expose: - "32400" diff --git a/package-lock.json b/package-lock.json index 1c331e15..37d7e96e 100755 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "gaps", - "version": "0.8.9", + "version": "0.8.10", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -982,9 +982,9 @@ } }, "cypress": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-6.2.1.tgz", - "integrity": "sha512-OYkSgzA4J4Q7eMjZvNf5qWpBLR4RXrkqjL3UZ1UzGGLAskO0nFTi/RomNTG6TKvL3Zp4tw4zFY1gp5MtmkCZrA==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-6.3.0.tgz", + "integrity": "sha512-Ec6TAFOxdSB2HPINNJ1f7z75pENXcfCaQkz+A9j0eGSvusFJ2NNErq650DexCbNJAnCQkPqXB4XPH9kXnSQnUA==", "dev": true, "requires": { "@cypress/listr-verbose-renderer": "^0.4.1", @@ -1835,15 +1835,15 @@ } }, "fs-extra": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.0.1.tgz", - "integrity": "sha512-h2iAoN838FqAFJY2/qVpzFXy+EBxfVE220PalAqQLDVsFOHLJrZvut5puAbCdNv6WJk+B8ihI+k0c7JK5erwqQ==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", "dev": true, "requires": { "at-least-node": "^1.0.0", "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", - "universalify": "^1.0.0" + "universalify": "^2.0.0" } }, "fs.realpath": { @@ -2379,14 +2379,6 @@ "requires": { "graceful-fs": "^4.1.6", "universalify": "^2.0.0" - }, - "dependencies": { - "universalify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", - "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", - "dev": true - } } }, "jsprim": { @@ -4607,9 +4599,9 @@ "integrity": "sha1-/+3ks2slKQaW5uFl1KWe25mOawI=" }, "universalify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-1.0.0.tgz", - "integrity": "sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", "dev": true }, "unquote": { diff --git a/package.json b/package.json index 2a389b72..16e0e540 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gaps", - "version": "0.8.9", + "version": "0.8.10", "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": { @@ -12,7 +12,7 @@ "uglifyjs-folder": "^2.0.0" }, "devDependencies": { - "cypress": "^6.2.1", + "cypress": "^6.3.0", "eslint": "^7.10.0", "eslint-config-airbnb-base": "^14.2.0", "eslint-plugin-import": "^2.22.1" diff --git a/pom.xml b/pom.xml index 3d2cf097..6d04d65c 100755 --- a/pom.xml +++ b/pom.xml @@ -17,7 +17,7 @@ com.jasonhhouse Gaps - 0.8.9 + 0.8.10 Gaps Demo project for Spring Boot @@ -26,7 +26,7 @@ 3.9 1.9 2.8.0 - 0.8.9 + 0.8.10 3.0.0 30.1-jre 5.2.12.Final