diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2012-09-24 15:45:42 +0200 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2012-09-24 15:45:42 +0200 |
commit | 337d82c64b6812a225a088a3fdfa0dbed6e7b3b5 (patch) | |
tree | c79b37392c6f862bbe6083b5cabaf38ea7bb63d4 /src/de/danoeh/antennapod | |
parent | 08983fcfe33a0d49c6737d1bb360ea6feec3bf12 (diff) | |
download | AntennaPod-337d82c64b6812a225a088a3fdfa0dbed6e7b3b5.zip |
FeedSyncThread will now check if feeditems are valid before saving
Diffstat (limited to 'src/de/danoeh/antennapod')
-rw-r--r-- | src/de/danoeh/antennapod/service/download/DownloadService.java | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/src/de/danoeh/antennapod/service/download/DownloadService.java b/src/de/danoeh/antennapod/service/download/DownloadService.java index 7101e4aaf..30c49f6dc 100644 --- a/src/de/danoeh/antennapod/service/download/DownloadService.java +++ b/src/de/danoeh/antennapod/service/download/DownloadService.java @@ -49,6 +49,7 @@ import de.danoeh.antennapod.asynctask.DownloadStatus; import de.danoeh.antennapod.feed.Feed; import de.danoeh.antennapod.feed.FeedFile; import de.danoeh.antennapod.feed.FeedImage; +import de.danoeh.antennapod.feed.FeedItem; import de.danoeh.antennapod.feed.FeedManager; import de.danoeh.antennapod.feed.FeedMedia; import de.danoeh.antennapod.storage.DownloadRequestException; @@ -621,11 +622,32 @@ public class DownloadService extends Service { if (feed.getTitle() == null) { Log.e(TAG, "Feed has no title."); return false; - } else { - if (AppConfig.DEBUG) - Log.d(TAG, "Feed appears to be valid."); - return true; } + if (!hasValidFeedItems(feed)) { + Log.e(TAG, "Feed has invalid items"); + return false; + } + if (AppConfig.DEBUG) + Log.d(TAG, "Feed appears to be valid."); + return true; + + } + + private boolean hasValidFeedItems(Feed feed) { + for (FeedItem item : feed.getItems()) { + if (item.getTitle() == null) { + Log.e(TAG, "Item has no title"); + return false; + } + if (item.getPubDate() == null) { + Log.e(TAG, "Item has no pubDate"); + if (item.getTitle() != null) { + Log.e(TAG, "Title of invalid item: " + item.getTitle()); + } + return false; + } + } + return true; } /** Delete files that aren't needed anymore */ |