From 45d34372067b70a6423fc1dda559122473432a97 Mon Sep 17 00:00:00 2001 From: pidoubleyou Date: Sun, 24 Mar 2024 15:51:44 +0100 Subject: [PATCH] move TopicUrlDTO to base package --- .../java/mServer/crawler/AddToFilmlist.java | 4 +- .../sender/{orf => base}/TopicUrlDTO.java | 73 +++++++++---------- .../crawler/sender/kika/KikaApiCrawler.java | 2 +- .../crawler/sender/kika/KikaApiTopicDto.java | 2 +- .../json/KikaApiTopicPageDeserializer.java | 2 +- .../sender/kika/tasks/KikaApiTopicTask.java | 2 +- .../crawler/sender/orfon/OrfOnConstants.java | 2 + .../sender/orfon/task/OrfOnScheduleTask.java | 2 +- .../parser/PhoenixFilmDetailDeserializer.java | 3 +- .../PhoenixSendungOverviewDeserializer.java | 3 +- .../crawler/sender/srf/SrfCrawler.java | 2 +- .../srf/parser/SrfTopicsDeserializer.java | 2 +- .../srf/tasks/SrfTopicOverviewTask.java | 2 +- .../srf/tasks/SrfTopicsOverviewTask.java | 2 +- 14 files changed, 53 insertions(+), 50 deletions(-) rename src/main/java/mServer/crawler/sender/{orf => base}/TopicUrlDTO.java (84%) diff --git a/src/main/java/mServer/crawler/AddToFilmlist.java b/src/main/java/mServer/crawler/AddToFilmlist.java index 726b52251..33b690a8a 100644 --- a/src/main/java/mServer/crawler/AddToFilmlist.java +++ b/src/main/java/mServer/crawler/AddToFilmlist.java @@ -16,7 +16,7 @@ import java.util.*; import mServer.crawler.sender.base.UrlUtils; -import mServer.crawler.sender.orf.OrfVideoInfoDTO; +import mServer.crawler.sender.orfon.OrfOnConstants; import mServer.tool.MserverDaten; import okhttp3.OkHttpClient; import okhttp3.Request; @@ -114,7 +114,7 @@ private void performUrlSearch(HashSet hash, final int size) { private void performInitialCleanup() { listeEinsortieren.removeIf(f -> !f.arr[DatenFilm.FILM_URL].toLowerCase().startsWith("http")); listeEinsortieren.removeIf(f -> f.arr[DatenFilm.FILM_SENDER].equals(Const.ORF) && f.arr[DatenFilm.FILM_URL] - .matches(OrfVideoInfoDTO.FILTER_JUGENDSCHUTZ)); + .matches(OrfOnConstants.FILTER_JUGENDSCHUTZ)); listeEinsortieren.removeIf(f -> f.arr[DatenFilm.FILM_SENDER].equals(Const.ARD) && isArdUrlToRemove(f.arr[DatenFilm.FILM_URL])); listeEinsortieren.removeIf(f -> { String groesse = f.arr[DatenFilm.FILM_GROESSE]; diff --git a/src/main/java/mServer/crawler/sender/orf/TopicUrlDTO.java b/src/main/java/mServer/crawler/sender/base/TopicUrlDTO.java similarity index 84% rename from src/main/java/mServer/crawler/sender/orf/TopicUrlDTO.java rename to src/main/java/mServer/crawler/sender/base/TopicUrlDTO.java index 58a8050b5..415ece181 100644 --- a/src/main/java/mServer/crawler/sender/orf/TopicUrlDTO.java +++ b/src/main/java/mServer/crawler/sender/base/TopicUrlDTO.java @@ -1,37 +1,36 @@ -package mServer.crawler.sender.orf; - -import mServer.crawler.sender.base.CrawlerUrlDTO; -import java.util.Objects; - -public class TopicUrlDTO extends CrawlerUrlDTO { - - private final String topic; - - public TopicUrlDTO(String aTopic, String aUrl) { - super(aUrl); - topic = aTopic; - } - - public String getTopic() { - return topic; - } - - @Override - public boolean equals(final Object obj) { - if (obj == null || getClass() != obj.getClass()) { - return false; - } - if (super.equals(obj)) { - return getTopic().equals(((TopicUrlDTO) obj).getTopic()); - } - - return false; - } - - @Override - public int hashCode() { - int hash = 3; - hash = 31 * hash + Objects.hashCode(this.topic) + super.hashCode(); - return hash; - } -} +package mServer.crawler.sender.base; + +import java.util.Objects; + +public class TopicUrlDTO extends CrawlerUrlDTO { + + private final String topic; + + public TopicUrlDTO(String aTopic, String aUrl) { + super(aUrl); + topic = aTopic; + } + + public String getTopic() { + return topic; + } + + @Override + public boolean equals(final Object obj) { + if (obj == null || getClass() != obj.getClass()) { + return false; + } + if (super.equals(obj)) { + return getTopic().equals(((TopicUrlDTO) obj).getTopic()); + } + + return false; + } + + @Override + public int hashCode() { + int hash = 3; + hash = 31 * hash + Objects.hashCode(this.topic) + super.hashCode(); + return hash; + } +} diff --git a/src/main/java/mServer/crawler/sender/kika/KikaApiCrawler.java b/src/main/java/mServer/crawler/sender/kika/KikaApiCrawler.java index 5f9ee64b1..2832c5fb8 100644 --- a/src/main/java/mServer/crawler/sender/kika/KikaApiCrawler.java +++ b/src/main/java/mServer/crawler/sender/kika/KikaApiCrawler.java @@ -13,7 +13,7 @@ import mServer.crawler.sender.base.JsoupConnection; import mServer.crawler.sender.kika.tasks.KikaApiFilmTask; import mServer.crawler.sender.kika.tasks.KikaApiTopicTask; -import mServer.crawler.sender.orf.TopicUrlDTO; +import mServer.crawler.sender.base.TopicUrlDTO; import java.util.Set; import java.util.concurrent.ConcurrentLinkedQueue; diff --git a/src/main/java/mServer/crawler/sender/kika/KikaApiTopicDto.java b/src/main/java/mServer/crawler/sender/kika/KikaApiTopicDto.java index 127de20ef..7e11939bc 100644 --- a/src/main/java/mServer/crawler/sender/kika/KikaApiTopicDto.java +++ b/src/main/java/mServer/crawler/sender/kika/KikaApiTopicDto.java @@ -4,7 +4,7 @@ import java.util.Optional; import java.util.Set; -import mServer.crawler.sender.orf.TopicUrlDTO; +import mServer.crawler.sender.base.TopicUrlDTO; public class KikaApiTopicDto { diff --git a/src/main/java/mServer/crawler/sender/kika/json/KikaApiTopicPageDeserializer.java b/src/main/java/mServer/crawler/sender/kika/json/KikaApiTopicPageDeserializer.java index 0eab95d85..4cce1ba31 100644 --- a/src/main/java/mServer/crawler/sender/kika/json/KikaApiTopicPageDeserializer.java +++ b/src/main/java/mServer/crawler/sender/kika/json/KikaApiTopicPageDeserializer.java @@ -2,7 +2,7 @@ import com.google.gson.*; -import mServer.crawler.sender.orf.TopicUrlDTO; +import mServer.crawler.sender.base.TopicUrlDTO; import mServer.crawler.sender.base.JsonUtils; import mServer.crawler.sender.base.UrlUtils; import mServer.crawler.sender.kika.KikaApiConstants; diff --git a/src/main/java/mServer/crawler/sender/kika/tasks/KikaApiTopicTask.java b/src/main/java/mServer/crawler/sender/kika/tasks/KikaApiTopicTask.java index f08263da1..95bc1506d 100644 --- a/src/main/java/mServer/crawler/sender/kika/tasks/KikaApiTopicTask.java +++ b/src/main/java/mServer/crawler/sender/kika/tasks/KikaApiTopicTask.java @@ -10,7 +10,7 @@ import mServer.crawler.sender.kika.KikaApiFilmDto; import mServer.crawler.sender.kika.KikaApiTopicDto; import mServer.crawler.sender.kika.json.KikaApiTopicPageDeserializer; -import mServer.crawler.sender.orf.TopicUrlDTO; +import mServer.crawler.sender.base.TopicUrlDTO; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/src/main/java/mServer/crawler/sender/orfon/OrfOnConstants.java b/src/main/java/mServer/crawler/sender/orfon/OrfOnConstants.java index cb852f42d..57eefa8cb 100644 --- a/src/main/java/mServer/crawler/sender/orfon/OrfOnConstants.java +++ b/src/main/java/mServer/crawler/sender/orfon/OrfOnConstants.java @@ -1,6 +1,8 @@ package mServer.crawler.sender.orfon; public final class OrfOnConstants { + + public static final String FILTER_JUGENDSCHUTZ = ".*/Jugendschutz[0-9][0-9][0-9][0-9]b[0-9][0-9][0-9][0-9]_.*"; // public static final String HOST = "https://api-tvthek.orf.at/api/v4.3"; // diff --git a/src/main/java/mServer/crawler/sender/orfon/task/OrfOnScheduleTask.java b/src/main/java/mServer/crawler/sender/orfon/task/OrfOnScheduleTask.java index d1ebd2def..518621573 100644 --- a/src/main/java/mServer/crawler/sender/orfon/task/OrfOnScheduleTask.java +++ b/src/main/java/mServer/crawler/sender/orfon/task/OrfOnScheduleTask.java @@ -5,7 +5,7 @@ import mServer.crawler.sender.MediathekReader; import mServer.crawler.sender.base.AbstractRecursivConverterTask; import mServer.crawler.sender.base.PagedElementListDTO; -import mServer.crawler.sender.orf.TopicUrlDTO; +import mServer.crawler.sender.base.TopicUrlDTO; import mServer.crawler.sender.orfon.OrfOnBreadCrumsUrlDTO; import mServer.crawler.sender.orfon.json.OrfOnScheduleDeserializer; diff --git a/src/main/java/mServer/crawler/sender/phoenix/parser/PhoenixFilmDetailDeserializer.java b/src/main/java/mServer/crawler/sender/phoenix/parser/PhoenixFilmDetailDeserializer.java index 8bc3a3b5f..676b0c36c 100644 --- a/src/main/java/mServer/crawler/sender/phoenix/parser/PhoenixFilmDetailDeserializer.java +++ b/src/main/java/mServer/crawler/sender/phoenix/parser/PhoenixFilmDetailDeserializer.java @@ -5,9 +5,10 @@ import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import mServer.crawler.sender.base.JsonUtils; + import java.lang.reflect.Type; import java.util.Optional; -import mServer.crawler.sender.orf.JsonUtils; public class PhoenixFilmDetailDeserializer implements JsonDeserializer> { diff --git a/src/main/java/mServer/crawler/sender/phoenix/parser/PhoenixSendungOverviewDeserializer.java b/src/main/java/mServer/crawler/sender/phoenix/parser/PhoenixSendungOverviewDeserializer.java index 2648a4260..05652cbea 100644 --- a/src/main/java/mServer/crawler/sender/phoenix/parser/PhoenixSendungOverviewDeserializer.java +++ b/src/main/java/mServer/crawler/sender/phoenix/parser/PhoenixSendungOverviewDeserializer.java @@ -9,7 +9,8 @@ import java.util.HashSet; import java.util.Optional; import java.util.Set; -import mServer.crawler.sender.orf.JsonUtils; + +import mServer.crawler.sender.base.JsonUtils; import mServer.crawler.sender.phoenix.PhoenixConstants; import mServer.crawler.sender.base.SendungOverviewDto; diff --git a/src/main/java/mServer/crawler/sender/srf/SrfCrawler.java b/src/main/java/mServer/crawler/sender/srf/SrfCrawler.java index e39218680..a59f4b95e 100644 --- a/src/main/java/mServer/crawler/sender/srf/SrfCrawler.java +++ b/src/main/java/mServer/crawler/sender/srf/SrfCrawler.java @@ -12,7 +12,7 @@ import mServer.crawler.FilmeSuchen; import mServer.crawler.sender.MediathekCrawler; import mServer.crawler.sender.base.CrawlerUrlDTO; -import mServer.crawler.sender.orf.TopicUrlDTO; +import mServer.crawler.sender.base.TopicUrlDTO; import mServer.crawler.sender.srf.tasks.SrfTopicOverviewTask; import mServer.crawler.sender.srf.tasks.SrfTopicsOverviewTask; import org.apache.logging.log4j.LogManager; diff --git a/src/main/java/mServer/crawler/sender/srf/parser/SrfTopicsDeserializer.java b/src/main/java/mServer/crawler/sender/srf/parser/SrfTopicsDeserializer.java index 12773d7dc..c6643f75a 100644 --- a/src/main/java/mServer/crawler/sender/srf/parser/SrfTopicsDeserializer.java +++ b/src/main/java/mServer/crawler/sender/srf/parser/SrfTopicsDeserializer.java @@ -9,7 +9,7 @@ import java.util.Optional; import java.util.Set; import mServer.crawler.sender.base.JsonUtils; -import mServer.crawler.sender.orf.TopicUrlDTO; +import mServer.crawler.sender.base.TopicUrlDTO; import mServer.crawler.sender.srf.SrfConstants; public class SrfTopicsDeserializer implements JsonDeserializer> { diff --git a/src/main/java/mServer/crawler/sender/srf/tasks/SrfTopicOverviewTask.java b/src/main/java/mServer/crawler/sender/srf/tasks/SrfTopicOverviewTask.java index ef65ffd82..019ed6031 100644 --- a/src/main/java/mServer/crawler/sender/srf/tasks/SrfTopicOverviewTask.java +++ b/src/main/java/mServer/crawler/sender/srf/tasks/SrfTopicOverviewTask.java @@ -11,7 +11,7 @@ import mServer.crawler.sender.base.AbstractRecursivConverterTask; import mServer.crawler.sender.base.CrawlerUrlDTO; import mServer.crawler.sender.base.PagedElementListDTO; -import mServer.crawler.sender.orf.TopicUrlDTO; +import mServer.crawler.sender.base.TopicUrlDTO; import mServer.crawler.sender.srf.SrfConstants; import mServer.crawler.sender.srf.parser.SrfTopicDeserializer; diff --git a/src/main/java/mServer/crawler/sender/srf/tasks/SrfTopicsOverviewTask.java b/src/main/java/mServer/crawler/sender/srf/tasks/SrfTopicsOverviewTask.java index 028c015b4..6ee878b82 100644 --- a/src/main/java/mServer/crawler/sender/srf/tasks/SrfTopicsOverviewTask.java +++ b/src/main/java/mServer/crawler/sender/srf/tasks/SrfTopicsOverviewTask.java @@ -10,7 +10,7 @@ import mServer.crawler.sender.ard.tasks.ArdTaskBase; import mServer.crawler.sender.base.AbstractRecursivConverterTask; import mServer.crawler.sender.base.CrawlerUrlDTO; -import mServer.crawler.sender.orf.TopicUrlDTO; +import mServer.crawler.sender.base.TopicUrlDTO; import mServer.crawler.sender.srf.SrfConstants; import mServer.crawler.sender.srf.parser.SrfTopicsDeserializer;