Purge unindexed music files after the song scan, fixing ticket #146. This needs much testing.

This commit is contained in:
Ron Pedde 2006-06-13 05:48:30 +00:00
parent bff6193572
commit 1948eef43d
3 changed files with 12 additions and 12 deletions

View File

@ -357,10 +357,6 @@ int db_sqlite2_event(int event_type) {
db_sqlite2_exec(NULL,E_FATAL,"commit transaction");
db_sqlite2_exec(NULL,E_FATAL,"create index idx_path on songs(path)");
db_sqlite2_exec(NULL,E_DBG,"delete from config where term='rescan'");
} else {
db_sqlite2_exec(NULL,E_FATAL,"delete from songs where id not in (select id from updated)");
db_sqlite2_exec(NULL,E_FATAL,"update songs set force_update=0");
db_sqlite2_exec(NULL,E_FATAL,"drop table updated");
}
break;
@ -377,6 +373,10 @@ int db_sqlite2_event(int event_type) {
db_sqlite2_exec(NULL,E_FATAL,"create index idx_playlistid on playlistitems(playlistid)");
} else {
db_sqlite2_exec(NULL,E_FATAL,"delete from songs where id not in (select id from updated)");
db_sqlite2_exec(NULL,E_FATAL,"update songs set force_update=0");
db_sqlite2_exec(NULL,E_FATAL,"drop table updated");
db_sqlite2_exec(NULL,E_FATAL,"delete from playlists where "
"((type=%d) OR (type=%d)) and "
"id not in (select id from plupdated)",

View File

@ -395,10 +395,6 @@ int db_sqlite3_event(int event_type) {
db_sqlite3_exec(NULL,E_FATAL,"commit transaction");
db_sqlite3_exec(NULL,E_FATAL,"create index idx_path on songs(path)");
db_sqlite3_exec(NULL,E_DBG,"delete from config where term='rescan'");
} else {
db_sqlite3_exec(NULL,E_FATAL,"delete from songs where id not in (select id from updated)");
db_sqlite3_exec(NULL,E_FATAL,"update songs set force_update=0");
db_sqlite3_exec(NULL,E_FATAL,"drop table updated");
}
break;
@ -415,6 +411,10 @@ int db_sqlite3_event(int event_type) {
db_sqlite3_exec(NULL,E_FATAL,"create index idx_playlistid on playlistitems(playlistid)");
} else {
db_sqlite3_exec(NULL,E_FATAL,"delete from songs where id not in (select id from updated)");
db_sqlite3_exec(NULL,E_FATAL,"update songs set force_update=0");
db_sqlite3_exec(NULL,E_FATAL,"drop table updated");
db_sqlite3_exec(NULL,E_FATAL,"delete from playlists where "
"((type=%d) OR (type=%d)) and "
"id not in (select id from plupdated)",

View File

@ -790,7 +790,7 @@ int db_sql_add(char **pe, MP3FILE *pmp3, int *id) {
DPRINTF(E_FATAL,L_DB,"Error inserting file %s in database\n",pmp3->fname);
insertid = db_sql_insert_id_fn();
if((db_sql_in_scan)&&(!db_sql_reload)) {
if((db_sql_in_scan || db_sql_in_playlist_scan)&&(!db_sql_reload)) {
db_sql_exec_fn(NULL,E_FATAL,"insert into updated values (%d)",
insertid);
}
@ -889,7 +889,7 @@ int db_sql_update(char **pe, MP3FILE *pmp3, int *id) {
return err;
}
if((db_sql_in_scan) && (!db_sql_reload)) {
if((db_sql_in_scan || db_sql_in_playlist_scan) && (!db_sql_reload)) {
if(id) {
db_sql_exec_fn(NULL,E_FATAL,"insert into updated (id) values (%d)",*id);
} else {
@ -1772,7 +1772,7 @@ MP3FILE *db_sql_fetch_item(char **pe, int id) {
db_sql_dispose_row();
if ((db_sql_in_scan) && (!db_sql_reload)) {
if ((db_sql_in_scan || db_sql_in_playlist_scan) && (!db_sql_reload)) {
db_sql_exec_fn(pe,E_FATAL,"INSERT INTO updated VALUES (%d)",id);
}
@ -1807,7 +1807,7 @@ MP3FILE *db_sql_fetch_path(char **pe, char *path, int index) {
db_sql_dispose_row();
if ((db_sql_in_scan) && (!db_sql_reload)) {
if ((db_sql_in_scan || db_sql_in_playlist_scan) && (!db_sql_reload)) {
db_sql_exec_fn(pe,E_FATAL,"INSERT INTO updated VALUES (%d)",pmp3->id);
}