From 94be6d1217f9aea852bd97c6fd08a3be801cd7d4 Mon Sep 17 00:00:00 2001 From: CodingPF Date: Fri, 17 May 2024 21:11:39 +0200 Subject: [PATCH] clean title for UT,AD --- .../crawler/ard/json/ArdFilmDeserializer.java | 35 ++++++------------- 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/src/main/java/de/mediathekview/mserver/crawler/ard/json/ArdFilmDeserializer.java b/src/main/java/de/mediathekview/mserver/crawler/ard/json/ArdFilmDeserializer.java index 529d7bb7f..e5861ad28 100644 --- a/src/main/java/de/mediathekview/mserver/crawler/ard/json/ArdFilmDeserializer.java +++ b/src/main/java/de/mediathekview/mserver/crawler/ard/json/ArdFilmDeserializer.java @@ -185,7 +185,6 @@ public List deserialize( return films; } - // add film to ARD final ArdFilmDto filmDto = new ArdFilmDto( @@ -223,31 +222,19 @@ private Optional> fallbackToM3U(Optional parseTitle(final JsonObject playerPageObject) { - final Optional title = - JsonUtils.getAttributeAsString(playerPageObject, ATTRIBUTE_TITLE); - return title.map(nonNullTitle -> nonNullTitle.replace("Hörfassung", "Audiodeskription")); - } - - /* - private Sender determinePartner(JsonObject playerPageObject) { - final Optional partner = parsePartner(playerPageObject); - // If partner is present and an existing sender set it. Like for RBB - Sender partnerSender = null; - if (partner.isPresent()) { - partnerSender = ArdConstants.PARTNER_TO_SENDER.get(partner.get()); - if (partnerSender != null) { - return partnerSender; - } else { - partnerSender = Sender.ARD; - LOG.info("unkown partner {}", partner.get() ); + Optional title = JsonUtils.getAttributeAsString(playerPageObject, ATTRIBUTE_TITLE); + if (title.isPresent()) { + String[] replaceWords = {" - Hörfassung", " (mit Gebärdensprache)", " mit Gebärdensprache"," (mit Audiodeskription)", "Audiodeskription"}; + String cleanTitle = title.get().trim(); + for (String replaceWord : replaceWords) { + cleanTitle = cleanTitle.replace(replaceWord, ""); } - } else { - partnerSender = Sender.ARD; - LOG.info("missing partner {}", playerPageObject); + cleanTitle = cleanTitle.trim(); + return Optional.of(cleanTitle); } - return partnerSender; - - } */ + return title; + } + private Optional parsePartner(final JsonObject playerPageObject) { if (playerPageObject.has(ELEMENT_PUBLICATION_SERVICE)) {