Skip to content

Commit

Permalink
ORF: switch to orfon
Browse files Browse the repository at this point in the history
ZDF: optimize runtime
  • Loading branch information
alex1702 committed Mar 28, 2024
2 parents f35479f + 7ba449b commit d2dbf7e
Show file tree
Hide file tree
Showing 53 changed files with 1,456 additions and 1,281 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
group = 'de.mediathekview'
archivesBaseName = "MServer"
version = '3.1.229'
version = '3.1.230'

def jarName = 'MServer.jar'
def mainClass = 'mServer.Main'
Expand Down
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
4 changes: 2 additions & 2 deletions src/main/java/mServer/crawler/FilmeSuchen.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import mServer.crawler.sender.dw.DwCrawler;
import mServer.crawler.sender.funk.FunkCrawler;
import mServer.crawler.sender.kika.KikaApiCrawler;
import mServer.crawler.sender.orf.OrfCrawler;
import mServer.crawler.sender.orfon.OrfOnCrawler;
import mServer.crawler.sender.phoenix.PhoenixCrawler;
import mServer.crawler.sender.sr.SrCrawler;
import mServer.crawler.sender.srf.SrfCrawler;
Expand Down Expand Up @@ -113,7 +113,7 @@ public FilmeSuchen() {
mediathekListe.add(new MediathekSrfPod(this, 1));
}
if (crawlerList.contains("ORF")) {
mediathekListe.add(new OrfCrawler(this, 1));
mediathekListe.add(new OrfOnCrawler(this, 1));
}
if (crawlerList.contains("PHONIX")) {
mediathekListe.add(new PhoenixCrawler(this, 1));
Expand Down
15 changes: 13 additions & 2 deletions src/main/java/mServer/crawler/sender/base/JsonUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,18 @@ public static boolean hasStringElements(
}

public static Optional<String> getElementValueAsString(final JsonElement aJsonElement, final String... aElementIds) {
Optional<String> rs = Optional.empty();
Optional<JsonElement> rs = JsonUtils.getElement(aJsonElement, aElementIds);
if (rs.isPresent()) {
return Optional.of(rs.get().getAsString());
}
return Optional.empty();
}

public static Optional<JsonElement> getElement(final JsonElement aJsonElement, final String... aElementIds) {
Optional<JsonElement> rs = Optional.empty();
if (aElementIds == null || aElementIds.length == 0) {
return rs;
}
JsonObject aJsonObject = aJsonElement.getAsJsonObject();
for (int i = 0; i < aElementIds.length-1; i++) {
String elementId = aElementIds[i];
Expand All @@ -147,7 +158,7 @@ public static Optional<String> getElementValueAsString(final JsonElement aJsonEl
//
String elementId = aElementIds[aElementIds.length-1];
if (aJsonObject != null && aJsonObject.has(elementId) && !aJsonObject.get(elementId).isJsonNull()) {
rs = Optional.of(aJsonObject.get(elementId).getAsString());
rs = Optional.of(aJsonObject.get(elementId));
}
//
return rs;
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
51 changes: 0 additions & 51 deletions src/main/java/mServer/crawler/sender/orf/JsonUtils.java

This file was deleted.

35 changes: 0 additions & 35 deletions src/main/java/mServer/crawler/sender/orf/OrfConstants.java

This file was deleted.

104 changes: 0 additions & 104 deletions src/main/java/mServer/crawler/sender/orf/OrfCrawler.java

This file was deleted.

Loading

0 comments on commit d2dbf7e

Please sign in to comment.