* improved movie mode

This commit is contained in:
Reinhard Pointner 2012-02-22 08:30:50 +00:00
parent f11522021d
commit b2681508ef
7 changed files with 137 additions and 25 deletions

View File

@ -279,17 +279,17 @@ public class MediaDetection {
return options; return options;
} }
// add local matching after online search
options.addAll(movieNameMatches);
// query by file / folder name // query by file / folder name
if (queryLookupService != null && !strict) { if (queryLookupService != null && !strict) {
options.addAll(queryMovieByFileName(files, queryLookupService, locale)); options.addAll(queryMovieByFileName(files, queryLookupService, locale));
} }
// add local matching after online search
options.addAll(movieNameMatches);
// sort by relevance // sort by relevance
List<Movie> optionsByRelevance = new ArrayList<Movie>(options); List<Movie> optionsByRelevance = new ArrayList<Movie>(options);
sort(optionsByRelevance, new SimilarityComparator(stripReleaseInfo(getName(movieFile)))); sort(optionsByRelevance, new SimilarityComparator(stripReleaseInfo(getName(movieFile)), stripReleaseInfo(getName(movieFile.getParentFile()))));
return optionsByRelevance; return optionsByRelevance;
} }

View File

@ -1,8 +1,8 @@
# source names mostly copied from [http://en.wikipedia.org/wiki/Pirated_movie_release_types] # source names mostly copied from [http://en.wikipedia.org/wiki/Pirated_movie_release_types]
pattern.video.source: CAMRip|CAM|TS|TELESYNC|PDVD|TS|TELESYNC|PDVD|PPV|PPVRip|Screener|SCR|SCREENER|DVDSCR|DVDSCREENER|BDSCR|R5|R5LINE|DVDRip|DVDR|TVRip|DSR|PDTV|HDTV|DVBRip|DTHRip|VODRip|VODR|BDRip|BRRip|BluRay|BDR|HDDVD|HDRip|WorkPrint|VHS|VCD|WEB-DL pattern.video.source: CAMRip|CAM|TS|TELESYNC|PDVD|TS|TELESYNC|PDVD|PPV|PPVRip|Screener|SCR|SCREENER|DVDSCR|DVDSCREENER|BDSCR|R5|R5LINE|DVDRip|DVDR|TVRip|DSR|PDTV|HDTV|DVB|DVBRip|DTHRip|VODRip|VODR|BDRip|BRRip|BluRay|BDR|BR-Scr|BR-Screener|HDDVD|HDRip|WorkPrint|VHS|VCD|Telesync|TELECINE|WEB-DL|Webrip
# additional release info patterns # additional release info patterns
pattern.video.format: DivX|Xvid|AVC|x264|h264|3ivx|mpeg|mpeg4|mp3|aac|ac3|2ch|6ch|WS|HR|720p|1080p pattern.video.format: DivX|Xvid|AVC|x264|h264|3ivx|mpeg|mpeg4|mp3|aac|ac3|2ch|6ch|WS|HR|720p|1080p|NTSC
# group names mostly copied from [http://scenelingo.wordpress.com/list-of-scene-release-groups] # group names mostly copied from [http://scenelingo.wordpress.com/list-of-scene-release-groups]
url.release-groups: http://filebot.sourceforge.net/data/release-groups.txt url.release-groups: http://filebot.sourceforge.net/data/release-groups.txt

View File

@ -7,25 +7,25 @@ import java.util.Comparator;
public class SimilarityComparator implements Comparator<Object> { public class SimilarityComparator implements Comparator<Object> {
private SimilarityMetric metric; protected SimilarityMetric metric;
private Object paragon; protected Object[] paragon;
public SimilarityComparator(SimilarityMetric metric, Object paragon) { public SimilarityComparator(SimilarityMetric metric, Object[] paragon) {
this.metric = metric; this.metric = metric;
this.paragon = paragon; this.paragon = paragon;
} }
public SimilarityComparator(String paragon) { public SimilarityComparator(String... paragon) {
this(new NameSimilarityMetric(), paragon); this(new NameSimilarityMetric(), paragon);
} }
@Override @Override
public int compare(Object o1, Object o2) { public int compare(Object o1, Object o2) {
float f1 = metric.getSimilarity(o1, paragon); float f1 = getMaxSimilarity(o1);
float f2 = metric.getSimilarity(o2, paragon); float f2 = getMaxSimilarity(o2);
if (f1 == f2) if (f1 == f2)
return 0; return 0;
@ -33,4 +33,12 @@ public class SimilarityComparator implements Comparator<Object> {
return f1 > f2 ? -1 : 1; return f1 > f2 ? -1 : 1;
} }
public float getMaxSimilarity(Object obj) {
float m = 0;
for (Object it : paragon) {
m += (it != null) ? metric.getSimilarity(obj, it) : 0;
}
return m / paragon.length;
}
} }

View File

@ -4,6 +4,7 @@ package net.sourceforge.filebot.ui.rename;
import static net.sourceforge.filebot.MediaTypes.*; import static net.sourceforge.filebot.MediaTypes.*;
import static net.sourceforge.filebot.media.MediaDetection.*; import static net.sourceforge.filebot.media.MediaDetection.*;
import static net.sourceforge.filebot.similarity.Normalization.*;
import static net.sourceforge.tuned.FileUtilities.*; import static net.sourceforge.tuned.FileUtilities.*;
import static net.sourceforge.tuned.ui.TunedUtilities.*; import static net.sourceforge.tuned.ui.TunedUtilities.*;
@ -243,20 +244,35 @@ class MovieHashMatcher implements AutoCompleteMatcher {
protected Movie selectMovie(final File movieFile, final Collection<Movie> options, final Component parent) throws Exception { protected Movie selectMovie(final File movieFile, final Collection<Movie> options, final Component parent) throws Exception {
// clean file / folder names
final String fileQuery = stripReleaseInfo(getName(movieFile)).toLowerCase();
final String folderQuery = stripReleaseInfo(getName(movieFile.getParentFile())).toLowerCase();
// auto-ignore invalid files
if (fileQuery.length() < 2) {
return null;
}
if (options.size() == 1) { if (options.size() == 1) {
return options.iterator().next(); return options.iterator().next();
} }
// auto-select perfect match
for (Movie movie : options) {
String movieIdentifier = normalizePunctuation(movie.toString()).toLowerCase();
if (fileQuery.startsWith(movieIdentifier) || folderQuery.startsWith(movieIdentifier)) {
return movie;
}
}
// auto-select most probable search result // auto-select most probable search result
final List<Movie> probableMatches = new LinkedList<Movie>(); final List<Movie> probableMatches = new LinkedList<Movie>();
// use name similarity metric
final String query = stripReleaseInfo(getName(movieFile));
final SimilarityMetric metric = new NameSimilarityMetric(); final SimilarityMetric metric = new NameSimilarityMetric();
// find probable matches using name similarity >= 0.9 // find probable matches using name similarity >= 0.9
for (Movie result : options) { for (Movie result : options) {
if (metric.getSimilarity(query, result.getName()) >= 0.9) { if (metric.getSimilarity(fileQuery, result.getName()) >= 0.9 || metric.getSimilarity(folderQuery, result.getName()) >= 0.9) {
probableMatches.add(result); probableMatches.add(result);
} }
} }
@ -275,7 +291,7 @@ class MovieHashMatcher implements AutoCompleteMatcher {
SelectDialog<Movie> selectDialog = new SelectDialog<Movie>(parent, options); SelectDialog<Movie> selectDialog = new SelectDialog<Movie>(parent, options);
selectDialog.setTitle(movieFile.getPath()); selectDialog.setTitle(movieFile.getPath());
selectDialog.getHeaderLabel().setText(String.format("Movies matching '%s':", query)); selectDialog.getHeaderLabel().setText(String.format("Movies matching '%s':", fileQuery));
selectDialog.getCancelAction().putValue(Action.NAME, "Ignore"); selectDialog.getCancelAction().putValue(Action.NAME, "Ignore");
selectDialog.pack(); selectDialog.pack();

View File

@ -2,9 +2,6 @@
package net.sourceforge.filebot.web; package net.sourceforge.filebot.web;
import java.util.Arrays;
public class Movie extends SearchResult { public class Movie extends SearchResult {
protected int year; protected int year;
@ -42,7 +39,11 @@ public class Movie extends SearchResult {
public boolean equals(Object object) { public boolean equals(Object object) {
if (object instanceof Movie) { if (object instanceof Movie) {
Movie other = (Movie) object; Movie other = (Movie) object;
return imdbId == other.imdbId && year == other.year && name.equals(other.name); if (imdbId > 0 && other.imdbId > 0) {
return imdbId == other.imdbId;
}
return year == other.year && name.equals(other.name);
} }
return false; return false;
@ -57,7 +58,7 @@ public class Movie extends SearchResult {
@Override @Override
public int hashCode() { public int hashCode() {
return Arrays.hashCode(new Object[] { name, year, imdbId }); return imdbId;
} }

View File

@ -1,22 +1,88 @@
^(TV.)?(Show|Serie|Anime)[s]?$ .+sample$
^Movie[s]?$ 5[.,]1
^Video[s]?$ @KIDZ
[1-3]CDRip
[1-9].?of.?[1-9]
^(TV.)?(Show|Serie)[s]?
^[0-9]{1,2}[.]
^Cover
^Info
^Movie
^SAMPLE
^Tracker
^Trailer
A.Release.Lounge A.Release.Lounge
Anime[s]?
CD[0]?[1-3] CD[0]?[1-3]
CN
CVCD
Demonoid Demonoid
Directors.Cut
DVSKY
ENG
ENGLISH
EXTENDED
Extended.Version Extended.Version
ExtraScene ExtraScene
ExtraTorrent ExtraTorrent
Fra
FRE
FRENCH
GER
GERMAN
Hard.Subbed Hard.Subbed
HDRip HDRip
Hindi
HQ
iPod
ISO
iTA
iTALIA
jigaxx
KIDZCORNER
KOR
Los.Sustitutos
mkvonly mkvonly
Movie[s]?
MVGroup.org MVGroup.org
NL
NL.Subs
NLT
Pre.?DVD
PROPER PROPER
PSP
READNFO READNFO
REAL.PROPER
REPACK REPACK
RESYNC
RETAIL RETAIL
Sample
sample[s]?$ sample[s]?$
Screenshot
ShareGo
ShareReactor ShareReactor
ShareZONE ShareZONE
swe.sub ShortKut
Snapshots
SPA
SPANISH
Sub
SUBBED
Subs
Subtit
Subtitle
swe.?sub
SYNC
SYNCFIX
TC
TPB
TRUEFRENCH
TS
TSXVID
UNCUT
unrated
UsaBit.com UsaBit.com
Video[s]?
www[.]
xRipp
Zune

View File

@ -4,12 +4,14 @@
187HD 187HD
1920 1920
2HD 2HD
2Lions
2PaCaVeLi 2PaCaVeLi
2WIRE 2WIRE
3Li 3Li
4HM 4HM
aAF aAF
AaS AaS
aceford
AE AE
AEGiS AEGiS
AiRWAVES AiRWAVES
@ -33,6 +35,7 @@ BMB
BrG BrG
BRZONE BRZONE
BTSD BTSD
CAMELOT
CDD CDD
CDDHD CDDHD
Chakra Chakra
@ -40,7 +43,9 @@ Chara
CHD CHD
CHDSUBS CHDSUBS
Chel Chel
CHGRP
CHRONiCLES CHRONiCLES
CHUPPI
CiA CiA
CiNEFiLE CiNEFiLE
CiNEFOX CiNEFOX
@ -58,9 +63,11 @@ CULTHD
CuMBuCKeTS CuMBuCKeTS
CYBERMEN CYBERMEN
D-Z0N3 D-Z0N3
danger2u
DARM DARM
DATA DATA
DAW DAW
DDC
DEAL DEAL
DEFiNiTE DEFiNiTE
DEFiNiTiON DEFiNiTiON
@ -68,6 +75,7 @@ DEFUSED
DEiTY DEiTY
DETAiLS DETAiLS
DEViSE DEViSE
DEWSTRR
DHD DHD
DiAMOND DiAMOND
DiCH DiCH
@ -85,7 +93,12 @@ DnB
DNL DNL
DOT DOT
DOWN DOWN
DUQA
DutchReleaseTeam
Ekolb
Electri4ka
ELECTRiC ELECTRiC
Electrichka
EMPiREHD EMPiREHD
EnDoR EnDoR
ESiR ESiR
@ -115,6 +128,7 @@ GB
GEHENNA GEHENNA
GiNJi GiNJi
GMoRK GMoRK
Goblin10
GoLDSToNE GoLDSToNE
GOTHiC GOTHiC
H2 H2
@ -150,6 +164,7 @@ iNFAMOUS
InSaNiTy InSaNiTy
iNSECTS iNSECTS
iNSPiRED iNSPiRED
iNTERNAL
iON iON
iTA iTA
ITZ ITZ
@ -174,6 +189,7 @@ LTT
MAiN MAiN
MainEvent MainEvent
MARiNES MARiNES
MAXSPEED
MEDiEVAL MEDiEVAL
METiS METiS
MiND MiND
@ -189,6 +205,8 @@ MuSt
mV4U mV4U
mVmHD mVmHD
NBS NBS
NEW.SOURCE
NewArtRiot
NGR NGR
NGXHD NGXHD
NhaNc3 NhaNc3
@ -197,6 +215,7 @@ Nile
NiX NiX
NL.Subs NL.Subs
Noir Noir
NORARS
NOsegmenT NOsegmenT
NoTV NoTV
NOVO NOVO
@ -257,6 +276,7 @@ SECTOR7
SEPTiC SEPTiC
SexSh0p SexSh0p
SFM SFM
SHAMNBOYZ
SiGHTHD SiGHTHD
SiNNERS SiNNERS
SiTV SiTV
@ -287,6 +307,7 @@ TX
ULTiMATE ULTiMATE
UMF UMF
USELESS USELESS
UVall
VanRay VanRay
VCDVaULT VCDVaULT
ViCiOsO ViCiOsO