From 9f618efa2f8858787c42bc3c071c4c53427dc91f Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Thu, 15 Sep 2011 07:24:32 +0000 Subject: [PATCH] * allow srt pass-through in GUI as well when only encoding is changed, not the format --- .../ui/panel/subtitle/SubtitleDownloadComponent.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/net/sourceforge/filebot/ui/panel/subtitle/SubtitleDownloadComponent.java b/source/net/sourceforge/filebot/ui/panel/subtitle/SubtitleDownloadComponent.java index 6f89c516..16503a5c 100644 --- a/source/net/sourceforge/filebot/ui/panel/subtitle/SubtitleDownloadComponent.java +++ b/source/net/sourceforge/filebot/ui/panel/subtitle/SubtitleDownloadComponent.java @@ -53,6 +53,7 @@ import ca.odell.glazedlists.swing.TextComponentMatcherEditor; import net.miginfocom.swing.MigLayout; import net.sourceforge.filebot.ResourceManager; +import net.sourceforge.filebot.subtitle.SubtitleFormat; import net.sourceforge.filebot.ui.panel.subtitle.SubtitlePackage.Download.Phase; import net.sourceforge.filebot.ui.transfer.DefaultTransferHandler; import net.sourceforge.filebot.vfs.MemoryFile; @@ -332,7 +333,8 @@ class SubtitleDownloadComponent extends JComponent { sf.setSelectedFile(new File(name + "." + ext)); if (sf.showSaveDialog(getWindow(this)) == JFileChooser.APPROVE_OPTION) { - writeFile(exportSubtitles(file, sf.getSelectedFormat(), sf.getTimingOffset(), sf.getSelectedEncoding()), sf.getSelectedFile()); + SubtitleFormat targetFormat = sf.getSelectedFormat().getFilter().accept(file.getName()) ? null : sf.getSelectedFormat(); + writeFile(exportSubtitles(file, targetFormat, sf.getTimingOffset(), sf.getSelectedEncoding()), sf.getSelectedFile()); } } else { // multiple files @@ -350,7 +352,8 @@ class SubtitleDownloadComponent extends JComponent { String name = validateFileName(getNameWithoutExtension(file.getName())); File destination = new File(folder, name + "." + ext); - writeFile(exportSubtitles(file, sf.getSelectedFormat(), sf.getTimingOffset(), sf.getSelectedEncoding()), destination); + SubtitleFormat targetFormat = sf.getSelectedFormat().getFilter().accept(file.getName()) ? null : sf.getSelectedFormat(); + writeFile(exportSubtitles(file, targetFormat, sf.getTimingOffset(), sf.getSelectedEncoding()), destination); } } }