Retro-actively disable auto download for episodes that were downloaded, were partially or completely played and are not queued currently

This commit is contained in:
Martin Fietz 2015-07-29 20:36:27 +02:00
parent 8721dab1bc
commit 5f41d422aa

View File

@ -1477,7 +1477,7 @@ public class PodDBAdapter {
*/
private static class PodDBHelper extends SQLiteOpenHelper {
private final static int VERSION = 18;
private final static int VERSION = 1030002;
private Context context;
@ -1702,6 +1702,11 @@ public class PodDBAdapter {
db.execSQL("ALTER TABLE " + PodDBAdapter.TABLE_NAME_FEEDS
+ " ADD COLUMN " + PodDBAdapter.KEY_AUTO_DELETE_ACTION + " INTEGER DEFAULT 0");
}
if(oldVersion < 1030002) {
db.execSQL("UPDATE FeedItems SET auto_download=0 WHERE " +
"(read=1 OR id IN (SELECT id FROM FeedMedia WHERE position>0 OR downloaded=1)) " +
"AND id NOT IN (SELECT feeditem FROM Queue)");
}
EventBus.getDefault().post(ProgressEvent.end());
}
}