Ignore ~/Movies for auto-detection purposes
This commit is contained in:
parent
a8dda17b9c
commit
036cefea51
|
@ -69,7 +69,7 @@ public class AutoDetection {
|
|||
}
|
||||
|
||||
private static final Pattern MOVIE_PATTERN = Pattern.compile("Movies", CASE_INSENSITIVE);
|
||||
private static final Pattern SERIES_PATTERN = Pattern.compile("TV.Shows|Season.[0-9]+", CASE_INSENSITIVE);
|
||||
private static final Pattern SERIES_PATTERN = Pattern.compile("TV.Shows|TV.Series|Season.[0-9]+", CASE_INSENSITIVE);
|
||||
private static final Pattern ANIME_PATTERN = Pattern.compile("Anime", CASE_INSENSITIVE);
|
||||
|
||||
public boolean isMusic(File f) {
|
||||
|
@ -103,7 +103,7 @@ public class AutoDetection {
|
|||
}
|
||||
|
||||
public boolean anyMatch(File file, Pattern pattern) {
|
||||
for (File f = file; f != null; f = f.getParentFile()) {
|
||||
for (File f = file; f != null && !MediaDetection.isVolumeRoot(f); f = f.getParentFile()) {
|
||||
if (pattern.matcher(f.getName()).matches()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ public class AutoDetection {
|
|||
|
||||
if (isMusic(f))
|
||||
return group.music(f);
|
||||
if (isMovie(f) && !isEpisode(f)) // episode characteristics override movie characteristics (e.g. episodes in Movies folder)
|
||||
if (isMovie(f)) // episode characteristics override movie characteristics (e.g. episodes in Movies folder)
|
||||
return group.movie(getMovieMatches(f, false));
|
||||
if (isEpisode(f))
|
||||
return group.series(getSeriesMatches(f, false));
|
||||
|
|
|
@ -980,11 +980,12 @@ public class MediaDetection {
|
|||
return formatInfoPattern.matcher(name).replaceAll("");
|
||||
}
|
||||
|
||||
public static boolean isVolumeRoot(File folder) {
|
||||
return folder == null || folder.getName() == null || folder.getName().isEmpty() || releaseInfo.getVolumeRoots().contains(folder);
|
||||
}
|
||||
|
||||
public static boolean isStructureRoot(File folder) throws Exception {
|
||||
if (folder == null || folder.getName() == null || folder.getName().isEmpty() || releaseInfo.getVolumeRoots().contains(folder)) {
|
||||
return true;
|
||||
}
|
||||
return releaseInfo.getStructureRootPattern().matcher(folder.getName()).matches();
|
||||
return isVolumeRoot(folder) || releaseInfo.getStructureRootPattern().matcher(folder.getName()).matches();
|
||||
}
|
||||
|
||||
public static File getStructureRoot(File file) throws Exception {
|
||||
|
|
|
@ -231,15 +231,16 @@ public class ReleaseInfo {
|
|||
}
|
||||
|
||||
// user-specific media roots
|
||||
String username = System.getProperty("user.name", "anonymous");
|
||||
|
||||
for (File mediaRoot : getMediaRoots()) {
|
||||
volumes.addAll(getChildren(mediaRoot, FOLDERS));
|
||||
volumes.add(mediaRoot);
|
||||
|
||||
// add additional user roots if user.home is not set properly or listFiles doesn't work
|
||||
String username = System.getProperty("user.name");
|
||||
if (username != null && username.length() > 0) {
|
||||
volumes.add(new File(mediaRoot, username));
|
||||
}
|
||||
File userRoot = new File(mediaRoot, username);
|
||||
volumes.add(userRoot);
|
||||
volumes.add(new File(userRoot, "Movies")); // ignore default Movie folder on Mac
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue