use of de.danoeh.antennapod.core.util.vorbiscommentreader.VorbisCommentChapterReader in project AntennaPod by AntennaPod.
the class ChapterUtils method readOggChaptersFromInputStream.
private static void readOggChaptersFromInputStream(Playable p, InputStream input) {
if (BuildConfig.DEBUG)
Log.d(TAG, "Trying to read chapters from item with title " + p.getEpisodeTitle());
try {
VorbisCommentChapterReader reader = new VorbisCommentChapterReader();
reader.readInputStream(input);
List<Chapter> chapters = reader.getChapters();
if (chapters != null) {
Collections.sort(chapters, new ChapterStartTimeComparator());
processChapters(chapters, p);
if (chaptersValid(chapters)) {
p.setChapters(chapters);
Log.i(TAG, "Chapters loaded");
} else {
Log.e(TAG, "Chapter data was invalid");
}
} else {
Log.i(TAG, "ChapterReader could not find any Ogg vorbis chapters");
}
} catch (VorbisCommentReaderException e) {
e.printStackTrace();
}
}
Aggregations