1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-08-13 17:03:45 -04:00

* fix some GUI movie auto-selection issues

This commit is contained in:
Reinhard Pointner 2014-01-24 17:31:33 +00:00
parent 54d4dad955
commit c981cba2e2
3 changed files with 16 additions and 5 deletions

View File

@ -151,8 +151,8 @@ movies = tmdb.findResults{
movies = treeSort(movies, { it[3, 2].join(' ') })
// sanity check
pack(moviedb_out, movies*.join('\t'))
if (movies.size() < 50000) { throw new Exception('Movie index sanity failed') }
pack(moviedb_out, movies*.join('\t'))
/* ------------------------------------------------------------------------- */
@ -243,8 +243,8 @@ thetvdb_index = thetvdb_index.sort({ a, b -> a[0] <=> b[0] } as Comparator)
def thetvdb_txt = thetvdb_index.groupBy{ it[0] }.findResults{ k, v -> ([k.pad(6)] + v*.getAt(1).unique{ it.toLowerCase() }).join('\t') }
// sanity check
pack(thetvdb_out, thetvdb_txt)
if (thetvdb_txt.size() < 30000) { throw new Exception('TheTVDB index sanity failed') }
pack(thetvdb_out, thetvdb_txt)
/* ------------------------------------------------------------------------- */
@ -265,5 +265,5 @@ def anidb_index = anidb.findResults{
def anidb_txt = anidb_index.findResults{ row -> row.join('\t') }.sort().unique()
// sanity check
pack(anidb_out, anidb_txt)
if (anidb_txt.size() < 8000) { throw new Exception('AniDB index sanity failed') }
pack(anidb_out, anidb_txt)

View File

@ -207,7 +207,8 @@ def getRenameLog(complete = false) {
import net.sourceforge.filebot.similarity.*
def stripReleaseInfo(name, strict = true) {
return MediaDetection.stripReleaseInfo([name], strict)[0]
def result = MediaDetection.stripReleaseInfo([name], strict)
return result.size() > 0 ? result[0] : null
}
def isEpisode(path, strict = true) {

View File

@ -335,10 +335,20 @@ class MovieHashMatcher implements AutoCompleteMatcher {
final List<Movie> probableMatches = new LinkedList<Movie>();
final SimilarityMetric metric = new NameSimilarityMetric();
final float threshold = 0.9f;
// find probable matches using name similarity >= 0.9
for (Movie result : options) {
if (metric.getSimilarity(fileQuery, result.getName()) >= 0.9 || metric.getSimilarity(folderQuery, result.getName()) >= 0.9) {
float maxSimilarity = 0;
for (String query : new String[] { fileQuery, folderQuery }) {
for (String name : result.getEffectiveNamesWithoutYear()) {
if (maxSimilarity >= threshold)
continue;
maxSimilarity = Math.max(maxSimilarity, metric.getSimilarity(query, name));
}
}
if (maxSimilarity >= threshold) {
probableMatches.add(result);
}
}