mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-26 23:25:56 -05:00
File types to ignore during scan made configurable
This commit is contained in:
parent
55db599c5e
commit
766177bf10
@ -33,6 +33,12 @@ library {
|
||||
# forked-daapd will look for jpg and png files with these base names
|
||||
# artwork_basenames = { "artwork", "cover", "Folder" }
|
||||
|
||||
# File types the scanner should ignore
|
||||
# Non-audio files will never be added to the database, but here you
|
||||
# can prevent the scanner from even probing them. This might improve
|
||||
# scan time. By default .db and .ini are ignored.
|
||||
# filetypes_ignore = { ".db", ".ini" }
|
||||
|
||||
# Should iTunes metadata override ours?
|
||||
# itunes_overrides = true
|
||||
|
||||
|
@ -62,6 +62,7 @@ static cfg_opt_t sec_library[] =
|
||||
CFG_STR_LIST("directories", NULL, CFGF_NONE),
|
||||
CFG_STR_LIST("compilations", NULL, CFGF_NONE),
|
||||
CFG_STR_LIST("artwork_basenames", "{artwork,cover,Folder}", CFGF_NONE),
|
||||
CFG_STR_LIST("filetypes_ignore", "{.db,.ini}", CFGF_NONE),
|
||||
CFG_BOOL("itunes_overrides", cfg_false, CFGF_NONE),
|
||||
CFG_STR_LIST("no_transcode", NULL, CFGF_NONE),
|
||||
CFG_STR_LIST("force_transcode", NULL, CFGF_NONE),
|
||||
|
@ -134,6 +134,24 @@ pop_dir(struct stacked_dir **s)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
ignore_filetype(char *ext)
|
||||
{
|
||||
cfg_t *lib;
|
||||
int n;
|
||||
int i;
|
||||
|
||||
lib = cfg_getsec(cfg, "library");
|
||||
n = cfg_size(lib, "filetypes_ignore");
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
if (strcmp(ext, cfg_getnstr(lib, "filetypes_ignore", i)) == 0)
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
normalize_fixup_tag(char **tag, char *src_tag)
|
||||
@ -328,16 +346,16 @@ process_media_file(char *file, time_t mtime, off_t size, int compilation, int ur
|
||||
/* Artwork files - don't scan */
|
||||
return;
|
||||
}
|
||||
else if ((strcmp(ext, ".db") == 0) || (strcmp(ext, ".ini") == 0))
|
||||
{
|
||||
/* System files - don't scan */
|
||||
return;
|
||||
}
|
||||
else if ((strlen(filename) > 1) && ((filename[1] == '_') || (filename[1] == '.')))
|
||||
{
|
||||
/* Hidden files - don't scan */
|
||||
return;
|
||||
}
|
||||
else if (ignore_filetype(ext))
|
||||
{
|
||||
/* File extension is in ignore list - don't scan */
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
db_file_stamp_bypath(file, &stamp, &id);
|
||||
|
Loading…
Reference in New Issue
Block a user