Skip to content

Commit

Permalink
configure crawler via configuration property
Browse files Browse the repository at this point in the history
  • Loading branch information
codingPF committed Nov 3, 2023
1 parent 8fb6640 commit 06f95c0
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 14 deletions.
2 changes: 2 additions & 0 deletions dist/mserver.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

<!-- banned film list (titles) -->
<system-bannedFilmList>file:bannedFilmList.txt</system-bannedFilmList>

<system-crawler-list>ARD,ZDF,ARTE,DW,KIKA,FRUNK,3SAT,SR,SRFPOD,ORF,PHONIX</system-crawler-list>

<system-proxy-url></system-proxy-url>
<system-proxy-port></system-proxy-port>
Expand Down
61 changes: 48 additions & 13 deletions src/main/java/mServer/crawler/FilmeSuchen.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,20 @@
import mServer.crawler.sender.sr.SrCrawler;
import mServer.crawler.sender.srf.SrfCrawler;
import mServer.crawler.sender.zdf.ZdfCrawler;
import mServer.tool.MserverDaten;
import mServer.tool.MserverKonstanten;
import mServer.tool.StatsUpload;
import org.apache.commons.lang3.time.FastDateFormat;

import javax.swing.event.EventListenerList;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;


/**
* ###########################################################################################################
Expand All @@ -71,19 +77,48 @@ public FilmeSuchen() {
// für jeden Sender einen MediathekReader anlegen, mit der Prio ob
// sofort gestartet oder erst später
//Reader laden Spaltenweises Laden
mediathekListe.add(new ArdCrawler(this, 0));
mediathekListe.add(new ZdfCrawler(this, 0));
mediathekListe.add(new MediathekArte(this, 0));
mediathekListe.add(new DreiSatCrawler(this, 1));
mediathekListe.add(new DwCrawler(this, 0));
mediathekListe.add(new KikaApiCrawler(this, 0));
mediathekListe.add(new FunkCrawler(this, 0));
// Spalte 2
mediathekListe.add(new SrCrawler(this, 1));
mediathekListe.add(new SrfCrawler(this, 1));
mediathekListe.add(new MediathekSrfPod(this, 1));
mediathekListe.add(new OrfCrawler(this, 1));
mediathekListe.add(new PhoenixCrawler(this, 1));
List<String> crawlerList = Arrays.asList(MserverDaten.system[MserverKonstanten.SYSTEM_CRAWLER_LIST_NR].split(","));
if (crawlerList.isEmpty()) {
crawlerList = new ArrayList<>(Arrays.asList("ARD","ZDF","ARTE","DW","KIKA","FRUNK","3SAT","SR","SRFPOD","ORF","PHONIX"));
}

if (crawlerList.contains("ARD")) {
mediathekListe.add(new ArdCrawler(this, 0));
}
if (crawlerList.contains("ZDF")) {
mediathekListe.add(new ZdfCrawler(this, 0));
}
if (crawlerList.contains("ARTE")) {
mediathekListe.add(new MediathekArte(this, 0));
}
if (crawlerList.contains("DW")) {
mediathekListe.add(new DwCrawler(this, 0));
}
if (crawlerList.contains("KIKA")) {
mediathekListe.add(new KikaApiCrawler(this, 0));
}
if (crawlerList.contains("FUNK")) {
mediathekListe.add(new FunkCrawler(this, 0));
}
if (crawlerList.contains("3SAT")) {
mediathekListe.add(new DreiSatCrawler(this, 1));
}
if (crawlerList.contains("SR")) {
mediathekListe.add(new SrCrawler(this, 1));
}
if (crawlerList.contains("SRF")) {
mediathekListe.add(new SrfCrawler(this, 1));
}
if (crawlerList.contains("SRFPOD")) {
mediathekListe.add(new MediathekSrfPod(this, 1));
}
if (crawlerList.contains("ORF")) {
mediathekListe.add(new OrfCrawler(this, 1));
}
if (crawlerList.contains("PHONIX")) {
mediathekListe.add(new PhoenixCrawler(this, 1));
}

}

public static String[] getNamenSender() {
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/mServer/tool/MserverKonstanten.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,15 @@ public class MserverKonstanten {

public static final String SYSTEM_BANNEDFILMLIST = "system-bannedFilmList";
public static final int SYSTEM_BANNEDFILMLIST_NR = 16;

public static final String SYSTEM_CRAWLER_LIST = "system-crawler-list";
public static final int SYSTEM_CRAWLER_LIST_NR = 17;

public static final String[] SYSTEM_COLUMN_NAMES = {
SYSTEM_USER_AGENT, SYSTEM_IMPORT_URL_1, SYSTEM_IMPORT_URL_2, SYSTEM_IMPORT_OLD,
SYSTEM_IMPORT_AKT, SYSTEM_EXPORT_AKT, SYSTEM_IMPORT_LIVE,
SYSTEM_EXPORT_FILMLISTE_AKT, SYSTEM_EXPORT_FILMLISTE_ORG, SYSTEM_EXPORT_FILMLISTE_DIFF, SYSTEM_FILMLISTE_ORG,
SYSTEM_PROXY_URL, SYSTEM_PROXY_PORT, SYSTEM_DEBUG, SYSTEM_RESTART_AFTER_RUN, SYSTEM_SR_RATELIMIT_RUN, SYSTEM_BANNEDFILMLIST
SYSTEM_PROXY_URL, SYSTEM_PROXY_PORT, SYSTEM_DEBUG, SYSTEM_RESTART_AFTER_RUN, SYSTEM_SR_RATELIMIT_RUN, SYSTEM_BANNEDFILMLIST, SYSTEM_CRAWLER_LIST
};

public static final int SYSTEM_MAX_ELEM = SYSTEM_COLUMN_NAMES.length;
Expand Down

0 comments on commit 06f95c0

Please sign in to comment.