# of a folder for each unique value of the metadata in question.
#
virtual-folders=Artists=upnp:artist,?,upnp:album,?;Albums=upnp:album,?,upnp:artist,?
+include-filter=.mp3;.oga;.ogv;.ogg;.mkv;.avi;.mp4;.mpeg;.mpg;.ts;.flac;.jpeg;.jpg;.wav
[GstRenderer]
enabled=true
# of a folder for each unique value of the metadata in question.
#
virtual-folders=Artists=upnp:artist,?,upnp:album,?;Albums=upnp:album,?,upnp:artist,?
+include-filter=.mp3;.oga;.ogv;.ogg;.mkv;.avi;.mp4;.mpeg;.mpg;.ts;.flac;.jpeg;.jpg;.wav
[GstRenderer]
enabled=true
private File origin;
private MediaContainer parent;
private RecursiveFileMonitor monitor;
+ private Regex file_filter;
public Cancellable cancellable;
private const string HARVESTER_ATTRIBUTES =
FILE_ATTRIBUTE_STANDARD_NAME + "," +
this.origin = null;
this.monitor = monitor;
this.cancellable = new Cancellable ();
+ var config = MetaConfig.get_default ();
+
+ try {
+ var extensions = config.get_string_list ("MediaExport",
+ "include-filter");
+
+ // never trust user input
+ string[] escaped_extensions = new string[0];
+ foreach (var extension in extensions) {
+ escaped_extensions += Regex.escape_string (extension);
+ }
+
+ var list = string.joinv ("|", escaped_extensions);
+ file_filter = new Regex ("(%s)$".printf (list),
+ RegexCompileFlags.CASELESS |
+ RegexCompileFlags.OPTIMIZE);
+ } catch (Error error) {
+ file_filter = null;
+ }
}
private bool push_if_changed_or_unknown (File file,
}
} else {
string id;
+
+ // Let's see if the file is wanted
+ if (file_filter != null &&
+ !file_filter.match (file.get_uri ())) {
+ continue;
+ }
+
push_if_changed_or_unknown (file, info, out id);
parent_container.seen (id);
}