* improve {group} name extraction
This commit is contained in:
parent
486d720e0b
commit
cb10a44ce4
|
@ -419,8 +419,26 @@ public class MediaBindingBean {
|
||||||
// use inferred media file
|
// use inferred media file
|
||||||
File inferredMediaFile = getInferredMediaFile();
|
File inferredMediaFile = getInferredMediaFile();
|
||||||
|
|
||||||
|
// consider foldername, filename and original filename
|
||||||
|
String[] filenames = new String[] { inferredMediaFile.getParentFile().getName(), inferredMediaFile.getName(), getOriginalFileName(inferredMediaFile) };
|
||||||
|
|
||||||
|
// reduce false positives by removing the know titles from the name
|
||||||
|
List<String> titles = new ArrayList<String>();
|
||||||
|
titles.add(getName());
|
||||||
|
titles.add(getYear().toString());
|
||||||
|
titles.addAll(getAliasNames());
|
||||||
|
Pattern nonGroupPattern = releaseInfo.getCustomRemovePattern(titles);
|
||||||
|
|
||||||
|
for (int i = 0; i < filenames.length; i++) {
|
||||||
|
if (filenames[i] == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// normalize space characters
|
||||||
|
filenames[i] = nonGroupPattern.matcher(normalizeSpace(filenames[i], " ")).replaceAll("");
|
||||||
|
}
|
||||||
|
|
||||||
// look for release group names in media file and it's parent folder
|
// look for release group names in media file and it's parent folder
|
||||||
return releaseInfo.getReleaseGroup(inferredMediaFile.getParent(), inferredMediaFile.getName(), getOriginalFileName(inferredMediaFile));
|
return releaseInfo.getReleaseGroup(filenames);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Define("lang")
|
@Define("lang")
|
||||||
|
|
|
@ -266,6 +266,10 @@ public class ReleaseInfo {
|
||||||
return compile(join(excludeBlacklistResource.get(), "|"), CASE_INSENSITIVE | UNICODE_CASE);
|
return compile(join(excludeBlacklistResource.get(), "|"), CASE_INSENSITIVE | UNICODE_CASE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Pattern getCustomRemovePattern(Collection<String> terms) throws IOException {
|
||||||
|
return compile("(?<!\\p{Alnum})(" + join(quoteAll(terms), "|") + ")(?!\\p{Alnum})", CASE_INSENSITIVE | UNICODE_CASE);
|
||||||
|
}
|
||||||
|
|
||||||
public Movie[] getMovieList() throws IOException {
|
public Movie[] getMovieList() throws IOException {
|
||||||
return movieListResource.get();
|
return movieListResource.get();
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,10 @@ public class Normalization {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String normalizeSpace(String name, String replacement) {
|
||||||
|
return name.replaceAll("[:?._]", " ").trim().replaceAll("\\s+", replacement);
|
||||||
|
}
|
||||||
|
|
||||||
public static String removeEmbeddedChecksum(String string) {
|
public static String removeEmbeddedChecksum(String string) {
|
||||||
// match embedded checksum and surrounding brackets
|
// match embedded checksum and surrounding brackets
|
||||||
return checksum.matcher(string).replaceAll("");
|
return checksum.matcher(string).replaceAll("");
|
||||||
|
|
|
@ -2003,6 +2003,7 @@ SATANiC
|
||||||
SATIVA
|
SATIVA
|
||||||
SAVANNAH
|
SAVANNAH
|
||||||
SB-Subs
|
SB-Subs
|
||||||
|
SbR
|
||||||
SCARED
|
SCARED
|
||||||
SChiZO
|
SChiZO
|
||||||
Scratch404
|
Scratch404
|
||||||
|
|
Loading…
Reference in New Issue