1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-08-13 17:03:45 -04:00

* format subtitle name with language id

This commit is contained in:
Reinhard Pointner 2011-11-20 20:29:33 +00:00
parent 7c19e15e3e
commit 210a8c0388

View File

@ -54,6 +54,7 @@ import javax.swing.table.DefaultTableCellRenderer;
import net.miginfocom.swing.MigLayout;
import net.sourceforge.filebot.Analytics;
import net.sourceforge.filebot.ResourceManager;
import net.sourceforge.filebot.ui.Language;
import net.sourceforge.filebot.web.SubtitleDescriptor;
import net.sourceforge.filebot.web.VideoHashSubtitleService;
import net.sourceforge.tuned.FileUtilities;
@ -533,7 +534,10 @@ class VideoHashSubtitleDownloadDialog extends JDialog {
if (selectedOption == null)
throw new IllegalStateException("Selected option must not be null");
return new File(videoFile.getParentFile(), FileUtilities.getName(videoFile) + '.' + selectedOption.getType());
String base = FileUtilities.getName(videoFile);
String subtitleName = String.format("%s.%s.%s", base, selectedOption.getLanguage(), selectedOption.getType());
return new File(videoFile.getParentFile(), subtitleName);
}
@ -599,7 +603,7 @@ class VideoHashSubtitleDownloadDialog extends JDialog {
public String getText() {
return subtitle.getName() + '.' + subtitle.getType();
return String.format("%s.%s.%s", subtitle.getName(), getLanguage(), getType());
}
@ -608,6 +612,12 @@ class VideoHashSubtitleDownloadDialog extends JDialog {
}
public String getLanguage() {
Language lang = Language.getLanguageByName(subtitle.getLanguageName());
return lang != null ? lang.getCode() : null;
}
public String getType() {
return subtitle.getType();
}