Media file scan will now heed configured music/video file types
It will also now heed the Media Folders -> Exclude Pattern. Fixes #1227. Signed-off-by: Andrew DeMaria <lostonamountain@gmail.com>
This commit is contained in:
@@ -154,7 +154,7 @@ public class CoverArtService {
|
||||
}
|
||||
|
||||
private boolean isMediaFile(File file) {
|
||||
return !mediaFileService.filterMediaFiles(new File[]{file}).isEmpty();
|
||||
return mediaFileService.includeMediaFile(file);
|
||||
}
|
||||
|
||||
private void backup(File newCoverFile, File backup) {
|
||||
|
||||
@@ -193,10 +193,10 @@ public class MediaFileService {
|
||||
List<MediaFile> result = new ArrayList<MediaFile>();
|
||||
for (MediaFile child : mediaFileDao.getChildrenOf(parent.getPath())) {
|
||||
child = checkLastModified(child, useFastCache);
|
||||
if (child.isDirectory() && includeDirectories) {
|
||||
if (child.isDirectory() && includeDirectories && includeMediaFile(child)) {
|
||||
result.add(child);
|
||||
}
|
||||
if (child.isFile() && includeFiles) {
|
||||
if (child.isFile() && includeFiles && includeMediaFile(child)) {
|
||||
result.add(child);
|
||||
}
|
||||
}
|
||||
@@ -406,11 +406,22 @@ public class MediaFileService {
|
||||
mediaFileDao.createOrUpdateMediaFile(parent);
|
||||
}
|
||||
|
||||
public boolean includeMediaFile(MediaFile candidate) {
|
||||
return includeMediaFile(candidate.getFile());
|
||||
}
|
||||
|
||||
public boolean includeMediaFile(File candidate) {
|
||||
String suffix = FilenameUtils.getExtension(candidate.getName()).toLowerCase();
|
||||
if (!isExcluded(candidate) && (FileUtil.isDirectory(candidate) || isAudioFile(suffix) || isVideoFile(suffix))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<File> filterMediaFiles(File[] candidates) {
|
||||
List<File> result = new ArrayList<File>();
|
||||
for (File candidate : candidates) {
|
||||
String suffix = FilenameUtils.getExtension(candidate.getName()).toLowerCase();
|
||||
if (!isExcluded(candidate) && (FileUtil.isDirectory(candidate) || isAudioFile(suffix) || isVideoFile(suffix))) {
|
||||
if (includeMediaFile(candidate)) {
|
||||
result.add(candidate);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user