diff --git a/inotify.c b/inotify.c index 274170d..03aff5e 100644 --- a/inotify.c +++ b/inotify.c @@ -422,7 +422,7 @@ inotify_insert_file(char * name, const char * path) if( !depth ) { //DEBUG DPRINTF(E_DEBUG, L_INOTIFY, "Inserting %s\n", name); - insert_file(name, path, id+2, get_next_available_id("OBJECTS", id)); + insert_file(name, path, id+2, get_next_available_id("OBJECTS", id), types); sqlite3_free(id); if( (is_audio(path) || is_playlist(path)) && next_pl_fill != 1 ) { diff --git a/scanner.c b/scanner.c index 6799fb9..4fee7cb 100644 --- a/scanner.c +++ b/scanner.c @@ -445,7 +445,7 @@ insert_directory(const char *name, const char *path, const char *base, const cha } int -insert_file(char *name, const char *path, const char *parentID, int object) +insert_file(char *name, const char *path, const char *parentID, int object, media_types types) { char class[32]; char objectID[64]; @@ -455,7 +455,7 @@ insert_file(char *name, const char *path, const char *parentID, int object) char *baseid; char *orig_name = NULL; - if( is_image(name) ) + if( (types & TYPE_IMAGES) && is_image(name) ) { if( is_album_art(name) ) return -1; @@ -463,7 +463,7 @@ insert_file(char *name, const char *path, const char *parentID, int object) strcpy(class, "item.imageItem.photo"); detailID = GetImageMetadata(path, name); } - else if( is_video(name) ) + else if( (types & TYPE_VIDEO) && is_video(name) ) { orig_name = strdup(name); strcpy(base, VIDEO_DIR_ID); @@ -477,7 +477,7 @@ insert_file(char *name, const char *path, const char *parentID, int object) if( insert_playlist(path, name) == 0 ) return 1; } - if( !detailID && is_audio(name) ) + if( !detailID && (types & TYPE_AUDIO) && is_audio(name) ) { strcpy(base, MUSIC_DIR_ID); strcpy(class, "item.audioItem.musicTrack"); @@ -776,7 +776,7 @@ ScanDirectory(const char *dir, const char *parent, media_types dir_types) } else if( type == TYPE_FILE && (access(full_path, R_OK) == 0) ) { - if( insert_file(name, full_path, THISORNUL(parent), i+startID) == 0 ) + if( insert_file(name, full_path, THISORNUL(parent), i+startID, dir_types) == 0 ) fileno++; } free(name); diff --git a/scanner.h b/scanner.h index 565bcb3..d220762 100644 --- a/scanner.h +++ b/scanner.h @@ -75,7 +75,7 @@ int64_t insert_directory(const char *name, const char *path, const char *base, const char *parentID, int objectID); int -insert_file(char *name, const char *path, const char *parentID, int object); +insert_file(char *name, const char *path, const char *parentID, int object, media_types dir_types); int CreateDatabase(void);