mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2025-01-12 00:47:17 +01:00
Added cleanup to FeedSyncThread
This commit is contained in:
parent
745838457d
commit
58e229b7f9
@ -58,7 +58,6 @@ public class FeedlistActivity extends SherlockListActivity {
|
|||||||
super.onResume();
|
super.onResume();
|
||||||
IntentFilter filter = new IntentFilter();
|
IntentFilter filter = new IntentFilter();
|
||||||
filter.addAction(FeedSyncService.ACTION_FEED_SYNC_COMPLETED);
|
filter.addAction(FeedSyncService.ACTION_FEED_SYNC_COMPLETED);
|
||||||
filter.addAction(DownloadRequester.ACTION_IMAGE_DOWNLOAD_COMPLETED);
|
|
||||||
|
|
||||||
registerReceiver(contentUpdate, filter);
|
registerReceiver(contentUpdate, filter);
|
||||||
}
|
}
|
||||||
|
@ -122,6 +122,7 @@ public class DownloadService extends Service {
|
|||||||
|
|
||||||
/** Takes a single Feed, parses the corresponding file and refreshes information in the manager */
|
/** Takes a single Feed, parses the corresponding file and refreshes information in the manager */
|
||||||
class FeedSyncThread implements Runnable {
|
class FeedSyncThread implements Runnable {
|
||||||
|
private static final String TAG = "FeedSyncThread";
|
||||||
|
|
||||||
private Feed feed;
|
private Feed feed;
|
||||||
private DownloadService service;
|
private DownloadService service;
|
||||||
@ -145,10 +146,18 @@ public class DownloadService extends Service {
|
|||||||
requester.downloadImage(service, feed.getImage());
|
requester.downloadImage(service, feed.getImage());
|
||||||
}
|
}
|
||||||
requester.removeFeed(feed);
|
requester.removeFeed(feed);
|
||||||
|
|
||||||
|
cleanup();
|
||||||
|
|
||||||
// Save information of feed in DB
|
// Save information of feed in DB
|
||||||
manager.updateFeed(service, feed);
|
manager.updateFeed(service, feed);
|
||||||
Log.d(TAG, "Walking through " + feed.getItems().size() + " feeditems");
|
}
|
||||||
Log.d(TAG, "Done.");
|
|
||||||
|
/** Delete files that aren't needed anymore */
|
||||||
|
private void cleanup() {
|
||||||
|
if(new File(feed.getFile_url()).delete())
|
||||||
|
Log.d(TAG, "Successfully deleted cache file."); else Log.e(TAG, "Failed to delete cache file.");
|
||||||
|
feed.setFile_url(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user