* improved movie mode
This commit is contained in:
parent
f11522021d
commit
b2681508ef
|
@ -279,17 +279,17 @@ public class MediaDetection {
|
|||
return options;
|
||||
}
|
||||
|
||||
// add local matching after online search
|
||||
options.addAll(movieNameMatches);
|
||||
|
||||
// query by file / folder name
|
||||
if (queryLookupService != null && !strict) {
|
||||
options.addAll(queryMovieByFileName(files, queryLookupService, locale));
|
||||
}
|
||||
|
||||
// add local matching after online search
|
||||
options.addAll(movieNameMatches);
|
||||
|
||||
// sort by relevance
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# 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
|
||||
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]
|
||||
url.release-groups: http://filebot.sourceforge.net/data/release-groups.txt
|
||||
|
|
|
@ -7,25 +7,25 @@ import java.util.Comparator;
|
|||
|
||||
public class SimilarityComparator implements Comparator<Object> {
|
||||
|
||||
private SimilarityMetric metric;
|
||||
private Object paragon;
|
||||
protected SimilarityMetric metric;
|
||||
protected Object[] paragon;
|
||||
|
||||
|
||||
public SimilarityComparator(SimilarityMetric metric, Object paragon) {
|
||||
public SimilarityComparator(SimilarityMetric metric, Object[] paragon) {
|
||||
this.metric = metric;
|
||||
this.paragon = paragon;
|
||||
}
|
||||
|
||||
|
||||
public SimilarityComparator(String paragon) {
|
||||
public SimilarityComparator(String... paragon) {
|
||||
this(new NameSimilarityMetric(), paragon);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int compare(Object o1, Object o2) {
|
||||
float f1 = metric.getSimilarity(o1, paragon);
|
||||
float f2 = metric.getSimilarity(o2, paragon);
|
||||
float f1 = getMaxSimilarity(o1);
|
||||
float f2 = getMaxSimilarity(o2);
|
||||
|
||||
if (f1 == f2)
|
||||
return 0;
|
||||
|
@ -33,4 +33,12 @@ public class SimilarityComparator implements Comparator<Object> {
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ package net.sourceforge.filebot.ui.rename;
|
|||
|
||||
import static net.sourceforge.filebot.MediaTypes.*;
|
||||
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.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 {
|
||||
// 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) {
|
||||
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
|
||||
final List<Movie> probableMatches = new LinkedList<Movie>();
|
||||
|
||||
// use name similarity metric
|
||||
final String query = stripReleaseInfo(getName(movieFile));
|
||||
final SimilarityMetric metric = new NameSimilarityMetric();
|
||||
|
||||
// find probable matches using name similarity >= 0.9
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -275,7 +291,7 @@ class MovieHashMatcher implements AutoCompleteMatcher {
|
|||
SelectDialog<Movie> selectDialog = new SelectDialog<Movie>(parent, options);
|
||||
|
||||
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.pack();
|
||||
|
||||
|
|
|
@ -2,9 +2,6 @@
|
|||
package net.sourceforge.filebot.web;
|
||||
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
public class Movie extends SearchResult {
|
||||
|
||||
protected int year;
|
||||
|
@ -42,7 +39,11 @@ public class Movie extends SearchResult {
|
|||
public boolean equals(Object object) {
|
||||
if (object instanceof Movie) {
|
||||
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;
|
||||
|
@ -57,7 +58,7 @@ public class Movie extends SearchResult {
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Arrays.hashCode(new Object[] { name, year, imdbId });
|
||||
return imdbId;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,22 +1,88 @@
|
|||
^(TV.)?(Show|Serie|Anime)[s]?$
|
||||
^Movie[s]?$
|
||||
^Video[s]?$
|
||||
.+sample$
|
||||
5[.,]1
|
||||
@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
|
||||
Anime[s]?
|
||||
CD[0]?[1-3]
|
||||
CN
|
||||
CVCD
|
||||
Demonoid
|
||||
Directors.Cut
|
||||
DVSKY
|
||||
ENG
|
||||
ENGLISH
|
||||
EXTENDED
|
||||
Extended.Version
|
||||
ExtraScene
|
||||
ExtraTorrent
|
||||
Fra
|
||||
FRE
|
||||
FRENCH
|
||||
GER
|
||||
GERMAN
|
||||
Hard.Subbed
|
||||
HDRip
|
||||
Hindi
|
||||
HQ
|
||||
iPod
|
||||
ISO
|
||||
iTA
|
||||
iTALIA
|
||||
jigaxx
|
||||
KIDZCORNER
|
||||
KOR
|
||||
Los.Sustitutos
|
||||
mkvonly
|
||||
Movie[s]?
|
||||
MVGroup.org
|
||||
NL
|
||||
NL.Subs
|
||||
NLT
|
||||
Pre.?DVD
|
||||
PROPER
|
||||
PSP
|
||||
READNFO
|
||||
REAL.PROPER
|
||||
REPACK
|
||||
RESYNC
|
||||
RETAIL
|
||||
Sample
|
||||
sample[s]?$
|
||||
Screenshot
|
||||
ShareGo
|
||||
ShareReactor
|
||||
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
|
||||
Video[s]?
|
||||
www[.]
|
||||
xRipp
|
||||
Zune
|
||||
|
|
|
@ -4,12 +4,14 @@
|
|||
187HD
|
||||
1920
|
||||
2HD
|
||||
2Lions
|
||||
2PaCaVeLi
|
||||
2WIRE
|
||||
3Li
|
||||
4HM
|
||||
aAF
|
||||
AaS
|
||||
aceford
|
||||
AE
|
||||
AEGiS
|
||||
AiRWAVES
|
||||
|
@ -33,6 +35,7 @@ BMB
|
|||
BrG
|
||||
BRZONE
|
||||
BTSD
|
||||
CAMELOT
|
||||
CDD
|
||||
CDDHD
|
||||
Chakra
|
||||
|
@ -40,7 +43,9 @@ Chara
|
|||
CHD
|
||||
CHDSUBS
|
||||
Chel
|
||||
CHGRP
|
||||
CHRONiCLES
|
||||
CHUPPI
|
||||
CiA
|
||||
CiNEFiLE
|
||||
CiNEFOX
|
||||
|
@ -58,9 +63,11 @@ CULTHD
|
|||
CuMBuCKeTS
|
||||
CYBERMEN
|
||||
D-Z0N3
|
||||
danger2u
|
||||
DARM
|
||||
DATA
|
||||
DAW
|
||||
DDC
|
||||
DEAL
|
||||
DEFiNiTE
|
||||
DEFiNiTiON
|
||||
|
@ -68,6 +75,7 @@ DEFUSED
|
|||
DEiTY
|
||||
DETAiLS
|
||||
DEViSE
|
||||
DEWSTRR
|
||||
DHD
|
||||
DiAMOND
|
||||
DiCH
|
||||
|
@ -85,7 +93,12 @@ DnB
|
|||
DNL
|
||||
DOT
|
||||
DOWN
|
||||
DUQA
|
||||
DutchReleaseTeam
|
||||
Ekolb
|
||||
Electri4ka
|
||||
ELECTRiC
|
||||
Electrichka
|
||||
EMPiREHD
|
||||
EnDoR
|
||||
ESiR
|
||||
|
@ -115,6 +128,7 @@ GB
|
|||
GEHENNA
|
||||
GiNJi
|
||||
GMoRK
|
||||
Goblin10
|
||||
GoLDSToNE
|
||||
GOTHiC
|
||||
H2
|
||||
|
@ -150,6 +164,7 @@ iNFAMOUS
|
|||
InSaNiTy
|
||||
iNSECTS
|
||||
iNSPiRED
|
||||
iNTERNAL
|
||||
iON
|
||||
iTA
|
||||
ITZ
|
||||
|
@ -174,6 +189,7 @@ LTT
|
|||
MAiN
|
||||
MainEvent
|
||||
MARiNES
|
||||
MAXSPEED
|
||||
MEDiEVAL
|
||||
METiS
|
||||
MiND
|
||||
|
@ -189,6 +205,8 @@ MuSt
|
|||
mV4U
|
||||
mVmHD
|
||||
NBS
|
||||
NEW.SOURCE
|
||||
NewArtRiot
|
||||
NGR
|
||||
NGXHD
|
||||
NhaNc3
|
||||
|
@ -197,6 +215,7 @@ Nile
|
|||
NiX
|
||||
NL.Subs
|
||||
Noir
|
||||
NORARS
|
||||
NOsegmenT
|
||||
NoTV
|
||||
NOVO
|
||||
|
@ -257,6 +276,7 @@ SECTOR7
|
|||
SEPTiC
|
||||
SexSh0p
|
||||
SFM
|
||||
SHAMNBOYZ
|
||||
SiGHTHD
|
||||
SiNNERS
|
||||
SiTV
|
||||
|
@ -287,6 +307,7 @@ TX
|
|||
ULTiMATE
|
||||
UMF
|
||||
USELESS
|
||||
UVall
|
||||
VanRay
|
||||
VCDVaULT
|
||||
ViCiOsO
|
||||
|
|
Loading…
Reference in New Issue