[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<AudioStream> audioStreams = new ArrayList<>();
|
||||||
private final List<VideoStream> videoStreams = new ArrayList<>();
|
private final List<VideoStream> videoStreams = new ArrayList<>();
|
||||||
|
|
||||||
|
private ParsingException subtitlesException = null;
|
||||||
|
|
||||||
public PeertubeStreamExtractor(final StreamingService service, final LinkHandler linkHandler)
|
public PeertubeStreamExtractor(final StreamingService service, final LinkHandler linkHandler)
|
||||||
throws ParsingException {
|
throws ParsingException {
|
||||||
super(service, linkHandler);
|
super(service, linkHandler);
|
||||||
|
@ -262,13 +264,19 @@ public class PeertubeStreamExtractor extends StreamExtractor {
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public List<SubtitlesStream> getSubtitlesDefault() {
|
public List<SubtitlesStream> getSubtitlesDefault() throws ParsingException {
|
||||||
|
if (subtitlesException != null) {
|
||||||
|
throw subtitlesException;
|
||||||
|
}
|
||||||
return subtitles;
|
return subtitles;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@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()
|
return subtitles.stream()
|
||||||
.filter(sub -> sub.getFormat() == format)
|
.filter(sub -> sub.getFormat() == format)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
@ -420,8 +428,8 @@ public class PeertubeStreamExtractor extends StreamExtractor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (final Exception ignored) {
|
} catch (final Exception e) {
|
||||||
// Ignore all exceptions
|
subtitlesException = new ParsingException("Could not get subtitles", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue