From 70dbde22f322cce273ecfed4898f7887c12d7a93 Mon Sep 17 00:00:00 2001 From: pidoubleyou Date: Mon, 18 Sep 2023 21:45:25 +0200 Subject: [PATCH 1/3] reactivate ARTE.FR --- .../java/mServer/crawler/sender/arte/MediathekArte.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/mServer/crawler/sender/arte/MediathekArte.java b/src/main/java/mServer/crawler/sender/arte/MediathekArte.java index 44f471457..534af863a 100644 --- a/src/main/java/mServer/crawler/sender/arte/MediathekArte.java +++ b/src/main/java/mServer/crawler/sender/arte/MediathekArte.java @@ -84,7 +84,7 @@ protected synchronized void meldungStart() { super.meldungStart(); senderLanguages.put(Const.ARTE_DE, "de"); - // senderLanguages.put(Const.ARTE_FR, "fr"); + senderLanguages.put(Const.ARTE_FR, "fr"); /*if (LocalDate.now().getDayOfYear() % 2 == 0) { senderLanguages.put(ARTE_EN, "en"); senderLanguages.put(ARTE_ES, "es"); @@ -233,11 +233,11 @@ private void loadCategory(String sender, String langCode, String aCategory, Stri ArteCategoryFilmsDTO dto = loadSubCategoryPage(gson, sender, aUrl); if (dto != null) { loadCollections(sender, langCode, gsonCollectionParent, gsonCollectionChild, dto); - Log.sysLog(String.format("%s: %d, %d", aCategory, dto.getProgramIds().size(), dto.getCollectionIds().size())); + Log.sysLog(String.format("%s: category %s: %d programs, %d collections", sender, aCategory, dto.getProgramIds().size(), dto.getCollectionIds().size())); // alle programIds verarbeiten ListeFilme loadedFilme = loadPrograms(sender, langCode, dto); loadedFilme.forEach(film -> addFilm(film)); - Log.sysLog(String.format("%s: Subcategory %s: %d Filme", sender, aCategory, loadedFilme.size())); + Log.sysLog(String.format("%s: category %s: %d Filme", sender, aCategory, loadedFilme.size())); } } From 3dd3ac81465dac1b3f712407789af0980779a434 Mon Sep 17 00:00:00 2001 From: pidoubleyou Date: Mon, 18 Sep 2023 21:54:09 +0200 Subject: [PATCH 2/3] fix ARTE.FR problems --- .../ArteCategoryFilmListDeserializer.java | 22 ++++++++++--------- .../sender/arte/ArteCategoryFilmsDTO.java | 11 +++++----- .../ArteCategoryFilmListDeserializerTest.java | 4 ++-- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/main/java/mServer/crawler/sender/arte/ArteCategoryFilmListDeserializer.java b/src/main/java/mServer/crawler/sender/arte/ArteCategoryFilmListDeserializer.java index c1676d879..7484c964e 100644 --- a/src/main/java/mServer/crawler/sender/arte/ArteCategoryFilmListDeserializer.java +++ b/src/main/java/mServer/crawler/sender/arte/ArteCategoryFilmListDeserializer.java @@ -41,17 +41,19 @@ public ArteCategoryFilmsDTO deserialize(JsonElement aJsonElement, Type aType, Js final JsonObject contentObject = jsonElement.getAsJsonObject().get(JSON_ELEMENT_CONTENT).getAsJsonObject(); if (contentObject.has(JSON_ELEMENT_DATA)) { for(JsonElement dataElement : contentObject.get(JSON_ELEMENT_DATA).getAsJsonArray()) { - String programId = dataElement.getAsJsonObject().get(JSON_ELEMENT_PROGRAMID).getAsString(); - if (programId != null) { - if (programId.startsWith("RC-")) { - try { - long collectionId = Long.parseLong(programId.replace("RC-", "")); - dto.addCollection(String.format("RC-%06d", collectionId)); - } catch (NumberFormatException e) { - Log.errorLog(12834939, "Invalid collection id: " + programId); + if (!dataElement.getAsJsonObject().get(JSON_ELEMENT_PROGRAMID).isJsonNull()) { + String programId = dataElement.getAsJsonObject().get(JSON_ELEMENT_PROGRAMID).getAsString(); + if (programId != null) { + if (programId.startsWith("RC-")) { + try { + long collectionId = Long.parseLong(programId.replace("RC-", "")); + dto.addCollection(String.format("RC-%06d", collectionId)); + } catch (NumberFormatException e) { + Log.errorLog(12834939, "Invalid collection id: " + programId); + } + } else { + dto.addProgramId(programId); } - } else { - dto.addProgramId(programId); } } } diff --git a/src/main/java/mServer/crawler/sender/arte/ArteCategoryFilmsDTO.java b/src/main/java/mServer/crawler/sender/arte/ArteCategoryFilmsDTO.java index 3d85200de..7cd40a628 100644 --- a/src/main/java/mServer/crawler/sender/arte/ArteCategoryFilmsDTO.java +++ b/src/main/java/mServer/crawler/sender/arte/ArteCategoryFilmsDTO.java @@ -1,11 +1,12 @@ package mServer.crawler.sender.arte; -import java.util.ArrayList; +import java.util.HashSet; +import java.util.Set; public class ArteCategoryFilmsDTO { - private final ArrayList programIds = new ArrayList<>(); - private final ArrayList collectionIds = new ArrayList<>(); + private final Set programIds = new HashSet<>(); + private final Set collectionIds = new HashSet<>(); private boolean hasNextPage; @@ -16,10 +17,10 @@ public void addCollection(String aCollectionId) { collectionIds.add(aCollectionId); } - public ArrayList getProgramIds() { + public Set getProgramIds() { return programIds; } - public ArrayList getCollectionIds() { + public Set getCollectionIds() { return collectionIds; } diff --git a/src/test/developTest/java/mServer/crawler/sender/arte/ArteCategoryFilmListDeserializerTest.java b/src/test/developTest/java/mServer/crawler/sender/arte/ArteCategoryFilmListDeserializerTest.java index 94682da9c..f2c219568 100644 --- a/src/test/developTest/java/mServer/crawler/sender/arte/ArteCategoryFilmListDeserializerTest.java +++ b/src/test/developTest/java/mServer/crawler/sender/arte/ArteCategoryFilmListDeserializerTest.java @@ -7,9 +7,9 @@ import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.Set; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.notNullValue; @@ -45,7 +45,7 @@ public void testDeserialize() { assertThat(actual, notNullValue()); assertThat(actual.hasNextPage(), equalTo(expectedHasNextPage)); - ArrayList actualProgramIds = actual.getProgramIds(); + Set actualProgramIds = actual.getProgramIds(); assertThat(actualProgramIds, Matchers.containsInAnyOrder(expectedProgramIds)); } } From 44c112c1f88cda194079edb43436fb6dd165d673 Mon Sep 17 00:00:00 2001 From: Alexander F Date: Sat, 23 Sep 2023 19:49:05 +0200 Subject: [PATCH 3/3] Version auf 3.1.220 angehoben --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index e4bc6aebd..42b721c0f 100644 --- a/build.gradle +++ b/build.gradle @@ -27,7 +27,7 @@ sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 group = 'de.mediathekview' archivesBaseName = "MServer" -version = '3.1.219' +version = '3.1.220' def jarName = 'MServer.jar' def mainClass = 'mServer.Main'