Merge pull request #5502 from ByteHamster/data-folder-for-subscriptions
Use data folder for initial subscriptions
This commit is contained in:
commit
31c0f90d07
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue