diff --git a/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java index ec9e20dea..4dca1fda7 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java @@ -46,10 +46,10 @@ import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.storage.DBWriter; import de.danoeh.antennapod.core.storage.DownloadRequestException; import de.danoeh.antennapod.core.storage.DownloadRequester; +import de.danoeh.antennapod.core.util.FileNameGenerator; import de.danoeh.antennapod.parser.feed.FeedHandler; import de.danoeh.antennapod.parser.feed.FeedHandlerResult; import de.danoeh.antennapod.core.util.DownloadError; -import de.danoeh.antennapod.core.util.FileNameGenerator; import de.danoeh.antennapod.core.util.IntentUtils; import de.danoeh.antennapod.core.util.StorageUtils; import de.danoeh.antennapod.core.util.URLChecker; @@ -261,8 +261,13 @@ public class OnlineFeedViewActivity extends AppCompatActivity { feed.setPreferences(new FeedPreferences(0, false, FeedPreferences.AutoDeleteAction.GLOBAL, VolumeAdaptionSetting.OFF, username, password)); } - String fileUrl = new File(getExternalCacheDir(), - FileNameGenerator.generateFileName(feed.getDownload_url())).toString(); + String fileUrl; + try { + fileUrl = DownloadRequester.getInstance().getDownloadPathForFeed(feed).getAbsolutePath(); + } catch (DownloadRequestException e) { + e.printStackTrace(); + fileUrl = new File(getCacheDir(), FileNameGenerator.generateFileName(feed.getDownload_url())).toString(); + } feed.setFile_url(fileUrl); final DownloadRequest request = new DownloadRequest(feed.getFile_url(), feed.getDownload_url(), "OnlineFeed", 0, Feed.FEEDFILETYPE_FEED, username, password, diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/DownloadRequester.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DownloadRequester.java index f45cb2b66..6192edf7c 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/DownloadRequester.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DownloadRequester.java @@ -218,7 +218,7 @@ public class DownloadRequester implements DownloadStateProvider { args.putInt(REQUEST_ARG_PAGE_NR, feed.getPageNr()); args.putBoolean(REQUEST_ARG_LOAD_ALL_PAGES, loadAllPages); - DownloadRequest request = createRequest(feed, null, new File(getFeedfilePath(), getFeedfileName(feed)), + DownloadRequest request = createRequest(feed, null, getDownloadPathForFeed(feed), true, username, password, lastModified, true, args, initiatedByUser ); if (request != null) { @@ -230,6 +230,10 @@ public class DownloadRequester implements DownloadStateProvider { } } + public File getDownloadPathForFeed(Feed feed) throws DownloadRequestException { + return new File(getFeedfilePath(), getFeedfileName(feed)); + } + public synchronized void downloadFeed(Context context, Feed feed) throws DownloadRequestException { downloadFeed(context, feed, false, false, true); }