Skip to content

Commit

Permalink
move TopicUrlDTO to base package
Browse files Browse the repository at this point in the history
  • Loading branch information
pidoubleyou committed Mar 24, 2024
1 parent d10f523 commit 45d3437
Show file tree
Hide file tree
Showing 14 changed files with 53 additions and 50 deletions.
4 changes: 2 additions & 2 deletions src/main/java/mServer/crawler/AddToFilmlist.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -114,7 +114,7 @@ private void performUrlSearch(HashSet<Hash> 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];
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
@@ -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";
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Optional<PhoenixFilmDetailDto>> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/mServer/crawler/sender/srf/SrfCrawler.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Set<TopicUrlDTO>> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 45d3437

Please sign in to comment.