do not index hidden files or folders.
This commit is contained in:
parent
e3b878e69b
commit
c6fedb9e17
@ -426,6 +426,9 @@ public class MediaScanner implements Handler.Callback {
|
|||||||
if (new File(dir, ".nomedia").exists())
|
if (new File(dir, ".nomedia").exists())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (isDotfile(dir))
|
||||||
|
return;
|
||||||
|
|
||||||
File[] dirents = dir.listFiles();
|
File[] dirents = dir.listFiles();
|
||||||
if (dirents == null)
|
if (dirents == null)
|
||||||
return;
|
return;
|
||||||
@ -450,6 +453,9 @@ public class MediaScanner implements Handler.Callback {
|
|||||||
if (isBlacklisted(file))
|
if (isBlacklisted(file))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (isDotfile(file))
|
||||||
|
return false;
|
||||||
|
|
||||||
long dbEntryMtime = mBackend.getColumnFromSongId(MediaLibrary.SongColumns.MTIME, songId) * 1000; // this is in unixtime -> convert to 'ms'
|
long dbEntryMtime = mBackend.getColumnFromSongId(MediaLibrary.SongColumns.MTIME, songId) * 1000; // this is in unixtime -> convert to 'ms'
|
||||||
long songFlags = mBackend.getColumnFromSongId(MediaLibrary.SongColumns.FLAGS, songId);
|
long songFlags = mBackend.getColumnFromSongId(MediaLibrary.SongColumns.FLAGS, songId);
|
||||||
long fileMtime = file.lastModified();
|
long fileMtime = file.lastModified();
|
||||||
@ -646,6 +652,17 @@ public class MediaScanner implements Handler.Callback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static final Pattern sDotfilePattern = Pattern.compile("^\\..*$", Pattern.CASE_INSENSITIVE);
|
||||||
|
/**
|
||||||
|
* Returns true if the file is a hidden dotfile.
|
||||||
|
*
|
||||||
|
* @param file to inspect
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
private boolean isDotfile(File file) {
|
||||||
|
return sDotfilePattern.matcher(file.getName()).matches();
|
||||||
|
}
|
||||||
|
|
||||||
// MediaScanPlan describes how we are going to perform the media scan
|
// MediaScanPlan describes how we are going to perform the media scan
|
||||||
class MediaScanPlan {
|
class MediaScanPlan {
|
||||||
class Step {
|
class Step {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user