Fix various inotify issues with deleting entire folder contents, and then re-adding content back to the same folder. This should be the cause of '(null)' folder names.
This commit is contained in:
parent
701b2efacd
commit
bb163eb65f
13
inotify.c
13
inotify.c
@ -540,8 +540,7 @@ inotify_remove_file(const char * path)
|
||||
|
||||
if( ends_with(path, ".srt") )
|
||||
{
|
||||
rows = sql_exec(db, "DELETE from CAPTIONS where PATH = '%q'", path);
|
||||
return rows;
|
||||
return sql_exec(db, "DELETE from CAPTIONS where PATH = '%q'", path);
|
||||
}
|
||||
/* Invalidate the scanner cache so we don't insert files into non-existent containers */
|
||||
valid_cache = 0;
|
||||
@ -563,11 +562,13 @@ inotify_remove_file(const char * path)
|
||||
else
|
||||
{
|
||||
/* Delete the parent containers if we are about to empty them. */
|
||||
snprintf(sql, sizeof(sql), "SELECT PARENT_ID from OBJECTS where DETAIL_ID = %lld", (long long int)detailID);
|
||||
snprintf(sql, sizeof(sql), "SELECT PARENT_ID from OBJECTS where DETAIL_ID = %lld"
|
||||
" and PARENT_ID not like '64$%%'",
|
||||
(long long int)detailID);
|
||||
if( (sql_get_table(db, sql, &result, &rows, NULL) == SQLITE_OK) )
|
||||
{
|
||||
int i, children;
|
||||
for( i=1; i <= rows; i++ )
|
||||
for( i = 1; i <= rows; i++ )
|
||||
{
|
||||
/* If it's a playlist item, adjust the item count of the playlist */
|
||||
if( strncmp(result[i], MUSIC_PLIST_ID, strlen(MUSIC_PLIST_ID)) == 0 )
|
||||
@ -581,8 +582,6 @@ inotify_remove_file(const char * path)
|
||||
continue;
|
||||
if( children < 2 )
|
||||
{
|
||||
sql_exec(db, "DELETE from DETAILS where ID ="
|
||||
" (SELECT DETAIL_ID from OBJECTS where OBJECT_ID = '%s')", result[i]);
|
||||
sql_exec(db, "DELETE from OBJECTS where OBJECT_ID = '%s'", result[i]);
|
||||
|
||||
ptr = strrchr(result[i], '$');
|
||||
@ -590,8 +589,6 @@ inotify_remove_file(const char * path)
|
||||
*ptr = '\0';
|
||||
if( sql_get_int_field(db, "SELECT count(*) from OBJECTS where PARENT_ID = '%s'", result[i]) == 0 )
|
||||
{
|
||||
sql_exec(db, "DELETE from DETAILS where ID ="
|
||||
" (SELECT DETAIL_ID from OBJECTS where OBJECT_ID = '%s')", result[i]);
|
||||
sql_exec(db, "DELETE from OBJECTS where OBJECT_ID = '%s'", result[i]);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user