summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorByteHamster <ByteHamster@users.noreply.github.com>2021-10-30 12:25:00 +0200
committerGitHub <noreply@github.com>2021-10-30 12:25:00 +0200
commit31c0f90d0720518705da6a86b2541c2b38b054b8 (patch)
tree1d92e52196a36589e037218a93b1844c5d81e005
parentf4d3ebb22de54985466c5776e22ca4da8b3c7acc (diff)
parentc7020376199cec2130051c0f01250c517b5763d6 (diff)
downloadAntennaPod-31c0f90d0720518705da6a86b2541c2b38b054b8.zip
Merge pull request #5502 from ByteHamster/data-folder-for-subscriptions
Use data folder for initial subscriptions
-rw-r--r--app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java11
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/storage/DownloadRequester.java6
2 files changed, 13 insertions, 4 deletions
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);
}