diff --git a/inotify.c b/inotify.c index e7a2cfe..a44c959 100644 --- a/inotify.c +++ b/inotify.c @@ -602,8 +602,8 @@ inotify_remove_directory(int fd, const char * path) /* Invalidate the scanner cache so we don't insert files into non-existent containers */ valid_cache = 0; remove_watch(fd, path); - sql = sqlite3_mprintf("SELECT ID from DETAILS where PATH glob '%q/*'" - " UNION ALL SELECT ID from DETAILS where PATH = '%q'", path, path); + sql = sqlite3_mprintf("SELECT ID from DETAILS where (PATH > '%q/' and PATH <= '%q/%c')" + " or PATH = '%q'", path, path, 0xFF, path); if( (sql_get_table(db, sql, &result, &rows, NULL) == SQLITE_OK) ) { if( rows ) @@ -620,7 +620,7 @@ inotify_remove_directory(int fd, const char * path) } sqlite3_free(sql); /* Clean up any album art entries in the deleted directory */ - sql_exec(db, "DELETE from ALBUM_ART where PATH glob '%q/*'", path); + sql_exec(db, "DELETE from ALBUM_ART where (PATH > '%q/' and PATH <= '%q/%c')", path, path, 0xFF); return ret; } diff --git a/metadata.c b/metadata.c index 2ebcaa8..540e36d 100644 --- a/metadata.c +++ b/metadata.c @@ -200,16 +200,16 @@ check_for_captions(const char * path, sqlite_int64 detailID) /* If we weren't given a detail ID, look for one. */ if( !detailID ) { - id = sql_get_text_field(db, "SELECT ID from DETAILS where PATH glob '%q.*'" - " and MIME glob 'video/*' limit 1", file); + id = sql_get_text_field(db, "SELECT ID from DETAILS where (PATH > '%q.' and PATH <= '%q.z')" + " and MIME glob 'video/*' limit 1", file, file); if( id ) { - //DEBUG DPRINTF(E_DEBUG, L_METADATA, "New file %s looks like a caption file.\n", path); + //DPRINTF(E_MAXDEBUG, L_METADATA, "New file %s looks like a caption file.\n", path); detailID = strtoll(id, NULL, 10); } else { - //DPRINTF(E_DEBUG, L_METADATA, "No file found for caption %s.\n", path); + //DPRINTF(E_MAXDEBUG, L_METADATA, "No file found for caption %s.\n", path); goto no_source_video; } }