Skip to content

Commit b808bfa

Browse files
committed
arte fixes
2 parents 1a8a93d + f6477bc commit b808bfa

File tree

4 files changed

+29
-4
lines changed

4 files changed

+29
-4
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ sourceCompatibility = 1.8
1717
targetCompatibility = 1.8
1818
group = 'de.mediathekview'
1919
archivesBaseName = "MServer"
20-
version = '3.1.194'
20+
version = '3.1.195'
2121

2222
def jarName = 'MServer.jar'
2323
def mainClass = 'mServer.Main'

src/main/java/mServer/crawler/AddToFilmlist.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ public void run() {
302302
if (response.isSuccessful()) {
303303
long respLength = determineContentLength(response);
304304

305-
if (isRelevantContentType(response) && !orfRemovedVideo(film, response) &&
305+
if (isRelevantContentType(response) && !removedVideo(film, response) &&
306306
// ignore file length of m3u8-files because it is always too small
307307
(isM3u8File(url) || respLength > MIN_SIZE_ADD_OLD)) {
308308
addOld(film);
@@ -320,7 +320,7 @@ public void run() {
320320
if (Long.parseLong(film.arr[DatenFilm.FILM_GROESSE]) > MIN_SIZE_ADD_OLD) {
321321
Request request = createOnlineCheckRequest(url);
322322
try (Response response = client.newCall(request).execute()) {
323-
if (response.isSuccessful() && isRelevantContentType(response) && !orfRemovedVideo(film, response)) {
323+
if (response.isSuccessful() && isRelevantContentType(response) && !removedVideo(film, response)) {
324324
addOld(film);
325325
} else {
326326
Log.sysLog("film removed: code: " + response.code() + ": " + url);
@@ -335,6 +335,19 @@ public void run() {
335335
threadCounter.decrementAndGet();
336336
}
337337

338+
private boolean removedVideo(DatenFilm film, Response response) {
339+
return orfRemovedVideo(film, response) || arteRemovedVideo(film, response);
340+
}
341+
342+
private boolean arteRemovedVideo(DatenFilm film, Response response) {
343+
if (film.arr[DatenFilm.FILM_SENDER].equals(Const.ARTE_DE)) {
344+
String path = response.request().url().encodedPath();
345+
return path.contains("_EXTRAIT_");
346+
}
347+
348+
return false;
349+
}
350+
338351
private boolean orfRemovedVideo(DatenFilm film, Response response) {
339352
if (film.arr[DatenFilm.FILM_SENDER].equals(Const.ORF)) {
340353
String path = response.request().url().encodedPath();

src/main/java/mServer/crawler/sender/arte/ArteProgramIdToDatenFilmCallable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class ArteProgramIdToDatenFilmCallable implements Callable<Set<DatenFilm>
2525

2626
private static final Logger LOG = LogManager.getLogger(ArteProgramIdToDatenFilmCallable.class);
2727

28-
private static final String ARTE_VIDEO_INFORMATION_URL_PATTERN = "https://api.arte.tv/api/opa/v3/videoStreams?programId=%s&mediaType=mp4&limit=100&language=%s";
28+
private static final String ARTE_VIDEO_INFORMATION_URL_PATTERN = "https://api.arte.tv/api/opa/v3/videoStreams?programId=%s&limit=100&language=%s&protocol=HTTPS&kind=SHOW";
2929
private static final String ARTE_VIDEO_INFORMATION_URL_PATTERN_2 = "https://api.arte.tv/api/opa/v3/programs/%s/%s"; // Für broadcastBeginRounded
3030

3131
private final FastDateFormat broadcastDateFormat = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ssX");//2016-10-29T16:15:00Z

src/test/developTest/java/mServer/crawler/AddToFilmlistTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public class AddToFilmlistTest {
2727
private static final String FILM_NAME_ONLINE_M3U8 = "onlinefilm.m3u8";
2828
private static final String FILM_NAME_OFFLINE_M3U8 = "offlinefilm.m3u8";
2929
private static final String FILM_NAME_OFFLINE_BUT_HTML_RESPONSE = "ardofflinefilm.mp4";
30+
private static final String FILM_NAME_ARTE_EXTRAIT = "/am/ptweb/106000/106200/106287-011-A_EXT_EQ_1_VA-STA_06707579_MP4-1500_AMM-PTWEB_EXTRAIT_1mQDhYFo2y.mp4";
3031
private static final String FILM_NAME_ORF_JUGENDSCHUTZ = "ipad/gp/Jugendschutz0600b2000_Q8C.mp4/playlist.m3u8";
3132
private static final String FILM_TOPIC1 = "Topic 1";
3233
private static final String FILM_TOPIC2 = "Topic 2";
@@ -53,6 +54,7 @@ public MockResponse dispatch(RecordedRequest request) throws InterruptedExceptio
5354
switch (request.getPath()) {
5455
case "/" + FILM_NAME_ONLINE:
5556
case "/" + FILM_NAME_ONLINE2:
57+
case "/" + FILM_NAME_ARTE_EXTRAIT:
5658
return new MockResponse()
5759
.setResponseCode(200);
5860
case "/" + FILM_NAME_OFFLINE_BUT_HTML_RESPONSE:
@@ -311,6 +313,16 @@ public void testNotAddOrfGeoBlockOffline() {
311313
assertThat(list.size(), equalTo(2));
312314
}
313315

316+
@Test
317+
public void testNotAddArteExtraits() {
318+
listToAdd.add(createTestFilm(Const.ARTE_DE, FILM_TOPIC1, FILM_TITLE1, FILM_NAME_ARTE_EXTRAIT));
319+
320+
AddToFilmlist target = new AddToFilmlist(list, listToAdd);
321+
target.addOldList();
322+
323+
assertThat(list.size(), equalTo(2));
324+
}
325+
314326
@Test
315327
public void testRefreshArdWebsite() {
316328
final DatenFilm testFilmUpdated = createTestFilm(Const.ARD, "Tatort", "Test Tatort", FILM_NAME_ONLINE);

0 commit comments

Comments
 (0)