1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-02 00:15:02 -04:00

* include movie alias titles in osdb index

This commit is contained in:
Reinhard Pointner 2015-05-24 22:54:59 +00:00
parent 1c928e5592
commit c68c5adb3a
3 changed files with 50 additions and 36 deletions

View File

@ -111,35 +111,6 @@ def csv(f, delim, keyIndex, valueIndex) {
/* ------------------------------------------------------------------------- */
// BUILD osdb index
def osdb = []
new File('osdb.txt').eachLine('UTF-8'){
def fields = it.split(/\t/)*.trim()
// 0 IDMovie, 1 IDMovieImdb, 2 MovieName, 3 MovieYear, 4 MovieKind, 5 MoviePriority
if (fields.size() == 6 && fields[1] ==~ /\d+/ && fields[3] ==~ /\d{4}/) {
if (fields[4] ==~ /movie|tv.series/ && isValidMovieName(fields[2]) && (fields[3] as int) >= 1970 && (fields[5] as int) >= 100) {
// 0 imdbid, 1 name, 2 year, 3 kind, 4 priority
osdb << [fields[1] as int, fields[2], fields[3] as int, fields[4] == /movie/ ? 'm' : fields[4] == /tv series/ ? 's' : '?', fields[5] as int]
}
}
}
// sort reverse by score
osdb.sort{ a, b -> b[4] <=> a[4] }
// reset score/priority because it's currently not used
osdb*.set(4, 0)
// sanity check
if (osdb.size() < 30000) { die('OSDB index sanity failed:' + osdb.size()) }
pack(osdb_out, osdb*.join('\t'))
/* ------------------------------------------------------------------------- */
// BUILD moviedb index
def omdb = []
new File('omdbMovies.txt').eachLine('Windows-1252'){
@ -349,3 +320,44 @@ def anidb_txt = anidb_index.findResults{ row -> row.join('\t') }.sort().unique()
// sanity check
if (anidb_txt.size() < 8000) { die('AniDB index sanity failed:' + anidb_txt.size()) }
pack(anidb_out, anidb_txt)
/* ------------------------------------------------------------------------- */
// BUILD osdb index
def osdb = []
new File('osdb.txt').eachLine('UTF-8'){
def fields = it.split(/\t/)*.trim()
// 0 IDMovie, 1 IDMovieImdb, 2 MovieName, 3 MovieYear, 4 MovieKind, 5 MoviePriority
if (fields.size() == 6 && fields[1] ==~ /\d+/ && fields[3] ==~ /\d{4}/) {
if (fields[4] ==~ /movie|tv.series/ && isValidMovieName(fields[2]) && (fields[3] as int) >= 1970 && (fields[5] as int) >= 100) {
// 0 imdbid, 1 name, 2 year, 3 kind, 4 priority
osdb << [fields[1] as int, fields[2], fields[3] as int, fields[4] == /movie/ ? 'm' : fields[4] == /tv series/ ? 's' : '?', fields[5] as int]
}
}
}
// sort reverse by score
osdb.sort{ a, b -> b[4] <=> a[4] }
// reset score/priority because it's currently not used
osdb*.set(4, 0)
// collect final output data
osdb = osdb.findResults{
def names = [it[1]]
if (it[3] == 'm') {
def tmdb_entry = tmdb_index[it[0].pad(7)]
if (tmdb_entry != null) {
names += tmdb_entry[4..-1]
}
}
return [it[3], it[4], it[0], it[2]] + names.unique()
}
// sanity check
if (osdb.size() < 30000) { die('OSDB index sanity failed:' + osdb.size()) }
pack(osdb_out, osdb*.join('\t'))

View File

@ -38,6 +38,7 @@ import net.filebot.web.CachedResource;
import net.filebot.web.Movie;
import net.filebot.web.SubtitleSearchResult;
import net.filebot.web.TheTVDBSearchResult;
import net.filebot.web.SubtitleSearchResult.Kind;
import org.tukaani.xz.XZInputStream;
@ -451,12 +452,13 @@ public class ReleaseInfo {
List<SubtitleSearchResult> result = new ArrayList<SubtitleSearchResult>(rows.size());
for (String[] row : rows) {
int imdbid = parseInt(row[0]);
String name = row[1];
int year = parseInt(row[2]);
String kind = row[3];
int score = parseInt(row[4]);
result.add(new SubtitleSearchResult(imdbid, name, year, kind, score));
String kind = row[0];
int score = parseInt(row[1]);
int imdbId = parseInt(row[2]);
int year = parseInt(row[3]);
String name = row[4];
String[] aliasNames = copyOfRange(row, 5, row.length);
result.add(new SubtitleSearchResult(name, aliasNames, year, imdbId, -1, Locale.ENGLISH, SubtitleSearchResult.Kind.forName(kind), score));
}
return result.toArray(new SubtitleSearchResult[0]);

View File

@ -5,7 +5,7 @@ import java.util.Locale;
public class SubtitleSearchResult extends Movie {
enum Kind {
public enum Kind {
Movie, Series, Other, Unkown;
public static Kind forName(String s) {