Image might not have been saved correctly after download
This commit is contained in:
parent
1c24794ed2
commit
cd7c368287
@ -1,8 +1,8 @@
|
|||||||
package de.danoeh.antennapod.feed;
|
package de.danoeh.antennapod.feed;
|
||||||
|
|
||||||
|
|
||||||
public class FeedImage extends FeedFile {
|
public class FeedImage extends FeedFile {
|
||||||
protected String title;
|
protected String title;
|
||||||
|
protected Feed feed;
|
||||||
|
|
||||||
public FeedImage(String download_url, String title) {
|
public FeedImage(String download_url, String title) {
|
||||||
super(null, download_url, false);
|
super(null, download_url, false);
|
||||||
@ -29,4 +29,12 @@ public class FeedImage extends FeedFile {
|
|||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Feed getFeed() {
|
||||||
|
return feed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFeed(Feed feed) {
|
||||||
|
this.feed = feed;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -286,8 +286,6 @@ public class FeedManager {
|
|||||||
public void notifyInvalidImageFile(Context context, FeedImage image) {
|
public void notifyInvalidImageFile(Context context, FeedImage image) {
|
||||||
Log.i(TAG,
|
Log.i(TAG,
|
||||||
"The feedmanager was notified about an invalid image download. It will now try to redownload the image file");
|
"The feedmanager was notified about an invalid image download. It will now try to redownload the image file");
|
||||||
image.setDownloaded(false);
|
|
||||||
image.setFile_url(null);
|
|
||||||
requester.downloadImage(context, image);
|
requester.downloadImage(context, image);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -695,6 +693,7 @@ public class FeedManager {
|
|||||||
.getLong(PodDBAdapter.KEY_IMAGE_INDEX);
|
.getLong(PodDBAdapter.KEY_IMAGE_INDEX);
|
||||||
if (imageIndex != 0) {
|
if (imageIndex != 0) {
|
||||||
feed.setImage(adapter.getFeedImage(imageIndex));
|
feed.setImage(adapter.getFeedImage(imageIndex));
|
||||||
|
feed.getImage().setFeed(feed);
|
||||||
}
|
}
|
||||||
feed.file_url = feedlistCursor
|
feed.file_url = feedlistCursor
|
||||||
.getString(PodDBAdapter.KEY_FILE_URL_INDEX);
|
.getString(PodDBAdapter.KEY_FILE_URL_INDEX);
|
||||||
|
@ -223,6 +223,9 @@ public class DownloadService extends Service {
|
|||||||
status = c.getInt(c
|
status = c.getInt(c
|
||||||
.getColumnIndex(DownloadManager.COLUMN_STATUS));
|
.getColumnIndex(DownloadManager.COLUMN_STATUS));
|
||||||
}
|
}
|
||||||
|
if (downloadId == 0) {
|
||||||
|
Log.d(TAG, "Download ID was null");
|
||||||
|
}
|
||||||
FeedFile download = requester.getFeedFile(downloadId);
|
FeedFile download = requester.getFeedFile(downloadId);
|
||||||
if (download != null) {
|
if (download != null) {
|
||||||
if (status == DownloadManager.STATUS_SUCCESSFUL) {
|
if (status == DownloadManager.STATUS_SUCCESSFUL) {
|
||||||
@ -435,7 +438,8 @@ public class DownloadService extends Service {
|
|||||||
&& savedFeed.getImage().isDownloaded() == false) {
|
&& savedFeed.getImage().isDownloaded() == false) {
|
||||||
if (AppConfig.DEBUG)
|
if (AppConfig.DEBUG)
|
||||||
Log.d(TAG, "Feed has image; Downloading....");
|
Log.d(TAG, "Feed has image; Downloading....");
|
||||||
imageId = requester.downloadImage(service, feed.getImage());
|
savedFeed.getImage().setFeed(savedFeed);
|
||||||
|
imageId = requester.downloadImage(service, savedFeed.getImage());
|
||||||
hasImage = true;
|
hasImage = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -462,7 +466,7 @@ public class DownloadService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
requester.removeDownload(feed);
|
requester.removeDownload(feed);
|
||||||
cleanup();
|
//cleanup();
|
||||||
if (savedFeed == null) {
|
if (savedFeed == null) {
|
||||||
savedFeed = feed;
|
savedFeed = feed;
|
||||||
}
|
}
|
||||||
@ -519,8 +523,12 @@ public class DownloadService extends Service {
|
|||||||
true));
|
true));
|
||||||
sendDownloadHandledIntent(image.getDownloadId(), statusId, false, 0);
|
sendDownloadHandledIntent(image.getDownloadId(), statusId, false, 0);
|
||||||
image.setDownloadId(0);
|
image.setDownloadId(0);
|
||||||
|
|
||||||
manager.setFeedImage(service, image);
|
manager.setFeedImage(service, image);
|
||||||
|
if (image.getFeed() != null) {
|
||||||
|
manager.setFeed(service, image.getFeed());
|
||||||
|
} else {
|
||||||
|
Log.e(TAG, "Image has no feed, image might not be saved correctly!");
|
||||||
|
}
|
||||||
queryDownloads();
|
queryDownloads();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user