mirror of
https://github.com/mitb-archive/filebot
synced 2025-01-11 05:48:01 -05:00
* make new part sets per folder
This commit is contained in:
parent
30d3134f81
commit
878f311cae
@ -1,7 +1,5 @@
|
||||
|
||||
package net.sourceforge.filebot.ui.rename;
|
||||
|
||||
|
||||
import static java.awt.Cursor.*;
|
||||
import static java.util.Collections.*;
|
||||
import static net.sourceforge.filebot.MediaTypes.*;
|
||||
@ -57,17 +55,14 @@ import net.sourceforge.filebot.web.MoviePart;
|
||||
import net.sourceforge.filebot.web.SortOrder;
|
||||
import net.sourceforge.tuned.FileUtilities.ParentFilter;
|
||||
|
||||
|
||||
class MovieHashMatcher implements AutoCompleteMatcher {
|
||||
|
||||
private final MovieIdentificationService service;
|
||||
|
||||
|
||||
public MovieHashMatcher(MovieIdentificationService service) {
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<Match<File, ?>> match(final List<File> files, final SortOrder sortOrder, final Locale locale, final boolean autodetect, final Component parent) throws Exception {
|
||||
// ignore sample files
|
||||
@ -226,22 +221,24 @@ class MovieHashMatcher implements AutoCompleteMatcher {
|
||||
// collect all File/MoviePart matches
|
||||
List<Match<File, ?>> matches = new ArrayList<Match<File, ?>>();
|
||||
|
||||
for (Entry<Movie, SortedSet<File>> entry : filesByMovie.entrySet()) {
|
||||
for (List<File> fileSet : mapByExtension(entry.getValue()).values()) {
|
||||
// resolve movie parts
|
||||
for (int i = 0; i < fileSet.size(); i++) {
|
||||
Movie moviePart = entry.getKey();
|
||||
if (fileSet.size() > 1) {
|
||||
moviePart = new MoviePart(moviePart, i + 1, fileSet.size());
|
||||
}
|
||||
for (Entry<Movie, SortedSet<File>> byMovie : filesByMovie.entrySet()) {
|
||||
for (List<File> byFolder : mapByFolder(byMovie.getValue()).values()) {
|
||||
for (List<File> fileSet : mapByExtension(byFolder).values()) {
|
||||
// resolve movie parts
|
||||
for (int i = 0; i < fileSet.size(); i++) {
|
||||
Movie moviePart = byMovie.getKey();
|
||||
if (fileSet.size() > 1) {
|
||||
moviePart = new MoviePart(moviePart, i + 1, fileSet.size());
|
||||
}
|
||||
|
||||
matches.add(new Match<File, Movie>(fileSet.get(i), moviePart.clone()));
|
||||
matches.add(new Match<File, Movie>(fileSet.get(i), moviePart.clone()));
|
||||
|
||||
// automatically add matches for derivate files
|
||||
List<File> derivates = derivatesByMovieFile.get(fileSet.get(i));
|
||||
if (derivates != null) {
|
||||
for (File derivate : derivates) {
|
||||
matches.add(new Match<File, Movie>(derivate, moviePart.clone()));
|
||||
// automatically add matches for derived files
|
||||
List<File> derivates = derivatesByMovieFile.get(fileSet.get(i));
|
||||
if (derivates != null) {
|
||||
for (File derivate : derivates) {
|
||||
matches.add(new Match<File, Movie>(derivate, moviePart.clone()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -260,7 +257,6 @@ class MovieHashMatcher implements AutoCompleteMatcher {
|
||||
return matches;
|
||||
}
|
||||
|
||||
|
||||
protected Movie grabMovieName(File movieFile, Collection<Movie> options, Locale locale, boolean autodetect, Map<String, Object> memory, Component parent) throws Exception {
|
||||
// allow manual user input
|
||||
if (!autodetect || options.isEmpty()) {
|
||||
@ -291,7 +287,6 @@ class MovieHashMatcher implements AutoCompleteMatcher {
|
||||
return options.isEmpty() ? null : selectMovie(movieFile, null, options, memory, parent);
|
||||
}
|
||||
|
||||
|
||||
protected String checkedStripReleaseInfo(File file) throws Exception {
|
||||
String name = stripReleaseInfo(getName(file));
|
||||
|
||||
@ -306,7 +301,6 @@ class MovieHashMatcher implements AutoCompleteMatcher {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
protected Movie selectMovie(final File movieFile, final String userQuery, final Collection<Movie> options, final Map<String, Object> memory, final Component parent) throws Exception {
|
||||
// 1. movie by filename
|
||||
final String fileQuery = (userQuery != null) ? userQuery : checkedStripReleaseInfo(movieFile);
|
||||
|
Loading…
Reference in New Issue
Block a user