scanner: check defined media types before parsing files
This commit is contained in:
parent
f9c37fb205
commit
61bb91ecc9
@ -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 )
|
||||
{
|
||||
|
10
scanner.c
10
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);
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user