From 2d6eb39480973d992f3489ab0770cfb28fc420ef Mon Sep 17 00:00:00 2001 From: CodingPF Date: Sat, 18 Nov 2023 18:04:54 +0100 Subject: [PATCH] fix DW to always have normal url, fix testcase --- .../crawler/dw/parser/DwFilmDetailDeserializer.java | 10 +++++++++- .../crawler/srf/parser/SrfFilmJsonDeserializer.java | 4 ---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/de/mediathekview/mserver/crawler/dw/parser/DwFilmDetailDeserializer.java b/src/main/java/de/mediathekview/mserver/crawler/dw/parser/DwFilmDetailDeserializer.java index 4573d57d4..df5703c78 100644 --- a/src/main/java/de/mediathekview/mserver/crawler/dw/parser/DwFilmDetailDeserializer.java +++ b/src/main/java/de/mediathekview/mserver/crawler/dw/parser/DwFilmDetailDeserializer.java @@ -234,7 +234,15 @@ private Optional> getVideos( LOG.error("Malformed video url for video: {}", videoid); } }); - + if (videoListe.size() > 0 && !videoListe.containsKey(Resolution.NORMAL)) { + if (videoListe.containsKey(Resolution.SMALL)) { + videoListe.put(Resolution.NORMAL, videoListe.get(Resolution.SMALL)); + videoListe.remove(Resolution.SMALL); + } else { + videoListe.put(Resolution.NORMAL, videoListe.get(Resolution.HD)); + videoListe.remove(Resolution.HD); + } + } if (videoListe.size() > 0) { return Optional.of(videoListe); } diff --git a/src/main/java/de/mediathekview/mserver/crawler/srf/parser/SrfFilmJsonDeserializer.java b/src/main/java/de/mediathekview/mserver/crawler/srf/parser/SrfFilmJsonDeserializer.java index cc927a884..d3bf9d359 100644 --- a/src/main/java/de/mediathekview/mserver/crawler/srf/parser/SrfFilmJsonDeserializer.java +++ b/src/main/java/de/mediathekview/mserver/crawler/srf/parser/SrfFilmJsonDeserializer.java @@ -79,10 +79,6 @@ private void addUrls(final Map aVideoUrls, final Film aFilm, LOG.error(String.format("A found download URL \"%s\" isn't valid.", value), ex); } }); - // we are not ready to have pure audiodescription entries - if (aFilm.getUrls().size() == 0 && aFilm.getAudioDescriptions().size() > 0) { - aFilm.addAllUrls(aFilm.getAudioDescriptions()); - } } private static Optional buildWebsiteUrl(