Do not index ringtone data

This commit is contained in:
Adrian Ulrich 2017-01-22 21:14:11 +01:00
parent 2c5abc352c
commit d2c54eeb2a

View File

@ -513,7 +513,8 @@ public class MediaScanner implements Handler.Callback {
return hasChanged;
}
private static final Pattern sIgnoredNames = Pattern.compile("^([^\\.]+|.+\\.(jpe?g|gif|png|bmp|webm|txt|pdf|avi|mp4|mkv|zip|tgz|xml))$", Pattern.CASE_INSENSITIVE);
private static final Pattern sIgnoredFilenames = Pattern.compile("^([^\\.]+|.+\\.(jpe?g|gif|png|bmp|webm|txt|pdf|avi|mp4|mkv|zip|tgz|xml))$", Pattern.CASE_INSENSITIVE);
private static final Pattern sIgnoredDirectories = Pattern.compile("^.+/(Android/data|Notifications|Ringtones)/.+$", Pattern.CASE_INSENSITIVE);
/**
* Returns true if the file should not be scanned
*
@ -521,7 +522,8 @@ public class MediaScanner implements Handler.Callback {
* @return boolean
*/
private boolean isBlacklisted(File file) {
return sIgnoredNames.matcher(file.getName()).matches();
boolean blacklisted = sIgnoredFilenames.matcher(file.getName()).matches() || sIgnoredDirectories.matcher(file.getPath()).matches();
return blacklisted;
}