Merge pull request #1681 from mfietz/issue/1680-embedded-chapters
Load embedded chapters from local files
This commit is contained in:
commit
abdf08fc8c
@ -386,11 +386,14 @@ public class FeedMedia extends FeedFile implements Playable {
|
||||
// check if chapters are stored in db and not loaded yet.
|
||||
if (item != null && item.hasChapters() && item.getChapters() == null) {
|
||||
DBReader.loadChaptersOfFeedItem(item);
|
||||
} else if (item != null && item.getChapters() == null && !localFileAvailable()) {
|
||||
ChapterUtils.loadChaptersFromStreamUrl(this);
|
||||
} else if (item != null && item.getChapters() == null) {
|
||||
if(localFileAvailable()) {
|
||||
ChapterUtils.loadChaptersFromFileUrl(this);
|
||||
} else {
|
||||
ChapterUtils.loadChaptersFromStreamUrl(this);
|
||||
}
|
||||
if (getChapters() != null && item != null) {
|
||||
DBWriter.setFeedItem(
|
||||
item);
|
||||
DBWriter.setFeedItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,6 +72,7 @@ import de.danoeh.antennapod.core.storage.DownloadRequester;
|
||||
import de.danoeh.antennapod.core.syndication.handler.FeedHandler;
|
||||
import de.danoeh.antennapod.core.syndication.handler.FeedHandlerResult;
|
||||
import de.danoeh.antennapod.core.syndication.handler.UnsupportedFeedtypeException;
|
||||
import de.danoeh.antennapod.core.util.ChapterUtils;
|
||||
import de.danoeh.antennapod.core.util.DownloadError;
|
||||
import de.danoeh.antennapod.core.util.InvalidFeedException;
|
||||
import de.greenrobot.event.EventBus;
|
||||
@ -1046,6 +1047,9 @@ public class DownloadService extends Service {
|
||||
media.setFile_url(request.getDestination());
|
||||
media.setHasEmbeddedPicture(null);
|
||||
|
||||
// check if file has chapters
|
||||
ChapterUtils.loadChaptersFromFileUrl(media);
|
||||
|
||||
// Get duration
|
||||
MediaMetadataRetriever mmr = null;
|
||||
try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user