diff --git a/source/net/sourceforge/filebot/ui/panel/subtitle/SubtitleDropTarget.java b/source/net/sourceforge/filebot/ui/panel/subtitle/SubtitleDropTarget.java index 26205df9..bdde7e94 100644 --- a/source/net/sourceforge/filebot/ui/panel/subtitle/SubtitleDropTarget.java +++ b/source/net/sourceforge/filebot/ui/panel/subtitle/SubtitleDropTarget.java @@ -132,7 +132,11 @@ abstract class SubtitleDropTarget extends JButton { if (containsOnly(files, FOLDERS)) { // collect all video files from the dropped folders - return handleDownload(filter(listFiles(files, 0), VIDEO_FILES)); + List videoFiles = filter(listFiles(files, 0), VIDEO_FILES); + + if (videoFiles.size() > 0) { + return handleDownload(videoFiles); + } } if (containsOnly(files, SUBTITLE_FILES)) { @@ -149,14 +153,25 @@ abstract class SubtitleDropTarget extends JButton { } + private boolean containsOnlyVideoSubtitleMatches(List files) { + List subtitles = filter(files, SUBTITLE_FILES); + + if (subtitles.isEmpty()) + return false; + + // number of subtitle files must match the number of video files + return subtitles.size() == filter(files, VIDEO_FILES).size(); + } + + private DropAction getDropAction(List files) { // video files only, or any folder, containing video files if (containsOnly(files, VIDEO_FILES) || (containsOnly(files, FOLDERS) && filter(listFiles(files, 0), VIDEO_FILES).size() > 0)) { return DropAction.Download; } - // subtitle files only, or video/subtitle pairs - if (containsOnly(files, SUBTITLE_FILES) || filter(files, VIDEO_FILES).size() == filter(files, SUBTITLE_FILES).size()) { + // subtitle files only, or video/subtitle matches + if (containsOnly(files, SUBTITLE_FILES) || containsOnlyVideoSubtitleMatches(files)) { return DropAction.Upload; } diff --git a/source/net/sourceforge/filebot/ui/panel/subtitle/SubtitlePanel.java b/source/net/sourceforge/filebot/ui/panel/subtitle/SubtitlePanel.java index a9511fe6..5196ce43 100644 --- a/source/net/sourceforge/filebot/ui/panel/subtitle/SubtitlePanel.java +++ b/source/net/sourceforge/filebot/ui/panel/subtitle/SubtitlePanel.java @@ -95,7 +95,7 @@ public class SubtitlePanel extends AbstractSearchPanel