Merge pull request #5786 from ByteHamster/subscribe-filename
Use data folder for initial subscriptions
This commit is contained in:
commit
60e2c2e113
|
@ -50,7 +50,6 @@ import de.danoeh.antennapod.core.service.download.HttpDownloader;
|
||||||
import de.danoeh.antennapod.core.service.playback.PlaybackService;
|
import de.danoeh.antennapod.core.service.playback.PlaybackService;
|
||||||
import de.danoeh.antennapod.core.storage.DBReader;
|
import de.danoeh.antennapod.core.storage.DBReader;
|
||||||
import de.danoeh.antennapod.core.storage.DBWriter;
|
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||||
import de.danoeh.antennapod.core.util.FileNameGenerator;
|
|
||||||
import de.danoeh.antennapod.parser.feed.FeedHandler;
|
import de.danoeh.antennapod.parser.feed.FeedHandler;
|
||||||
import de.danoeh.antennapod.parser.feed.FeedHandlerResult;
|
import de.danoeh.antennapod.parser.feed.FeedHandlerResult;
|
||||||
import de.danoeh.antennapod.core.util.DownloadError;
|
import de.danoeh.antennapod.core.util.DownloadError;
|
||||||
|
@ -291,12 +290,11 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
|
||||||
Log.d(TAG, "Starting feed download");
|
Log.d(TAG, "Starting feed download");
|
||||||
url = URLChecker.prepareURL(url);
|
url = URLChecker.prepareURL(url);
|
||||||
feed = new Feed(url, null);
|
feed = new Feed(url, null);
|
||||||
String fileUrl = new File(getExternalCacheDir(),
|
DownloadRequest request = DownloadRequestCreator.create(feed)
|
||||||
FileNameGenerator.generateFileName(feed.getDownload_url())).toString();
|
.withAuthentication(username, password)
|
||||||
feed.setFile_url(fileUrl);
|
.withInitiatedByUser(true)
|
||||||
final DownloadRequest request = new DownloadRequest(feed.getFile_url(),
|
.build();
|
||||||
feed.getDownload_url(), "OnlineFeed", 0, Feed.FEEDFILETYPE_FEED, username, password,
|
feed.setFile_url(request.getDestination());
|
||||||
true, null, true);
|
|
||||||
|
|
||||||
download = Observable.fromCallable(() -> {
|
download = Observable.fromCallable(() -> {
|
||||||
feeds = DBReader.getFeedList();
|
feeds = DBReader.getFeedList();
|
||||||
|
|
|
@ -290,8 +290,9 @@ public class DownloadRequest implements Parcelable {
|
||||||
this.feedfileType = feed.getTypeAsInt();
|
this.feedfileType = feed.getTypeAsInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInitiatedByUser(boolean initiatedByUser) {
|
public Builder withInitiatedByUser(boolean initiatedByUser) {
|
||||||
this.initiatedByUser = initiatedByUser;
|
this.initiatedByUser = initiatedByUser;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setForce(boolean force) {
|
public void setForce(boolean force) {
|
||||||
|
|
|
@ -500,7 +500,7 @@ public class DownloadService extends Service {
|
||||||
for (Feed feed : feeds) {
|
for (Feed feed : feeds) {
|
||||||
if (feed.getPreferences().getKeepUpdated()) {
|
if (feed.getPreferences().getKeepUpdated()) {
|
||||||
DownloadRequest.Builder builder = DownloadRequestCreator.create(feed);
|
DownloadRequest.Builder builder = DownloadRequestCreator.create(feed);
|
||||||
builder.setInitiatedByUser(initiatedByUser);
|
builder.withInitiatedByUser(initiatedByUser);
|
||||||
addNewRequest(builder.build());
|
addNewRequest(builder.build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ public class AutomaticDownloadAlgorithm {
|
||||||
List<DownloadRequest> requests = new ArrayList<>();
|
List<DownloadRequest> requests = new ArrayList<>();
|
||||||
for (FeedItem episode : itemsToDownload) {
|
for (FeedItem episode : itemsToDownload) {
|
||||||
DownloadRequest.Builder request = DownloadRequestCreator.create(episode.getMedia());
|
DownloadRequest.Builder request = DownloadRequestCreator.create(episode.getMedia());
|
||||||
request.setInitiatedByUser(false);
|
request.withInitiatedByUser(false);
|
||||||
requests.add(request.build());
|
requests.add(request.build());
|
||||||
}
|
}
|
||||||
DownloadService.download(context, false, requests.toArray(new DownloadRequest[0]));
|
DownloadService.download(context, false, requests.toArray(new DownloadRequest[0]));
|
||||||
|
|
|
@ -161,7 +161,7 @@ public final class DBTasks {
|
||||||
|
|
||||||
private static void forceRefreshFeed(Context context, Feed feed, boolean loadAllPages, boolean initiatedByUser) {
|
private static void forceRefreshFeed(Context context, Feed feed, boolean loadAllPages, boolean initiatedByUser) {
|
||||||
DownloadRequest.Builder builder = DownloadRequestCreator.create(feed);
|
DownloadRequest.Builder builder = DownloadRequestCreator.create(feed);
|
||||||
builder.setInitiatedByUser(initiatedByUser);
|
builder.withInitiatedByUser(initiatedByUser);
|
||||||
builder.setForce(true);
|
builder.setForce(true);
|
||||||
builder.loadAllPages(loadAllPages);
|
builder.loadAllPages(loadAllPages);
|
||||||
DownloadService.download(context, false, builder.build());
|
DownloadService.download(context, false, builder.build());
|
||||||
|
|
Loading…
Reference in New Issue