77 |
77 |
return result;
|
78 |
78 |
}
|
79 |
79 |
|
|
80 |
/* Check wether it's an image we don't want */
|
|
81 |
static bool_t is_possible_front_cover_image (const char * file)
|
|
82 |
{
|
|
83 |
char * exclude = get_string (NULL, "cover_name_exclude");
|
|
84 |
bool_t accept = ! cover_name_filter (file, exclude, FALSE);
|
|
85 |
g_free (exclude);
|
|
86 |
return accept;
|
|
87 |
}
|
|
88 |
|
80 |
89 |
/* Check wether it's an image we want */
|
81 |
90 |
static bool_t is_front_cover_image (const char * file)
|
82 |
91 |
{
|
83 |
92 |
char * include = get_string (NULL, "cover_name_include");
|
84 |
|
char * exclude = get_string (NULL, "cover_name_exclude");
|
85 |
93 |
bool_t accept = cover_name_filter (file, include, TRUE) &&
|
86 |
|
! cover_name_filter (file, exclude, FALSE);
|
|
94 |
is_possible_front_cover_image (file);
|
87 |
95 |
g_free (include);
|
88 |
|
g_free (exclude);
|
89 |
96 |
return accept;
|
90 |
97 |
}
|
91 |
98 |
|
... | ... | |
148 |
155 |
g_dir_rewind(d);
|
149 |
156 |
}
|
150 |
157 |
|
151 |
|
/* Search for files using filter */
|
|
158 |
/* Search for files using filters */
|
152 |
159 |
while ((f = g_dir_read_name(d))) {
|
153 |
160 |
char *newpath = g_strconcat(path, "/", f, NULL);
|
154 |
161 |
|
... | ... | |
158 |
165 |
g_dir_close(d);
|
159 |
166 |
return newpath;
|
160 |
167 |
}
|
|
168 |
|
|
169 |
g_free(newpath);
|
|
170 |
}
|
|
171 |
g_dir_rewind(d);
|
|
172 |
|
|
173 |
/* Search for files using exclude filter only */
|
|
174 |
while ((f = g_dir_read_name(d))) {
|
|
175 |
char *newpath = g_strconcat(path, "/", f, NULL);
|
|
176 |
|
|
177 |
if (!g_file_test(newpath, G_FILE_TEST_IS_DIR) &&
|
|
178 |
has_front_cover_extension(f) &&
|
|
179 |
is_possible_front_cover_image(f)) {
|
|
180 |
g_dir_close(d);
|
|
181 |
return newpath;
|
|
182 |
}
|
161 |
183 |
|
162 |
184 |
g_free(newpath);
|
163 |
185 |
}
|