diff --git a/src/main/java/de/mediathekview/mserver/base/config/MServerConfigDTO.java b/src/main/java/de/mediathekview/mserver/base/config/MServerConfigDTO.java index 97f7d5aff..aa35966a5 100644 --- a/src/main/java/de/mediathekview/mserver/base/config/MServerConfigDTO.java +++ b/src/main/java/de/mediathekview/mserver/base/config/MServerConfigDTO.java @@ -19,7 +19,7 @@ public class MServerConfigDTO extends MServerBasicConfigDTO implements ConfigDTO /** add livestreams from external list **/ private final ImportLivestreamConfiguration importLivestreamConfiguration; /** add additional filmlist from external **/ - private final List ImportFilmlistConfigurations; + private final List importFilmlistConfigurations; /** The maximum amount of cpu threads to be used. */ private Integer maximumCpuThreads; /** @@ -90,8 +90,7 @@ public MServerConfigDTO() { filmlistIdFilePath = "filmlist.id"; ignoreFilmlistPath = "ignoreFilmlist.txt"; importLivestreamConfiguration = new ImportLivestreamConfiguration(false, "live-streams.json", FilmlistFormats.OLD_JSON); - ImportFilmlistConfigurations = new ArrayList(); - //ImportFilmlistConfigurations.add(new ImportFilmlistConfiguration(false, "https://verteiler1.mediathekview.de/Filmliste-akt.xz", FilmlistFormats.OLD_JSON_COMPRESSED_XZ, true)); + importFilmlistConfigurations = new ArrayList<>(); Arrays.stream(Sender.values()) .forEach(sender -> senderConfigurations.put(sender, new MServerBasicConfigDTO(this))); @@ -254,7 +253,7 @@ public ImportLivestreamConfiguration getImportLivestreamConfiguration() { } public List getImportFilmlistConfigurations() { - return ImportFilmlistConfigurations; + return importFilmlistConfigurations; } /** diff --git a/src/main/java/de/mediathekview/mserver/base/utils/CheckUrlAvailability.java b/src/main/java/de/mediathekview/mserver/base/utils/CheckUrlAvailability.java index 75c547605..45dc0eadd 100644 --- a/src/main/java/de/mediathekview/mserver/base/utils/CheckUrlAvailability.java +++ b/src/main/java/de/mediathekview/mserver/base/utils/CheckUrlAvailability.java @@ -16,7 +16,7 @@ public class CheckUrlAvailability { private static final Logger LOG = LogManager.getLogger(CheckUrlAvailability.class); private Long minFileSize = 2048L; private int removedCounter = 0; - private long timeoutInMS = 1*60*1000; + private long timeoutInMS = 1*60*1000L; private boolean timeout = false; private long start = 0; private FileSizeDeterminer fsd = new FileSizeDeterminer(); @@ -32,7 +32,7 @@ public Filmlist getAvaiableFilmlist(final Filmlist importList) { Filmlist filteredFilmlist = new Filmlist(); filteredFilmlist.setCreationDate(importList.getCreationDate()); filteredFilmlist.setListId(importList.getListId()); - importList.getFilms().values().stream().parallel().filter(e -> { return isAvailable(e);}).forEach(filteredFilmlist::add); + importList.getFilms().values().stream().parallel().filter(this::isAvailable).forEach(filteredFilmlist::add); LOG.debug("checked {} urls and removed {} in {} sec and timeout was reached: {}", importList.getFilms().size(), removedCounter, ((System.currentTimeMillis()-start)/1000), timeout); return filteredFilmlist; } diff --git a/src/main/java/de/mediathekview/mserver/crawler/basic/TimeoutTask.java b/src/main/java/de/mediathekview/mserver/crawler/basic/TimeoutTask.java index 331bf3203..740e54df5 100644 --- a/src/main/java/de/mediathekview/mserver/crawler/basic/TimeoutTask.java +++ b/src/main/java/de/mediathekview/mserver/crawler/basic/TimeoutTask.java @@ -3,7 +3,13 @@ import java.time.Duration; import java.time.LocalDateTime; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import de.mediathekview.mserver.crawler.arte.ArteCrawler; + public abstract class TimeoutTask extends Thread { + private static final Logger LOG = LogManager.getLogger(ArteCrawler.class); private final long maxTime; private boolean isRun; @@ -24,7 +30,9 @@ public void run() { shutdown(); stopTimeout(); } - try {Thread.sleep(60*1000);} catch (InterruptedException e) {} + try {Thread.sleep(60*1000L);} catch (InterruptedException e) { + LOG.error(e); + } } } diff --git a/src/main/java/de/mediathekview/mserver/crawler/kika/tasks/KikaApiFilmTask.java b/src/main/java/de/mediathekview/mserver/crawler/kika/tasks/KikaApiFilmTask.java index 99ae9b840..4d68062cc 100644 --- a/src/main/java/de/mediathekview/mserver/crawler/kika/tasks/KikaApiFilmTask.java +++ b/src/main/java/de/mediathekview/mserver/crawler/kika/tasks/KikaApiFilmTask.java @@ -27,7 +27,6 @@ import de.mediathekview.mlib.daten.FilmUrl; import de.mediathekview.mlib.daten.GeoLocations; import de.mediathekview.mlib.daten.Resolution; -import de.mediathekview.mlib.tool.FileSizeDeterminer; import de.mediathekview.mserver.base.utils.UrlUtils; import de.mediathekview.mserver.crawler.basic.AbstractCrawler; import de.mediathekview.mserver.crawler.basic.AbstractJsonRestTask; diff --git a/src/test/java/de/mediathekview/mserver/crawler/CrawlerManagerImportFilmlistsTest.java b/src/test/java/de/mediathekview/mserver/crawler/CrawlerManagerImportFilmlistsTest.java index 61859db92..6718b4afc 100644 --- a/src/test/java/de/mediathekview/mserver/crawler/CrawlerManagerImportFilmlistsTest.java +++ b/src/test/java/de/mediathekview/mserver/crawler/CrawlerManagerImportFilmlistsTest.java @@ -77,7 +77,7 @@ static Stream getTestArgumentForFilmlistsInDifferentFormats() { @ParameterizedTest @Execution(ExecutionMode.SAME_THREAD) @MethodSource("getTestArgumentForFilmlistsInDifferentFormats") - public void testSaveAndImport(final ImportFilmlistConfiguration initialList, final ImportFilmlistConfiguration additionalList, final int expectedSize, final int expectedDiffListSize) { + void testSaveAndImport(final ImportFilmlistConfiguration initialList, final ImportFilmlistConfiguration additionalList, final int expectedSize, final int expectedDiffListSize) { CrawlerManager crawlerManagerForEachRun = createEmptyCrawlerManager(); crawlerManagerForEachRun.addMessageListener(this); crawlerManagerForEachRun.importFilmlist(initialList);