* improved clutter file handling

This commit is contained in:
Reinhard Pointner 2013-03-28 09:04:35 +00:00
parent 04262c756b
commit beee3bce91
2 changed files with 20 additions and 2 deletions

View File

@ -271,7 +271,7 @@ public class ReleaseInfo {
public FileFilter getClutterFileFilter() throws IOException { public FileFilter getClutterFileFilter() throws IOException {
return new FileFolderNameFilter(getExcludePattern()); return new ClutterFileFilter(getExcludePattern(), 262144000); // only files smaller than 250 MB may be considered clutter
} }
// fetch release group names online and try to update the data every other day // fetch release group names online and try to update the data every other day
@ -430,6 +430,24 @@ public class ReleaseInfo {
} }
public static class ClutterFileFilter extends FileFolderNameFilter {
private long maxFileSize;
public ClutterFileFilter(Pattern namePattern, long maxFileSize) {
super(namePattern);
this.maxFileSize = maxFileSize;
}
@Override
public boolean accept(File file) {
return super.accept(file) && file.isFile() && file.length() < maxFileSize;
}
}
private Collection<String> quoteAll(Collection<String> strings) { private Collection<String> quoteAll(Collection<String> strings) {
List<String> patterns = new ArrayList<String>(strings.size()); List<String> patterns = new ArrayList<String>(strings.size());
for (String it : strings) { for (String it : strings) {

View File

@ -135,7 +135,7 @@ def groups = input.groupBy{ f ->
if (parseEpisodeNumber(fn, true) || parseDate(fn) || (fn.contains(sn) && (parseEpisodeNumber(fn.after(sn), false) || fn.after(sn) =~ /\d{1,2}\D+\d{1,2}/) && matchMovie(fn, true) == null) || (fn.after(sn) ==~ /.{0,3} - .+/ && matchMovie(fn, true) == null) || f.dir.listFiles{ it.isVideo() && norm(it.name) =~ sn && it.name =~ /\b\d{1,3}\b/}.size() >= 10) { if (parseEpisodeNumber(fn, true) || parseDate(fn) || (fn.contains(sn) && (parseEpisodeNumber(fn.after(sn), false) || fn.after(sn) =~ /\d{1,2}\D+\d{1,2}/) && matchMovie(fn, true) == null) || (fn.after(sn) ==~ /.{0,3} - .+/ && matchMovie(fn, true) == null) || f.dir.listFiles{ it.isVideo() && norm(it.name) =~ sn && it.name =~ /\b\d{1,3}\b/}.size() >= 10) {
_log.fine("Exclude Movie: $mov") _log.fine("Exclude Movie: $mov")
mov = null mov = null
} else if ((detectMovie(f, true) && [dn, fn].find{ it =~ /(19|20)\d{2}/ }) || [dn, fn].find{ it =~ mn && !(it.after(mn) =~ /\b\d{1,3}\b/) && !(it.before(mn).contains(sn)) }) { } else if (mn ==~ fn || (detectMovie(f, true) && [dn, fn].find{ it =~ /(19|20)\d{2}/ }) || [dn, fn].find{ it =~ mn && !(it.after(mn) =~ /\b\d{1,3}\b/) && !(it.before(mn).contains(sn)) }) {
_log.fine("Exclude Series: $tvs") _log.fine("Exclude Series: $tvs")
tvs = null tvs = null
} }