[PeerTube] Report Exceptions thrown while getting a stream's subtitles
This commit is contained in:
parent
41c8dce452
commit
cd3262745d
|
@ -61,6 +61,8 @@ public class PeertubeStreamExtractor extends StreamExtractor {
|
|||
private final List<AudioStream> audioStreams = new ArrayList<>();
|
||||
private final List<VideoStream> videoStreams = new ArrayList<>();
|
||||
|
||||
private ParsingException subtitlesException = null;
|
||||
|
||||
public PeertubeStreamExtractor(final StreamingService service, final LinkHandler linkHandler)
|
||||
throws ParsingException {
|
||||
super(service, linkHandler);
|
||||
|
@ -262,13 +264,19 @@ public class PeertubeStreamExtractor extends StreamExtractor {
|
|||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<SubtitlesStream> getSubtitlesDefault() {
|
||||
public List<SubtitlesStream> getSubtitlesDefault() throws ParsingException {
|
||||
if (subtitlesException != null) {
|
||||
throw subtitlesException;
|
||||
}
|
||||
return subtitles;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<SubtitlesStream> getSubtitles(final MediaFormat format) {
|
||||
public List<SubtitlesStream> getSubtitles(final MediaFormat format) throws ParsingException {
|
||||
if (subtitlesException != null) {
|
||||
throw subtitlesException;
|
||||
}
|
||||
return subtitles.stream()
|
||||
.filter(sub -> sub.getFormat() == format)
|
||||
.collect(Collectors.toList());
|
||||
|
@ -420,8 +428,8 @@ public class PeertubeStreamExtractor extends StreamExtractor {
|
|||
}
|
||||
}
|
||||
}
|
||||
} catch (final Exception ignored) {
|
||||
// Ignore all exceptions
|
||||
} catch (final Exception e) {
|
||||
subtitlesException = new ParsingException("Could not get subtitles", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue