* Filter out hidden files and folders.
This commit is contained in:
parent
bb163eb65f
commit
2e68335430
82
scanner.c
82
scanner.c
@ -594,85 +594,97 @@ sql_failed:
|
|||||||
return (ret != SQLITE_OK);
|
return (ret != SQLITE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
filter_hidden(scan_filter *d)
|
||||||
|
{
|
||||||
|
return (d->d_name[0] != '.');
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
filter_type(scan_filter *d)
|
filter_type(scan_filter *d)
|
||||||
{
|
{
|
||||||
return ( (*d->d_name != '.') &&
|
return ( (d->d_type == DT_DIR) ||
|
||||||
((d->d_type == DT_DIR) ||
|
(d->d_type == DT_LNK) ||
|
||||||
(d->d_type == DT_LNK) ||
|
(d->d_type == DT_UNKNOWN)
|
||||||
(d->d_type == DT_UNKNOWN))
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
filter_a(scan_filter *d)
|
filter_a(scan_filter *d)
|
||||||
{
|
{
|
||||||
return ( filter_type(d) ||
|
return ( filter_hidden(d) &&
|
||||||
((d->d_type == DT_REG) &&
|
(filter_type(d) ||
|
||||||
(is_audio(d->d_name) ||
|
((d->d_type == DT_REG) &&
|
||||||
is_playlist(d->d_name))
|
(is_audio(d->d_name) ||
|
||||||
) );
|
is_playlist(d->d_name))))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
filter_av(scan_filter *d)
|
filter_av(scan_filter *d)
|
||||||
{
|
{
|
||||||
return ( filter_type(d) ||
|
return ( filter_hidden(d) &&
|
||||||
((d->d_type == DT_REG) &&
|
(filter_type(d) ||
|
||||||
(is_audio(d->d_name) ||
|
((d->d_type == DT_REG) &&
|
||||||
is_video(d->d_name) ||
|
(is_audio(d->d_name) ||
|
||||||
is_playlist(d->d_name)))
|
is_video(d->d_name) ||
|
||||||
|
is_playlist(d->d_name))))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
filter_ap(scan_filter *d)
|
filter_ap(scan_filter *d)
|
||||||
{
|
{
|
||||||
return ( filter_type(d) ||
|
return ( filter_hidden(d) &&
|
||||||
((d->d_type == DT_REG) &&
|
(filter_type(d) ||
|
||||||
(is_audio(d->d_name) ||
|
((d->d_type == DT_REG) &&
|
||||||
is_image(d->d_name) ||
|
(is_audio(d->d_name) ||
|
||||||
is_playlist(d->d_name)))
|
is_image(d->d_name) ||
|
||||||
|
is_playlist(d->d_name))))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
filter_v(scan_filter *d)
|
filter_v(scan_filter *d)
|
||||||
{
|
{
|
||||||
return ( filter_type(d) ||
|
return ( filter_hidden(d) &&
|
||||||
(d->d_type == DT_REG &&
|
(filter_type(d) ||
|
||||||
is_video(d->d_name))
|
(d->d_type == DT_REG &&
|
||||||
|
is_video(d->d_name)))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
filter_vp(scan_filter *d)
|
filter_vp(scan_filter *d)
|
||||||
{
|
{
|
||||||
return ( filter_type(d) ||
|
return ( filter_hidden(d) &&
|
||||||
((d->d_type == DT_REG) &&
|
(filter_type(d) ||
|
||||||
(is_video(d->d_name) ||
|
((d->d_type == DT_REG) &&
|
||||||
is_image(d->d_name)))
|
(is_video(d->d_name) ||
|
||||||
|
is_image(d->d_name))))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
filter_p(scan_filter *d)
|
filter_p(scan_filter *d)
|
||||||
{
|
{
|
||||||
return ( filter_type(d) ||
|
return ( filter_hidden(d) &&
|
||||||
(d->d_type == DT_REG &&
|
(filter_type(d) ||
|
||||||
is_image(d->d_name))
|
(d->d_type == DT_REG &&
|
||||||
|
is_image(d->d_name)))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
filter_avp(scan_filter *d)
|
filter_avp(scan_filter *d)
|
||||||
{
|
{
|
||||||
return ( filter_type(d) ||
|
return ( filter_hidden(d) &&
|
||||||
((d->d_type == DT_REG) &&
|
(filter_type(d) ||
|
||||||
(is_audio(d->d_name) ||
|
((d->d_type == DT_REG) &&
|
||||||
is_image(d->d_name) ||
|
(is_audio(d->d_name) ||
|
||||||
is_video(d->d_name) ||
|
is_image(d->d_name) ||
|
||||||
is_playlist(d->d_name)))
|
is_video(d->d_name) ||
|
||||||
|
is_playlist(d->d_name))))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user