Skip to content

Commit 95cc6ae

Browse files
authored
Merge pull request #994 from TeamNewPipe/fix/peertube-subtitles-exception
[PeerTube] Report Exceptions thrown while getting a stream's subtitles
2 parents 7b54457 + cd32627 commit 95cc6ae

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubeStreamExtractor.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ public class PeertubeStreamExtractor extends StreamExtractor {
6161
private final List<AudioStream> audioStreams = new ArrayList<>();
6262
private final List<VideoStream> videoStreams = new ArrayList<>();
6363

64+
private ParsingException subtitlesException = null;
65+
6466
public PeertubeStreamExtractor(final StreamingService service, final LinkHandler linkHandler)
6567
throws ParsingException {
6668
super(service, linkHandler);
@@ -262,13 +264,19 @@ public List<VideoStream> getVideoOnlyStreams() {
262264

263265
@Nonnull
264266
@Override
265-
public List<SubtitlesStream> getSubtitlesDefault() {
267+
public List<SubtitlesStream> getSubtitlesDefault() throws ParsingException {
268+
if (subtitlesException != null) {
269+
throw subtitlesException;
270+
}
266271
return subtitles;
267272
}
268273

269274
@Nonnull
270275
@Override
271-
public List<SubtitlesStream> getSubtitles(final MediaFormat format) {
276+
public List<SubtitlesStream> getSubtitles(final MediaFormat format) throws ParsingException {
277+
if (subtitlesException != null) {
278+
throw subtitlesException;
279+
}
272280
return subtitles.stream()
273281
.filter(sub -> sub.getFormat() == format)
274282
.collect(Collectors.toList());
@@ -420,8 +428,8 @@ private void loadSubtitles() {
420428
}
421429
}
422430
}
423-
} catch (final Exception ignored) {
424-
// Ignore all exceptions
431+
} catch (final Exception e) {
432+
subtitlesException = new ParsingException("Could not get subtitles", e);
425433
}
426434
}
427435
}

0 commit comments

Comments
 (0)